-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGroup.java
More file actions
252 lines (213 loc) · 7.45 KB
/
Copy pathGroup.java
File metadata and controls
252 lines (213 loc) · 7.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
/*
* File : Group.java
* Author : Xinying Li, Bryan Carpenter
* Created : Thu Apr 9 12:22:15 1998
* Revision : $Revision: 1.8 $
* Updated : $Date: 2003/01/16 16:39:34 $
* Copyright: Northeast Parallel Architectures Center
* at Syracuse University 1998
*/
package mpi;
//import mpi.*;
public class Group extends Freeable {
protected final static int EMPTY = 0;
private static native void init();
protected long handle;
//public Group() {}
protected Group(int Type) { GetGroup(Type); }
protected Group(long _handle) { handle = _handle;}
private native void GetGroup(int Type);
/**
* Size of group.
* <p>
* <table>
* <tr><td><em> returns: </em></td><td> number of processors in the
* group </tr>
* </table>
* <p>
* Java binding of the MPI operation <tt>MPI_GROUP_SIZE</tt>.
*/
public native int Size() throws MPIException ;
/**
* Rank of this process in group.
* <p>
* <table>
* <tr><td><em> returns: </em></td><td> rank of the calling process in
* the group </tr>
* </table>
* <p>
* Java binding of the MPI operation <tt>MPI_GROUP_RANK</tt>.
*
* Result value is <tt>MPI.UNDEFINED</tt> if this process is not
* a member of the group.
*/
public native int Rank() throws MPIException ;
/**
* Destructor.
* <p>
* Java binding of the MPI operation <tt>MPI_GROUP_FREE</tt>.
*/
public void finalize() throws MPIException {
synchronized(MPI.class) {
MPI.freeList.addFirst(this) ;
}
}
native void free() ;
/**
* Translate ranks within one group to ranks within another.
* <p>
* <table>
* <tr><td><tt> group1 </tt></td><td> a group </tr>
* <tr><td><tt> ranks1 </tt></td><td> array of valid ranks in
* <tt>group1</tt> </tr>
* <tr><td><tt> group2 </tt></td><td> another group </tr>
* <tr><td><em> returns: </em></td><td> array of corresponding ranks in
* <tt>group2</tt> </tr>
* </table>
* <p>
* Java binding of the MPI operation <tt>MPI_GROUP_TRANSLATE_RANKS</tt>.
* <p>
* Result elements are <tt>MPI.UNDEFINED</tt> where no correspondence
* exists.
*/
public static native int [] Translate_ranks(Group group1,int [] ranks1,
Group group2)
throws MPIException ;
/**
* Compare two groups.
* <p>
* <table>
* <tr><td><tt> group1 </tt></td><td> first group </tr>
* <tr><td><tt> group2 </tt></td><td> second group </tr>
* <tr><td><em> returns: </em></td><td> result </tr>
* </table>
* <p>
* Java binding of the MPI operation <tt>MPI_GROUP_COMPARE</tt>.
* <p>
* <tt>MPI.IDENT</tt> results if the group members and group order are
* exactly the same in both groups. <tt>MPI.SIMILAR</tt> results if
* the group members are the same but the order is different.
* <tt>MPI.UNEQUAL</tt> results otherwise.
*/
public static native int Compare(Group group1, Group group2)
throws MPIException ;
/**
* Set union of two groups.
* <p>
* <table>
* <tr><td><tt> group1 </tt></td><td> first group </tr>
* <tr><td><tt> group2 </tt></td><td> second group </tr>
* <tr><td><em> returns: </em></td><td> union group </tr>
* </table>
* <p>
* Java binding of the MPI operation <tt>MPI_GROUP_UNION</tt>.
*/
public static Group Union(Group group1, Group group2) throws MPIException {
return new Group(union(group1, group2)) ;
}
private static native long union(Group group1, Group group2);
/**
* Set intersection of two groups.
* <p>
* <table>
* <tr><td><tt> group1 </tt></td><td> first group </tr>
* <tr><td><tt> group2 </tt></td><td> second group </tr>
* <tr><td><em> returns: </em></td><td> intersection group </tr>
* </table>
* <p>
* Java binding of the MPI operation <tt>MPI_GROUP_INTERSECTION</tt>.
*/
public static Group Intersection(Group group1,Group group2)
throws MPIException {
return new Group(intersection(group1, group2)) ;
}
private static native long intersection(Group group1, Group group2);
/**
* Result contains all elements of the first group that are not in the
* second group.
* <p>
* <table>
* <tr><td><tt> group1 </tt></td><td> first group </tr>
* <tr><td><tt> group2 </tt></td><td> second group </tr>
* <tr><td><em> returns: </em></td><td> difference group </tr>
* </table>
* <p>
* Java binding of the MPI operation <tt>MPI_GROUP_DIFFERENCE</tt>.
*/
public static Group Difference(Group group1, Group group2)
throws MPIException {
return new Group(difference(group1, group2)) ;
}
private static native long difference(Group group1, Group group2) ;
/**
* Create a subset group including specified processes.
* <p>
* <table>
* <tr><td><tt> ranks </tt></td><td> ranks from this group to appear in
* new group </tr>
* <tr><td><em> returns: </em></td><td> new group </tr>
* </table>
* <p>
* Java binding of the MPI operation <tt>MPI_GROUP_INCL</tt>.
*/
public Group Incl(int [] ranks) throws MPIException {
return new Group(incl(ranks)) ;
}
private native long incl(int [] ranks);
/**
* Create a subset group excluding specified processes.
* <p>
* <table>
* <tr><td><tt> ranks </tt></td><td> ranks from this group <em>not</em>
* to appear in new group </tr>
* <tr><td><em> returns: </em></td><td> new group </tr>
* </table>
* <p>
* Java binding of the MPI operation <tt>MPI_GROUP_EXCL</tt>.
*/
public Group Excl(int [] ranks) throws MPIException {
return new Group(excl(ranks)) ;
}
private native long excl(int [] ranks) ;
/**
* Create a subset group including processes specified
* by strided intervals of ranks.
* <p>
* <table>
* <tr><td><tt> ranges </tt></td><td> array of integer triplets </tr>
* <tr><td><em> returns: </em></td><td> new group </tr>
* </table>
* <p>
* Java binding of the MPI operation <tt>MPI_GROUP_RANGE_INCL</tt>.
* <p>
* The triplets are of the form (first rank, last rank, stride)
* indicating ranks in this group to be included in the new group.
* The size of the first dimension of <tt>ranges</tt> is the number
* of triplets. The size of the second dimension is 3.
*/
public Group Range_incl(int [][] ranges) throws MPIException {
return new Group(range_incl(ranges)) ;
}
private native long range_incl(int [][] ranges) ;
/**
* Create a subset group excluding processes specified
* by strided intervals of ranks.
* <p>
* <table>
* <tr><td><tt> ranges </tt></td><td> array of integer triplets </tr>
* <tr><td><em> returns: </em></td><td> new group </tr>
* </table>
* <p>
* Java binding of the MPI operation <tt>MPI_GROUP_RANGE_EXCL</tt>.
* <p>
* Triplet array is defined as for <tt>Range_incl</tt>, the ranges
* indicating ranks in this group to be excluded from the new group.
*/
public Group Range_excl(int [][] ranges) throws MPIException {
return new Group(range_excl(ranges)) ;
}
private native long range_excl(int [][] ranges) ;
static {
init();
}
}