This source file includes following definitions.
- init
- setType
- getComm
- clone
- dup
- dup
- iDup
- iDup
- dupWithInfo
- dupWithInfo
- getRequest
- getSize
- getSize
- getRank
- getRank
- compare
- compare
- free
- free
- isNull
- setInfo
- setInfo
- getInfo
- getInfo
- disconnect
- disconnect
- getGroup
- getGroup
- isInter
- isInter
- createIntercomm
- createIntercomm
- send
- send
- recv
- recv
- sendRecv
- sendRecv
- sendRecvReplace
- sendRecvReplace
- bSend
- bSend
- sSend
- sSend
- rSend
- rSend
- iSend
- iSend
- ibSend
- ibSend
- isSend
- isSend
- irSend
- irSend
- iRecv
- iRecv
- sendInit
- sendInit
- bSendInit
- bSendInit
- sSendInit
- sSendInit
- rSendInit
- rSendInit
- recvInit
- recvInit
- pack
- pack
- unpack
- unpack
- packSize
- packSize
- iProbe
- iProbe
- probe
- probe
- createKeyval
- createKeyval_jni
- freeKeyval
- freeKeyval_jni
- setAttr
- setAttr
- getAttr
- getAttr_predefined
- getAttr
- deleteAttr
- deleteAttr
- getTopology
- getTopology
- abort
- abort
- setErrhandler
- setErrhandler
- getErrhandler
- getErrhandler
- callErrhandler
- callErrhandler
- barrier
- barrier
- iBarrier
- iBarrier
- bcast
- bcast
- iBcast
- iBcast
- gather
- gather
- gather
- iGather
- iGather
- iGather
- gatherv
- gatherv
- gatherv
- gatherv
- iGatherv
- iGatherv
- iGatherv
- iGatherv
- scatter
- scatter
- scatter
- iScatter
- iScatter
- iScatter
- scatterv
- scatterv
- scatterv
- scatterv
- iScatterv
- iScatterv
- iScatterv
- iScatterv
- allGather
- allGather
- allGather
- iAllGather
- iAllGather
- iAllGather
- allGatherv
- allGatherv
- allGatherv
- iAllGatherv
- iAllGatherv
- iAllGatherv
- allToAll
- allToAll
- iAllToAll
- iAllToAll
- allToAllv
- allToAllv
- iAllToAllv
- iAllToAllv
- allToAllw
- allToAllw
- iAllToAllw
- iAllToAllw
- neighborAllGather
- neighborAllGather
- iNeighborAllGather
- iNeighborAllGather
- neighborAllGatherv
- neighborAllGatherv
- iNeighborAllGatherv
- iNeighborAllGatherv
- neighborAllToAll
- neighborAllToAll
- iNeighborAllToAll
- iNeighborAllToAll
- neighborAllToAllv
- neighborAllToAllv
- iNeighborAllToAllv
- iNeighborAllToAllv
- reduce
- reduce
- reduce
- iReduce
- iReduce
- iReduce
- allReduce
- allReduce
- allReduce
- iAllReduce
- iAllReduce
- iAllReduce
- reduceScatter
- reduceScatter
- reduceScatter
- iReduceScatter
- iReduceScatter
- iReduceScatter
- reduceScatterBlock
- reduceScatterBlock
- reduceScatterBlock
- iReduceScatterBlock
- iReduceScatterBlock
- iReduceScatterBlock
- reduceLocal
- reduceLocal
- reduceLocalUf
- setName
- setName
- getName
- getName
- convertTypeArray
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 package mpi;
62
63 import java.nio.*;
64 import static mpi.MPI.assertDirectBuffer;
65
66
67
68
69 public class Comm implements Freeable, Cloneable
70 {
71 public final static int TYPE_SHARED = 0;
72 protected final static int SELF = 1;
73 protected final static int WORLD = 2;
74 protected long handle;
75 private Request request;
76
77 private static long nullHandle;
78
79 static
80 {
81 init();
82 }
83
84 private static native void init();
85
86 protected Comm()
87 {
88 }
89
90 protected Comm(long handle)
91 {
92 this.handle = handle;
93 }
94
95 protected Comm(long[] commRequest)
96 {
97 handle = commRequest[0];
98 request = new Request(commRequest[1]);
99 }
100
101 protected final void setType(int type)
102 {
103 getComm(type);
104 }
105
106 private native void getComm(int type);
107
108
109
110
111
112
113
114
115 @Override public Comm clone()
116 {
117 try
118 {
119 return dup();
120 }
121 catch(MPIException e)
122 {
123 throw new RuntimeException(e.getMessage());
124 }
125 }
126
127
128
129
130
131
132
133 public Comm dup() throws MPIException
134 {
135 MPI.check();
136 return new Comm(dup(handle));
137 }
138
139 protected final native long dup(long comm) throws MPIException;
140
141
142
143
144
145
146
147
148
149 public Comm iDup() throws MPIException
150 {
151 MPI.check();
152 return new Comm(iDup(handle));
153 }
154
155 protected final native long[] iDup(long comm) throws MPIException;
156
157
158
159
160
161
162
163
164 public Comm dupWithInfo(Info info) throws MPIException
165 {
166 MPI.check();
167 return new Comm(dupWithInfo(handle, info.handle));
168 }
169
170 protected final native long dupWithInfo(long comm, long info) throws MPIException;
171
172
173
174
175
176
177
178 public final Request getRequest()
179 {
180 return request;
181 }
182
183
184
185
186
187
188
189 public final int getSize() throws MPIException
190 {
191 MPI.check();
192 return getSize(handle);
193 }
194
195 private native int getSize(long comm) throws MPIException;
196
197
198
199
200
201
202
203 public final int getRank() throws MPIException
204 {
205 MPI.check();
206 return getRank(handle);
207 }
208
209 private native int getRank(long comm) throws MPIException;
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226 public static int compare(Comm comm1, Comm comm2) throws MPIException
227 {
228 MPI.check();
229 return compare(comm1.handle, comm2.handle);
230 }
231
232 private static native int compare(long comm1, long comm2) throws MPIException;
233
234
235
236
237
238 @Override final public void free() throws MPIException
239 {
240 MPI.check();
241 handle = free(handle);
242 }
243
244 private native long free(long comm) throws MPIException;
245
246
247
248
249
250
251 public final boolean isNull()
252 {
253 return handle == nullHandle;
254 }
255
256
257
258
259
260
261 public final void setInfo(Info info) throws MPIException
262 {
263 MPI.check();
264 setInfo(handle, info.handle);
265 }
266
267 private native void setInfo(long comm, long info) throws MPIException;
268
269
270
271
272
273
274 public final Info getInfo() throws MPIException
275 {
276 MPI.check();
277 return new Info(getInfo(handle));
278 }
279
280 private native long getInfo(long comm) throws MPIException;
281
282
283
284
285
286 public final void disconnect() throws MPIException
287 {
288 MPI.check();
289 handle = disconnect(handle);
290 }
291
292 private native long disconnect(long comm) throws MPIException;
293
294
295
296
297
298
299
300 public final Group getGroup() throws MPIException
301 {
302 MPI.check();
303 return new Group(getGroup(handle));
304 }
305
306 private native long getGroup(long comm);
307
308
309
310
311
312
313
314
315
316
317 public final boolean isInter() throws MPIException
318 {
319 MPI.check();
320 return isInter(handle);
321 }
322
323 private native boolean isInter(long comm) throws MPIException;
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340 public final Intercomm createIntercomm(Comm localComm, int localLeader,
341 int remoteLeader, int tag)
342 throws MPIException
343 {
344 MPI.check();
345
346 return new Intercomm(createIntercomm(handle, localComm.handle,
347 localLeader, remoteLeader, tag));
348 }
349
350 private native long createIntercomm(
351 long comm, long localComm, int localLeader,
352 int remoteLeader, int tag) throws MPIException;
353
354
355
356
357
358
359
360
361
362
363
364
365
366 public final void send(Object buf, int count, Datatype type, int dest, int tag)
367 throws MPIException
368 {
369 MPI.check();
370 int off = 0;
371 boolean db = false;
372
373 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
374 {
375 off = type.getOffset(buf);
376 buf = ((Buffer)buf).array();
377 }
378
379 send(handle, buf, db, off, count, type.handle, type.baseType, dest, tag);
380 }
381
382 private native void send(
383 long comm, Object buf, boolean db, int offset, int count,
384 long type, int baseType, int dest, int tag) throws MPIException;
385
386
387
388
389
390
391
392
393
394
395
396
397 public final Status recv(Object buf, int count,
398 Datatype type, int source, int tag)
399 throws MPIException
400 {
401 MPI.check();
402 int off = 0;
403 boolean db = false;
404
405 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
406 {
407 off = type.getOffset(buf);
408 buf = ((Buffer)buf).array();
409 }
410
411 Status status = new Status();
412
413 recv(handle, buf, db, off, count,
414 type.handle, type.baseType, source, tag, status.data);
415
416 return status;
417 }
418
419 private native void recv(
420 long comm, Object buf, boolean db, int offset, int count,
421 long type, int basetype, int source, int tag, long[] stat)
422 throws MPIException;
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444 public final Status sendRecv(
445 Object sendbuf, int sendcount, Datatype sendtype, int dest, int sendtag,
446 Object recvbuf, int recvcount, Datatype recvtype, int source, int recvtag)
447 throws MPIException
448 {
449 MPI.check();
450
451 int sendoff = 0,
452 recvoff = 0;
453
454 boolean sdb = false,
455 rdb = false;
456
457 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
458 {
459 sendoff = sendtype.getOffset(sendbuf);
460 sendbuf = ((Buffer)sendbuf).array();
461 }
462
463 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
464 {
465 recvoff = recvtype.getOffset(recvbuf);
466 recvbuf = ((Buffer)recvbuf).array();
467 }
468
469 Status status = new Status();
470
471 sendRecv(handle, sendbuf, sdb, sendoff, sendcount,
472 sendtype.handle, sendtype.baseType, dest, sendtag,
473 recvbuf, rdb, recvoff, recvcount,
474 recvtype.handle, recvtype.baseType, source, recvtag, status.data);
475
476 return status;
477 }
478
479 private native void sendRecv(
480 long comm, Object sbuf, boolean sdb, int soffset, int scount,
481 long sType, int sBaseType, int dest, int stag,
482 Object rbuf, boolean rdb, int roffset, int rcount,
483 long rType, int rBaseType, int source, int rtag,
484 long[] stat) throws MPIException;
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502 public final Status sendRecvReplace(
503 Object buf, int count, Datatype type,
504 int dest, int sendtag, int source, int recvtag)
505 throws MPIException
506 {
507 MPI.check();
508 int off = 0;
509 boolean db = false;
510
511 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
512 {
513 off = type.getOffset(buf);
514 buf = ((Buffer)buf).array();
515 }
516
517 Status status = new Status();
518
519 sendRecvReplace(handle, buf, db, off, count, type.handle, type.baseType,
520 dest, sendtag, source, recvtag, status.data);
521
522 return status;
523 }
524
525 private native void sendRecvReplace(
526 long comm, Object buf, boolean db, int offset, int count,
527 long type, int baseType, int dest, int stag,
528 int source, int rtag, long[] stat) throws MPIException;
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543 public final void bSend(Object buf, int count, Datatype type, int dest, int tag)
544 throws MPIException
545 {
546 MPI.check();
547 int off = 0;
548 boolean db = false;
549
550 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
551 {
552 off = type.getOffset(buf);
553 buf = ((Buffer)buf).array();
554 }
555
556 bSend(handle, buf, db, off, count, type.handle, type.baseType, dest, tag);
557 }
558
559 private native void bSend(
560 long comm, Object buf, boolean db, int offset, int count,
561 long type, int baseType, int dest, int tag) throws MPIException;
562
563
564
565
566
567
568
569
570
571
572
573
574 public final void sSend(Object buf, int count, Datatype type, int dest, int tag)
575 throws MPIException
576 {
577 MPI.check();
578 int off = 0;
579 boolean db = false;
580
581 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
582 {
583 off = type.getOffset(buf);
584 buf = ((Buffer)buf).array();
585 }
586
587 sSend(handle, buf, db, off, count, type.handle, type.baseType, dest, tag);
588 }
589
590 private native void sSend(
591 long comm, Object buf, boolean db, int offset, int count,
592 long type, int baseType, int dest, int tag) throws MPIException;
593
594
595
596
597
598
599
600
601
602
603
604
605 public final void rSend(Object buf, int count, Datatype type, int dest, int tag)
606 throws MPIException
607 {
608 MPI.check();
609 int off = 0;
610 boolean db = false;
611
612 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
613 {
614 off = type.getOffset(buf);
615 buf = ((Buffer)buf).array();
616 }
617
618 rSend(handle, buf, db, off, count, type.handle, type.baseType, dest, tag);
619 }
620
621 private native void rSend(
622 long comm, Object buf, boolean db, int offset, int count,
623 long type, int baseType, int dest, int tag) throws MPIException;
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639 public final Request iSend(Buffer buf, int count,
640 Datatype type, int dest, int tag)
641 throws MPIException
642 {
643 MPI.check();
644 assertDirectBuffer(buf);
645 Request req = new Request(iSend(handle, buf, count, type.handle, dest, tag));
646 req.addSendBufRef(buf);
647 return req;
648 }
649
650 private native long iSend(
651 long comm, Buffer buf, int count, long type, int dest, int tag)
652 throws MPIException;
653
654
655
656
657
658
659
660
661
662
663
664
665
666 public final Request ibSend(Buffer buf, int count,
667 Datatype type, int dest, int tag)
668 throws MPIException
669 {
670 MPI.check();
671 assertDirectBuffer(buf);
672 Request req = new Request(ibSend(handle, buf, count, type.handle, dest, tag));
673 req.addSendBufRef(buf);
674 return req;
675 }
676
677 private native long ibSend(
678 long comm, Buffer buf, int count, long type, int dest, int tag)
679 throws MPIException;
680
681
682
683
684
685
686
687
688
689
690
691
692
693 public final Request isSend(Buffer buf, int count,
694 Datatype type, int dest, int tag)
695 throws MPIException
696 {
697 MPI.check();
698 assertDirectBuffer(buf);
699 Request req = new Request(isSend(handle, buf, count, type.handle, dest, tag));
700 req.addSendBufRef(buf);
701 return req;
702 }
703
704 private native long isSend(
705 long comm, Buffer buf, int count, long type, int dest, int tag)
706 throws MPIException;
707
708
709
710
711
712
713
714
715
716
717
718
719
720 public final Request irSend(Buffer buf, int count,
721 Datatype type, int dest, int tag)
722 throws MPIException
723 {
724 MPI.check();
725 assertDirectBuffer(buf);
726 Request req = new Request(irSend(handle, buf, count, type.handle, dest, tag));
727 req.addSendBufRef(buf);
728 return req;
729 }
730
731 private native long irSend(
732 long comm, Buffer buf, int count, long type, int dest, int tag)
733 throws MPIException;
734
735
736
737
738
739
740
741
742
743
744
745
746
747 public final Request iRecv(Buffer buf, int count,
748 Datatype type, int source, int tag)
749 throws MPIException
750 {
751 MPI.check();
752 assertDirectBuffer(buf);
753 Request req = new Request(iRecv(handle, buf, count, type.handle, source, tag));
754 req.addRecvBufRef(buf);
755 return req;
756 }
757
758 private native long iRecv(
759 long comm, Buffer buf, int count, long type, int source, int tag)
760 throws MPIException;
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777 public final Prequest sendInit(Buffer buf, int count,
778 Datatype type, int dest, int tag)
779 throws MPIException
780 {
781 MPI.check();
782 assertDirectBuffer(buf);
783 Prequest preq = new Prequest(sendInit(handle, buf, count, type.handle, dest, tag));
784 preq.addSendBufRef(buf);
785 return preq;
786 }
787
788 private native long sendInit(
789 long comm, Buffer buf, int count, long type, int dest, int tag)
790 throws MPIException;
791
792
793
794
795
796
797
798
799
800
801
802
803
804 public final Prequest bSendInit(Buffer buf, int count,
805 Datatype type, int dest, int tag)
806 throws MPIException
807 {
808 MPI.check();
809 assertDirectBuffer(buf);
810 Prequest preq = new Prequest(bSendInit(handle, buf, count, type.handle, dest, tag));
811 preq.addSendBufRef(buf);
812 return preq;
813 }
814
815 private native long bSendInit(
816 long comm, Buffer buf, int count, long type, int dest, int tag)
817 throws MPIException;
818
819
820
821
822
823
824
825
826
827
828
829
830
831 public final Prequest sSendInit(Buffer buf, int count,
832 Datatype type, int dest, int tag)
833 throws MPIException
834 {
835 MPI.check();
836 assertDirectBuffer(buf);
837 Prequest preq = new Prequest(sSendInit(handle, buf, count, type.handle, dest, tag));
838 preq.addSendBufRef(buf);
839 return preq;
840 }
841
842 private native long sSendInit(
843 long comm, Buffer buf, int count, long type, int dest, int tag)
844 throws MPIException;
845
846
847
848
849
850
851
852
853
854
855
856
857
858 public final Prequest rSendInit(Buffer buf, int count,
859 Datatype type, int dest, int tag)
860 throws MPIException
861 {
862 MPI.check();
863 assertDirectBuffer(buf);
864 Prequest preq = new Prequest(rSendInit(handle, buf, count, type.handle, dest, tag));
865 preq.addSendBufRef(buf);
866 return preq;
867 }
868
869 private native long rSendInit(
870 long comm, Buffer buf, int count, long type, int dest, int tag)
871 throws MPIException;
872
873
874
875
876
877
878
879
880
881
882
883
884
885 public final Prequest recvInit(Buffer buf, int count,
886 Datatype type, int source, int tag)
887 throws MPIException
888 {
889 MPI.check();
890 assertDirectBuffer(buf);
891 Prequest preq = new Prequest(recvInit(handle, buf, count, type.handle, source, tag));
892 preq.addRecvBufRef(buf);
893 return preq;
894 }
895
896 private native long recvInit(
897 long comm, Buffer buf, int count, long type, int source, int tag)
898 throws MPIException;
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918 public final int pack(Object inbuf, int incount, Datatype type,
919 byte[] outbuf, int position)
920 throws MPIException
921 {
922 MPI.check();
923 int offset = 0;
924 boolean indb = false;
925
926 if(inbuf instanceof Buffer && !(indb = ((Buffer)inbuf).isDirect()))
927 {
928 offset = type.getOffset(inbuf);
929 inbuf = ((Buffer)inbuf).array();
930 }
931
932 return pack(handle, inbuf, indb, offset, incount,
933 type.handle, outbuf, position);
934 }
935
936 private native int pack(
937 long comm, Object inbuf, boolean indb, int offset, int incount,
938 long type, byte[] outbuf, int position) throws MPIException;
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956 public final int unpack(byte[] inbuf, int position,
957 Object outbuf, int outcount, Datatype type)
958 throws MPIException
959 {
960 MPI.check();
961 int offset = 0;
962 boolean outdb = false;
963
964 if(outbuf instanceof Buffer && !(outdb = ((Buffer)outbuf).isDirect()))
965 {
966 offset = type.getOffset(outbuf);
967 outbuf = ((Buffer)outbuf).array();
968 }
969
970 return unpack(handle, inbuf, position, outbuf, outdb,
971 offset, outcount, type.handle);
972 }
973
974 private native int unpack(
975 long comm, byte[] inbuf, int position, Object outbuf, boolean outdb,
976 int offset, int outcount, long type) throws MPIException;
977
978
979
980
981
982
983
984
985
986
987 public final int packSize(int incount, Datatype type) throws MPIException
988 {
989 MPI.check();
990 return packSize(handle, incount, type.handle);
991 }
992
993 private native int packSize(long comm, int incount, long type)
994 throws MPIException;
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009 public final Status iProbe(int source, int tag) throws MPIException
1010 {
1011 MPI.check();
1012 return iProbe(handle, source, tag);
1013 }
1014
1015 private native Status iProbe(long comm, int source, int tag)
1016 throws MPIException;
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028 public final Status probe(int source, int tag) throws MPIException
1029 {
1030 MPI.check();
1031 Status status = new Status();
1032 probe(handle, source, tag, status.data);
1033 return status;
1034 }
1035
1036 private native void probe(long comm, int source, int tag, long[] stat)
1037 throws MPIException;
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047 public static int createKeyval() throws MPIException
1048 {
1049 MPI.check();
1050 return createKeyval_jni();
1051 }
1052
1053 private static native int createKeyval_jni() throws MPIException;
1054
1055
1056
1057
1058
1059
1060
1061 public static void freeKeyval(int keyval) throws MPIException
1062 {
1063 MPI.check();
1064 freeKeyval_jni(keyval);
1065 }
1066
1067 private static native void freeKeyval_jni(int keyval) throws MPIException;
1068
1069
1070
1071
1072
1073
1074
1075
1076 public final void setAttr(int keyval, Object value) throws MPIException
1077 {
1078 MPI.check();
1079 setAttr(handle, keyval, MPI.attrSet(value));
1080 }
1081
1082 private native void setAttr(long comm, int keyval, byte[] value)
1083 throws MPIException;
1084
1085
1086
1087
1088
1089
1090
1091
1092 public final Object getAttr(int keyval) throws MPIException
1093 {
1094 MPI.check();
1095
1096 if( keyval == MPI.TAG_UB ||
1097 keyval == MPI.HOST ||
1098 keyval == MPI.IO ||
1099 keyval == MPI.APPNUM ||
1100 keyval == MPI.LASTUSEDCODE ||
1101 keyval == MPI.UNIVERSE_SIZE)
1102 {
1103 return getAttr_predefined(handle, keyval);
1104 }
1105 else if(keyval == MPI.WTIME_IS_GLOBAL)
1106 {
1107 Integer value = (Integer)getAttr_predefined(handle, keyval);
1108 return value==null ? null : value.intValue() != 0;
1109 }
1110 else
1111 {
1112 return MPI.attrGet(getAttr(handle, keyval));
1113 }
1114 }
1115
1116 private native Object getAttr_predefined(long comm, int keyval)
1117 throws MPIException;
1118
1119 private native byte[] getAttr(long comm, int keyval) throws MPIException;
1120
1121
1122
1123
1124
1125
1126
1127 public final void deleteAttr(int keyval) throws MPIException
1128 {
1129 MPI.check();
1130 deleteAttr(handle, keyval);
1131 }
1132
1133 private native void deleteAttr(long comm, int keyval) throws MPIException;
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145 public final int getTopology() throws MPIException
1146 {
1147 MPI.check();
1148 return getTopology(handle);
1149 }
1150
1151 private native int getTopology(long comm) throws MPIException;
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161 public final void abort(int errorcode) throws MPIException
1162 {
1163 MPI.check();
1164 abort(handle, errorcode);
1165 }
1166
1167 private native void abort(long comm, int errorcode) throws MPIException;
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177 public final void setErrhandler(Errhandler errhandler) throws MPIException
1178 {
1179 MPI.check();
1180 setErrhandler(handle, errhandler.handle);
1181 }
1182
1183 private native void setErrhandler(long comm, long errhandler)
1184 throws MPIException;
1185
1186
1187
1188
1189
1190
1191
1192 public final Errhandler getErrhandler() throws MPIException
1193 {
1194 MPI.check();
1195 return new Errhandler(getErrhandler(handle));
1196 }
1197
1198 private native long getErrhandler(long comm);
1199
1200
1201
1202
1203
1204
1205
1206 public void callErrhandler(int errorCode) throws MPIException
1207 {
1208 callErrhandler(handle, errorCode);
1209 }
1210
1211 private native void callErrhandler(long handle, int errorCode)
1212 throws MPIException;
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222 public final void barrier() throws MPIException
1223 {
1224 MPI.check();
1225 barrier(handle);
1226 }
1227
1228 private native void barrier(long comm) throws MPIException;
1229
1230
1231
1232
1233
1234
1235
1236 public final Request iBarrier() throws MPIException
1237 {
1238 MPI.check();
1239 return new Request(iBarrier(handle));
1240 }
1241
1242 private native long iBarrier(long comm) throws MPIException;
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254 public final void bcast(Object buf, int count, Datatype type, int root)
1255 throws MPIException
1256 {
1257 MPI.check();
1258 int off = 0;
1259 boolean db = false;
1260
1261 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
1262 {
1263 off = type.getOffset(buf);
1264 buf = ((Buffer)buf).array();
1265 }
1266
1267 bcast(handle, buf, db, off, count, type.handle, type.baseType, root);
1268 }
1269
1270 private native void bcast(
1271 long comm, Object buf, boolean db, int offset, int count,
1272 long type, int basetype, int root) throws MPIException;
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285 public final Request iBcast(Buffer buf, int count, Datatype type, int root)
1286 throws MPIException
1287 {
1288 MPI.check();
1289 assertDirectBuffer(buf);
1290 Request req = new Request(iBcast(handle, buf, count, type.handle, root));
1291 req.addSendBufRef(buf);
1292 return req;
1293 }
1294
1295 private native long iBcast(
1296 long comm, Buffer buf, int count, long type, int root)
1297 throws MPIException;
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311 public final void gather(
1312 Object sendbuf, int sendcount, Datatype sendtype,
1313 Object recvbuf, int recvcount, Datatype recvtype, int root)
1314 throws MPIException
1315 {
1316 MPI.check();
1317
1318 int sendoff = 0,
1319 recvoff = 0;
1320
1321 boolean sdb = false,
1322 rdb = false;
1323
1324 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
1325 {
1326 sendoff = sendtype.getOffset(sendbuf);
1327 sendbuf = ((Buffer)sendbuf).array();
1328 }
1329
1330 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
1331 {
1332 recvoff = recvtype.getOffset(recvbuf);
1333 recvbuf = ((Buffer)recvbuf).array();
1334 }
1335
1336 gather(handle, sendbuf, sdb, sendoff, sendcount,
1337 sendtype.handle, sendtype.baseType,
1338 recvbuf, rdb, recvoff, recvcount,
1339 recvtype.handle, recvtype.baseType, root);
1340 }
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354 public final void gather(Object buf, int count, Datatype type, int root)
1355 throws MPIException
1356 {
1357 MPI.check();
1358 int off = 0;
1359 boolean db = false;
1360
1361 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
1362 {
1363 off = type.getOffset(buf);
1364 buf = ((Buffer)buf).array();
1365 }
1366
1367 gather(handle, null, false, 0, 0, 0, 0,
1368 buf, db, off, count, type.handle, type.baseType, root);
1369 }
1370
1371 private native void gather(
1372 long comm, Object sendBuf, boolean sdb, int sendOff, int sendCount,
1373 long sendType, int sendBaseType,
1374 Object recvBuf, boolean rdb, int recvOff, int recvCount,
1375 long recvType, int recvBaseType, int root)
1376 throws MPIException;
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391 public final Request iGather(
1392 Buffer sendbuf, int sendcount, Datatype sendtype,
1393 Buffer recvbuf, int recvcount, Datatype recvtype, int root)
1394 throws MPIException
1395 {
1396 MPI.check();
1397 assertDirectBuffer(sendbuf, recvbuf);
1398 Request req = new Request(iGather(handle, sendbuf, sendcount, sendtype.handle,
1399 recvbuf, recvcount, recvtype.handle, root));
1400 req.addSendBufRef(sendbuf);
1401 req.addRecvBufRef(recvbuf);
1402 return req;
1403 }
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418 public final Request iGather(Buffer buf, int count, Datatype type, int root)
1419 throws MPIException
1420 {
1421 MPI.check();
1422 assertDirectBuffer(buf);
1423 Request req = new Request(iGather(handle, null, 0, 0,
1424 buf, count, type.handle, root));
1425 req.addRecvBufRef(buf);
1426 return req;
1427 }
1428
1429 private native long iGather(
1430 long comm, Buffer sendbuf, int sendcount, long sendtype,
1431 Buffer recvbuf, int recvcount, long recvtype,
1432 int root) throws MPIException;
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448 public final void gatherv(Object sendbuf, int sendcount, Datatype sendtype,
1449 Object recvbuf, int[] recvcount, int[] displs,
1450 Datatype recvtype, int root)
1451 throws MPIException
1452 {
1453 MPI.check();
1454
1455 int sendoff = 0,
1456 recvoff = 0;
1457
1458 boolean sdb = false,
1459 rdb = false;
1460
1461 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
1462 {
1463 sendoff = sendtype.getOffset(sendbuf);
1464 sendbuf = ((Buffer)sendbuf).array();
1465 }
1466
1467 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
1468 {
1469 recvoff = recvtype.getOffset(recvbuf);
1470 recvbuf = ((Buffer)recvbuf).array();
1471 }
1472
1473 gatherv(handle, sendbuf, sdb, sendoff, sendcount,
1474 sendtype.handle, sendtype.baseType,
1475 recvbuf, rdb, recvoff, recvcount, displs,
1476 recvtype.handle, recvtype.baseType, root);
1477 }
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492 public final void gatherv(Object recvbuf, int[] recvcount, int[] displs,
1493 Datatype recvtype, int root)
1494 throws MPIException
1495 {
1496 MPI.check();
1497 int recvoff = 0;
1498 boolean rdb = false;
1499
1500 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
1501 {
1502 recvoff = recvtype.getOffset(recvbuf);
1503 recvbuf = ((Buffer)recvbuf).array();
1504 }
1505
1506 gatherv(handle, null, false, 0, 0, 0, 0, recvbuf, rdb, recvoff, recvcount,
1507 displs, recvtype.handle, recvtype.baseType, root);
1508 }
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522 public final void gatherv(Object sendbuf, int sendcount,
1523 Datatype sendtype, int root)
1524 throws MPIException
1525 {
1526 MPI.check();
1527 int sendoff = 0;
1528 boolean sdb = false;
1529
1530 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
1531 {
1532 sendoff = sendtype.getOffset(sendbuf);
1533 sendbuf = ((Buffer)sendbuf).array();
1534 }
1535
1536 gatherv(handle, sendbuf, sdb, sendoff, sendcount,
1537 sendtype.handle, sendtype.baseType,
1538 null, false, 0, null, null, 0, 0, root);
1539 }
1540
1541 private native void gatherv(
1542 long comm, Object sendBuf, boolean sdb, int sendOffset,
1543 int sendCount, long sendType, int sendBaseType,
1544 Object recvBuf, boolean rdb, int recvOffset,
1545 int[] recvCount, int[] displs, long recvType, int recvBaseType,
1546 int root) throws MPIException;
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563 public final Request iGatherv(
1564 Buffer sendbuf, int sendcount, Datatype sendtype, Buffer recvbuf,
1565 int[] recvcount, int[] displs, Datatype recvtype, int root)
1566 throws MPIException
1567 {
1568 MPI.check();
1569 assertDirectBuffer(sendbuf, recvbuf);
1570 Request req = new Request(iGatherv(
1571 handle, sendbuf, sendcount, sendtype.handle,
1572 recvbuf, recvcount, displs, recvtype.handle, root));
1573 req.addSendBufRef(sendbuf);
1574 return req;
1575 }
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591 public final Request iGatherv(Buffer recvbuf, int[] recvcount, int[] displs,
1592 Datatype recvtype, int root)
1593 throws MPIException
1594 {
1595 MPI.check();
1596 assertDirectBuffer(recvbuf);
1597 Request req = new Request(iGatherv(handle, null, 0, 0,
1598 recvbuf, recvcount, displs, recvtype.handle, root));
1599 req.addRecvBufRef(recvbuf);
1600 return req;
1601 }
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616 public final Request iGatherv(Buffer sendbuf, int sendcount,
1617 Datatype sendtype, int root)
1618 throws MPIException
1619 {
1620 MPI.check();
1621 assertDirectBuffer(sendbuf);
1622 Request req = new Request(iGatherv(handle, sendbuf, sendcount, sendtype.handle,
1623 null, null, null, 0, root));
1624 req.addSendBufRef(sendbuf);
1625 return req;
1626 }
1627
1628 private native long iGatherv(
1629 long handle, Buffer sendbuf, int sendcount, long sendtype,
1630 Buffer recvbuf, int[] recvcount, int[] displs,
1631 long recvtype, int root)
1632 throws MPIException;
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646 public final void scatter(
1647 Object sendbuf, int sendcount, Datatype sendtype,
1648 Object recvbuf, int recvcount, Datatype recvtype, int root)
1649 throws MPIException
1650 {
1651 MPI.check();
1652
1653 int sendoff = 0,
1654 recvoff = 0;
1655
1656 boolean sdb = false,
1657 rdb = false;
1658
1659 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
1660 {
1661 sendoff = sendtype.getOffset(sendbuf);
1662 sendbuf = ((Buffer)sendbuf).array();
1663 }
1664
1665 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
1666 {
1667 recvoff = recvtype.getOffset(recvbuf);
1668 recvbuf = ((Buffer)recvbuf).array();
1669 }
1670
1671 scatter(handle, sendbuf, sdb, sendoff, sendcount,
1672 sendtype.handle, sendtype.baseType,
1673 recvbuf, rdb, recvoff, recvcount,
1674 recvtype.handle, recvtype.baseType, root);
1675 }
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689 public final void scatter(Object buf, int count, Datatype type, int root)
1690 throws MPIException
1691 {
1692 MPI.check();
1693 int off = 0;
1694 boolean db = false;
1695
1696 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
1697 {
1698 off = type.getOffset(buf);
1699 buf = ((Buffer)buf).array();
1700 }
1701
1702 scatter(handle, buf, db, off, count, type.handle, type.baseType,
1703 null, false, 0, 0, 0, 0, root);
1704 }
1705
1706 private native void scatter(
1707 long comm, Object sendBuf, boolean sdb, int sendOffset, int sendCount,
1708 long sendType, int sendBaseType,
1709 Object recvBuf, boolean rdb, int recvOffset, int recvCount,
1710 long recvType, int recvBaseType, int root) throws MPIException;
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725 public final Request iScatter(
1726 Buffer sendbuf, int sendcount, Datatype sendtype,
1727 Buffer recvbuf, int recvcount, Datatype recvtype, int root)
1728 throws MPIException
1729 {
1730 MPI.check();
1731 assertDirectBuffer(sendbuf, recvbuf);
1732 Request req = new Request(iScatter(handle, sendbuf, sendcount, sendtype.handle,
1733 recvbuf, recvcount, recvtype.handle, root));
1734 req.addSendBufRef(sendbuf);
1735 req.addRecvBufRef(recvbuf);
1736 return req;
1737 }
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752 public final Request iScatter(Buffer buf, int count, Datatype type, int root)
1753 throws MPIException
1754 {
1755 MPI.check();
1756 assertDirectBuffer(buf);
1757 Request req = new Request(iScatter(handle, buf, count, type.handle,
1758 null, 0, 0, root));
1759 req.addSendBufRef(buf);
1760 return req;
1761 }
1762
1763 private native long iScatter(
1764 long comm, Buffer sendbuf, int sendcount, long sendtype,
1765 Buffer recvbuf, int recvcount, long recvtype, int root)
1766 throws MPIException;
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781 public final void scatterv(
1782 Object sendbuf, int[] sendcount, int[] displs, Datatype sendtype,
1783 Object recvbuf, int recvcount, Datatype recvtype, int root)
1784 throws MPIException
1785 {
1786 MPI.check();
1787
1788 int sendoff = 0,
1789 recvoff = 0;
1790
1791 boolean sdb = false,
1792 rdb = false;
1793
1794 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
1795 {
1796 sendoff = sendtype.getOffset(sendbuf);
1797 sendbuf = ((Buffer)sendbuf).array();
1798 }
1799
1800 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
1801 {
1802 recvoff = recvtype.getOffset(recvbuf);
1803 recvbuf = ((Buffer)recvbuf).array();
1804 }
1805
1806 scatterv(handle, sendbuf, sdb, sendoff, sendcount, displs,
1807 sendtype.handle, sendtype.baseType,
1808 recvbuf, rdb, recvoff, recvcount,
1809 recvtype.handle, recvtype.baseType, root);
1810 }
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824 public final void scatterv(Object sendbuf, int[] sendcount, int[] displs,
1825 Datatype sendtype, int root)
1826 throws MPIException
1827 {
1828 MPI.check();
1829 int sendoff = 0;
1830 boolean sdb = false;
1831
1832 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
1833 {
1834 sendoff = sendtype.getOffset(sendbuf);
1835 sendbuf = ((Buffer)sendbuf).array();
1836 }
1837
1838 scatterv(handle, sendbuf, sdb, sendoff, sendcount, displs,
1839 sendtype.handle, sendtype.baseType,
1840 null, false, 0, 0, 0, 0, root);
1841 }
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854 public final void scatterv(Object recvbuf, int recvcount,
1855 Datatype recvtype, int root)
1856 throws MPIException
1857 {
1858 MPI.check();
1859 int recvoff = 0;
1860 boolean rdb = false;
1861
1862 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
1863 {
1864 recvoff = recvtype.getOffset(recvbuf);
1865 recvbuf = ((Buffer)recvbuf).array();
1866 }
1867
1868 scatterv(handle, null, false, 0, null, null, 0, 0,
1869 recvbuf, rdb, recvoff, recvcount,
1870 recvtype.handle, recvtype.baseType, root);
1871 }
1872
1873 private native void scatterv(
1874 long comm, Object sendBuf, boolean sdb, int sendOffset,
1875 int[] sendCount, int[] displs, long sendType, int sendBaseType,
1876 Object recvBuf, boolean rdb, int recvOffset, int recvCount,
1877 long recvType, int recvBaseType, int root)
1878 throws MPIException;
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894 public final Request iScatterv(
1895 Buffer sendbuf, int[] sendcount, int[] displs, Datatype sendtype,
1896 Buffer recvbuf, int recvcount, Datatype recvtype, int root)
1897 throws MPIException
1898 {
1899 MPI.check();
1900 assertDirectBuffer(sendbuf, recvbuf);
1901 Request req = new Request(iScatterv(
1902 handle, sendbuf, sendcount, displs, sendtype.handle,
1903 recvbuf, recvcount, recvtype.handle, root));
1904 req.addSendBufRef(sendbuf);
1905 req.addRecvBufRef(recvbuf);
1906 return req;
1907 }
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922 public final Request iScatterv(Buffer sendbuf, int[] sendcount, int[] displs,
1923 Datatype sendtype, int root)
1924 throws MPIException
1925 {
1926 MPI.check();
1927 assertDirectBuffer(sendbuf);
1928 Request req = new Request(iScatterv(handle, sendbuf, sendcount, displs,
1929 sendtype.handle, null, 0, 0, root));
1930 req.addSendBufRef(sendbuf);
1931 return req;
1932 }
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946 public final Request iScatterv(Buffer recvbuf, int recvcount,
1947 Datatype recvtype, int root)
1948 throws MPIException
1949 {
1950 MPI.check();
1951 assertDirectBuffer(recvbuf);
1952 Request req = new Request(iScatterv(handle, null, null, null, 0,
1953 recvbuf, recvcount, recvtype.handle, root));
1954 req.addRecvBufRef(recvbuf);
1955 return req;
1956 }
1957
1958 private native long iScatterv(
1959 long comm, Buffer sendbuf, int[] sendcount, int[] displs, long sendtype,
1960 Buffer recvbuf, int recvcount, long recvtype, int root)
1961 throws MPIException;
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974 public final void allGather(Object sendbuf, int sendcount, Datatype sendtype,
1975 Object recvbuf, int recvcount, Datatype recvtype)
1976 throws MPIException
1977 {
1978 MPI.check();
1979
1980 int sendoff = 0,
1981 recvoff = 0;
1982
1983 boolean sdb = false,
1984 rdb = false;
1985
1986 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
1987 {
1988 sendoff = sendtype.getOffset(sendbuf);
1989 sendbuf = ((Buffer)sendbuf).array();
1990 }
1991
1992 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
1993 {
1994 recvoff = recvtype.getOffset(recvbuf);
1995 recvbuf = ((Buffer)recvbuf).array();
1996 }
1997
1998 allGather(handle, sendbuf, sdb, sendoff, sendcount,
1999 sendtype.handle, sendtype.baseType,
2000 recvbuf, rdb, recvoff, recvcount,
2001 recvtype.handle, recvtype.baseType);
2002 }
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013 public final void allGather(Object buf, int count, Datatype type)
2014 throws MPIException
2015 {
2016 MPI.check();
2017 int off = 0;
2018 boolean db = false;
2019
2020 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
2021 {
2022 off = type.getOffset(buf);
2023 buf = ((Buffer)buf).array();
2024 }
2025
2026 allGather(handle, null, false, 0, 0, 0, 0,
2027 buf, db, off, count, type.handle, type.baseType);
2028 }
2029
2030 private native void allGather(
2031 long comm, Object sendBuf, boolean sdb, int sendOffset, int sendCount,
2032 long sendType, int sendBaseType,
2033 Object recvBuf, boolean rdb, int recvOffset, int recvCount,
2034 long recvType, int recvBaseType) throws MPIException;
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048 public final Request iAllGather(
2049 Buffer sendbuf, int sendcount, Datatype sendtype,
2050 Buffer recvbuf, int recvcount, Datatype recvtype)
2051 throws MPIException
2052 {
2053 MPI.check();
2054 assertDirectBuffer(sendbuf, recvbuf);
2055 Request req = new Request(iAllGather(handle, sendbuf, sendcount, sendtype.handle,
2056 recvbuf, recvcount, recvtype.handle));
2057 req.addSendBufRef(sendbuf);
2058 req.addRecvBufRef(recvbuf);
2059 return req;
2060 }
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072 public final Request iAllGather(Buffer buf, int count, Datatype type)
2073 throws MPIException
2074 {
2075 MPI.check();
2076 assertDirectBuffer(buf);
2077 Request req = new Request(iAllGather(handle, null, 0, 0, buf, count, type.handle));
2078 req.addRecvBufRef(buf);
2079 return req;
2080 }
2081
2082 private native long iAllGather(
2083 long comm, Buffer sendbuf, int sendcount, long sendtype,
2084 Buffer recvbuf, int recvcount, long recvtype) throws MPIException;
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098 public final void allGatherv(
2099 Object sendbuf, int sendcount, Datatype sendtype,
2100 Object recvbuf, int[] recvcount, int[] displs, Datatype recvtype)
2101 throws MPIException
2102 {
2103 MPI.check();
2104
2105 int sendoff = 0,
2106 recvoff = 0;
2107
2108 boolean sdb = false,
2109 rdb = false;
2110
2111 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
2112 {
2113 sendoff = sendtype.getOffset(sendbuf);
2114 sendbuf = ((Buffer)sendbuf).array();
2115 }
2116
2117 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
2118 {
2119 recvoff = recvtype.getOffset(recvbuf);
2120 recvbuf = ((Buffer)recvbuf).array();
2121 }
2122
2123 allGatherv(handle, sendbuf, sdb, sendoff, sendcount,
2124 sendtype.handle, sendtype.baseType,
2125 recvbuf, rdb, recvoff, recvcount, displs,
2126 recvtype.handle, recvtype.baseType);
2127 }
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139 public final void allGatherv(Object recvbuf, int[] recvcount,
2140 int[] displs, Datatype recvtype)
2141 throws MPIException
2142 {
2143 MPI.check();
2144 int recvoff = 0;
2145 boolean rdb = false;
2146
2147 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
2148 {
2149 recvoff = recvtype.getOffset(recvbuf);
2150 recvbuf = ((Buffer)recvbuf).array();
2151 }
2152
2153 allGatherv(handle, null, false, 0, 0, 0, 0,
2154 recvbuf, rdb, recvoff, recvcount,
2155 displs, recvtype.handle, recvtype.baseType);
2156 }
2157
2158 private native void allGatherv(
2159 long comm, Object sendBuf, boolean sdb, int sendOffset, int sendCount,
2160 long sendType, int sendBaseType,
2161 Object recvBuf, boolean rdb, int recvOffset, int[] recvCount,
2162 int[] displs, long recvType, int recvBasetype) throws MPIException;
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177 public final Request iAllGatherv(
2178 Buffer sendbuf, int sendcount, Datatype sendtype,
2179 Buffer recvbuf, int[] recvcount, int[] displs, Datatype recvtype)
2180 throws MPIException
2181 {
2182 MPI.check();
2183 assertDirectBuffer(sendbuf, recvbuf);
2184 Request req = new Request(iAllGatherv(
2185 handle, sendbuf, sendcount, sendtype.handle,
2186 recvbuf, recvcount, displs, recvtype.handle));
2187 req.addSendBufRef(sendbuf);
2188 req.addRecvBufRef(recvbuf);
2189 return req;
2190 }
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203 public final Request iAllGatherv(
2204 Buffer buf, int[] count, int[] displs, Datatype type)
2205 throws MPIException
2206 {
2207 MPI.check();
2208 assertDirectBuffer(buf);
2209 Request req = new Request(iAllGatherv(
2210 handle, null, 0, 0, buf, count, displs, type.handle));
2211 req.addRecvBufRef(buf);
2212 return req;
2213 }
2214
2215 private native long iAllGatherv(
2216 long handle, Buffer sendbuf, int sendcount, long sendtype,
2217 Buffer recvbuf, int[] recvcount, int[] displs, long recvtype)
2218 throws MPIException;
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232 public final void allToAll(Object sendbuf, int sendcount, Datatype sendtype,
2233 Object recvbuf, int recvcount, Datatype recvtype)
2234 throws MPIException
2235 {
2236 MPI.check();
2237
2238 int sendoff = 0,
2239 recvoff = 0;
2240
2241 boolean sdb = false,
2242 rdb = false;
2243
2244 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
2245 {
2246 sendoff = sendtype.getOffset(sendbuf);
2247 sendbuf = ((Buffer)sendbuf).array();
2248 }
2249
2250 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
2251 {
2252 recvoff = recvtype.getOffset(recvbuf);
2253 recvbuf = ((Buffer)recvbuf).array();
2254 }
2255
2256 allToAll(handle, sendbuf, sdb, sendoff, sendcount,
2257 sendtype.handle, sendtype.baseType,
2258 recvbuf, rdb, recvoff, recvcount,
2259 recvtype.handle, recvtype.baseType);
2260 }
2261
2262 private native void allToAll(
2263 long comm, Object sendBuf, boolean sdb, int sendOffset, int sendCount,
2264 long sendType, int sendBaseType,
2265 Object recvBuf, boolean rdb, int recvOffset, int recvCount,
2266 long recvType, int recvBaseType) throws MPIException;
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281 public final Request iAllToAll(Buffer sendbuf, int sendcount, Datatype sendtype,
2282 Buffer recvbuf, int recvcount, Datatype recvtype)
2283 throws MPIException
2284 {
2285 MPI.check();
2286 assertDirectBuffer(sendbuf, recvbuf);
2287 Request req = new Request(iAllToAll(handle, sendbuf, sendcount, sendtype.handle,
2288 recvbuf, recvcount, recvtype.handle));
2289 req.addSendBufRef(sendbuf);
2290 req.addRecvBufRef(recvbuf);
2291 return req;
2292 }
2293
2294 private native long iAllToAll(
2295 long comm, Buffer sendbuf, int sendcount, long sendtype,
2296 Buffer recvbuf, int recvcount, long recvtype) throws MPIException;
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313 public final void allToAllv(
2314 Object sendbuf, int[] sendcount, int[] sdispls, Datatype sendtype,
2315 Object recvbuf, int[] recvcount, int[] rdispls, Datatype recvtype)
2316 throws MPIException
2317 {
2318 MPI.check();
2319
2320 int sendoff = 0,
2321 recvoff = 0;
2322
2323 boolean sdb = false,
2324 rdb = false;
2325
2326 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
2327 {
2328 sendoff = sendtype.getOffset(sendbuf);
2329 sendbuf = ((Buffer)sendbuf).array();
2330 }
2331
2332 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
2333 {
2334 recvoff = recvtype.getOffset(recvbuf);
2335 recvbuf = ((Buffer)recvbuf).array();
2336 }
2337
2338 allToAllv(handle, sendbuf, sdb, sendoff, sendcount, sdispls,
2339 sendtype.handle, sendtype.baseType,
2340 recvbuf, rdb, recvoff, recvcount, rdispls,
2341 recvtype.handle, recvtype.baseType);
2342 }
2343
2344 private native void allToAllv(
2345 long comm, Object sendBuf, boolean sdb, int sendOffset,
2346 int[] sendCount, int[] sdispls, long sendType, int sendBaseType,
2347 Object recvBuf, boolean rdb, int recvOffset,
2348 int[] recvCount, int[] rdispls, long recvType, int recvBaseType)
2349 throws MPIException;
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367 public final Request iAllToAllv(
2368 Buffer sendbuf, int[] sendcount, int[] sdispls, Datatype sendtype,
2369 Buffer recvbuf, int[] recvcount, int[] rdispls, Datatype recvtype)
2370 throws MPIException
2371 {
2372 MPI.check();
2373 assertDirectBuffer(sendbuf, recvbuf);
2374 Request req = new Request(iAllToAllv(
2375 handle, sendbuf, sendcount, sdispls, sendtype.handle,
2376 recvbuf, recvcount, rdispls, recvtype.handle));
2377 req.addSendBufRef(sendbuf);
2378 req.addRecvBufRef(recvbuf);
2379 return req;
2380 }
2381
2382 private native long iAllToAllv(long comm,
2383 Buffer sendbuf, int[] sendcount, int[] sdispls, long sendtype,
2384 Buffer recvbuf, int[] recvcount, int[] rdispls, long recvtype)
2385 throws MPIException;
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402 public final void allToAllw(
2403 Buffer sendBuf, int[] sendCount, int[] sDispls, Datatype[] sendTypes,
2404 Buffer recvBuf, int[] recvCount, int[] rDispls, Datatype[] recvTypes)
2405 throws MPIException
2406 {
2407 MPI.check();
2408 assertDirectBuffer(sendBuf, recvBuf);
2409
2410 long[] sendHandles = convertTypeArray(sendTypes);
2411 long[] recvHandles = convertTypeArray(recvTypes);
2412
2413 allToAllw(handle, sendBuf, sendCount, sDispls,
2414 sendHandles, recvBuf, recvCount, rDispls,
2415 recvHandles);
2416 }
2417
2418 private native void allToAllw(long comm,
2419 Buffer sendBuf, int[] sendCount, int[] sDispls, long[] sendTypes,
2420 Buffer recvBuf, int[] recvCount, int[] rDispls, long[] recvTypes)
2421 throws MPIException;
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439 public final Request iAllToAllw(
2440 Buffer sendBuf, int[] sendCount, int[] sDispls, Datatype[] sendTypes,
2441 Buffer recvBuf, int[] recvCount, int[] rDispls, Datatype[] recvTypes)
2442 throws MPIException
2443 {
2444 MPI.check();
2445 assertDirectBuffer(sendBuf, recvBuf);
2446
2447 long[] sendHandles = convertTypeArray(sendTypes);
2448 long[] recvHandles = convertTypeArray(recvTypes);
2449 Request req = new Request(iAllToAllw(
2450 handle, sendBuf, sendCount, sDispls, sendHandles,
2451 recvBuf, recvCount, rDispls, recvHandles));
2452 req.addSendBufRef(sendBuf);
2453 req.addRecvBufRef(recvBuf);
2454 return req;
2455 }
2456
2457 private native long iAllToAllw(long comm,
2458 Buffer sendBuf, int[] sendCount, int[] sDispls, long[] sendTypes,
2459 Buffer recvBuf, int[] recvCount, int[] rDispls, long[] recvTypes)
2460 throws MPIException;
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472 public final void neighborAllGather(
2473 Object sendbuf, int sendcount, Datatype sendtype,
2474 Object recvbuf, int recvcount, Datatype recvtype)
2475 throws MPIException
2476 {
2477 MPI.check();
2478
2479 int sendoff = 0,
2480 recvoff = 0;
2481
2482 boolean sdb = false,
2483 rdb = false;
2484
2485 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
2486 {
2487 sendoff = sendtype.getOffset(sendbuf);
2488 sendbuf = ((Buffer)sendbuf).array();
2489 }
2490
2491 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
2492 {
2493 recvoff = recvtype.getOffset(recvbuf);
2494 recvbuf = ((Buffer)recvbuf).array();
2495 }
2496
2497 neighborAllGather(handle, sendbuf, sdb, sendoff, sendcount,
2498 sendtype.handle, sendtype.baseType,
2499 recvbuf, rdb, recvoff, recvcount,
2500 recvtype.handle, recvtype.baseType);
2501 }
2502
2503 private native void neighborAllGather(
2504 long comm, Object sendBuf, boolean sdb, int sendOffset,
2505 int sendCount, long sendType, int sendBaseType,
2506 Object recvBuf, boolean rdb, int recvOffset,
2507 int recvCount, long recvType, int recvBaseType)
2508 throws MPIException;
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521 public final Request iNeighborAllGather(
2522 Buffer sendbuf, int sendcount, Datatype sendtype,
2523 Buffer recvbuf, int recvcount, Datatype recvtype)
2524 throws MPIException
2525 {
2526 MPI.check();
2527 assertDirectBuffer(sendbuf, recvbuf);
2528 Request req = new Request(iNeighborAllGather(
2529 handle, sendbuf, sendcount, sendtype.handle,
2530 recvbuf, recvcount, recvtype.handle));
2531 req.addSendBufRef(sendbuf);
2532 req.addRecvBufRef(recvbuf);
2533 return req;
2534 }
2535
2536 private native long iNeighborAllGather(
2537 long comm, Buffer sendBuf, int sendCount, long sendType,
2538 Buffer recvBuf, int recvCount, long recvType)
2539 throws MPIException;
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552 public final void neighborAllGatherv(
2553 Object sendbuf, int sendcount, Datatype sendtype,
2554 Object recvbuf, int[] recvcount, int[] displs, Datatype recvtype)
2555 throws MPIException
2556 {
2557 MPI.check();
2558
2559 int sendoff = 0,
2560 recvoff = 0;
2561
2562 boolean sdb = false,
2563 rdb = false;
2564
2565 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
2566 {
2567 sendoff = sendtype.getOffset(sendbuf);
2568 sendbuf = ((Buffer)sendbuf).array();
2569 }
2570
2571 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
2572 {
2573 recvoff = recvtype.getOffset(recvbuf);
2574 recvbuf = ((Buffer)recvbuf).array();
2575 }
2576
2577 neighborAllGatherv(handle, sendbuf, sdb, sendoff, sendcount,
2578 sendtype.handle, sendtype.baseType,
2579 recvbuf, rdb, recvoff, recvcount, displs,
2580 recvtype.handle, recvtype.baseType);
2581 }
2582
2583 private native void neighborAllGatherv(
2584 long comm, Object sendBuf, boolean sdb, int sendOff,
2585 int sendCount, long sendType, int sendBaseType,
2586 Object recvBuf, boolean rdb, int recvOff,
2587 int[] recvCount, int[] displs, long recvType, int recvBaseType);
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601 public final Request iNeighborAllGatherv(
2602 Buffer sendbuf, int sendcount, Datatype sendtype,
2603 Buffer recvbuf, int[] recvcount, int[] displs, Datatype recvtype)
2604 throws MPIException
2605 {
2606 MPI.check();
2607 assertDirectBuffer(sendbuf, recvbuf);
2608 Request req = new Request(iNeighborAllGatherv(
2609 handle, sendbuf, sendcount, sendtype.handle,
2610 recvbuf, recvcount, displs, recvtype.handle));
2611 req.addSendBufRef(sendbuf);
2612 req.addRecvBufRef(recvbuf);
2613 return req;
2614 }
2615
2616 private native long iNeighborAllGatherv(
2617 long comm, Buffer sendBuf, int sendCount, long sendType,
2618 Buffer recvBuf, int[] recvCount, int[] displs, long recvType)
2619 throws MPIException;
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631 public final void neighborAllToAll(
2632 Object sendbuf, int sendcount, Datatype sendtype,
2633 Object recvbuf, int recvcount, Datatype recvtype)
2634 throws MPIException
2635 {
2636 MPI.check();
2637
2638 int sendoff = 0,
2639 recvoff = 0;
2640
2641 boolean sdb = false,
2642 rdb = false;
2643
2644 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
2645 {
2646 sendoff = sendtype.getOffset(sendbuf);
2647 sendbuf = ((Buffer)sendbuf).array();
2648 }
2649
2650 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
2651 {
2652 recvoff = recvtype.getOffset(recvbuf);
2653 recvbuf = ((Buffer)recvbuf).array();
2654 }
2655
2656 neighborAllToAll(handle, sendbuf, sdb, sendoff, sendcount,
2657 sendtype.handle, sendtype.baseType,
2658 recvbuf, rdb, recvoff, recvcount,
2659 recvtype.handle, recvtype.baseType);
2660 }
2661
2662 private native void neighborAllToAll(
2663 long comm, Object sendBuf, boolean sdb, int sendOff,
2664 int sendCount, long sendType, int sendBaseType,
2665 Object recvBuf, boolean rdb, int recvOff,
2666 int recvCount, long recvType, int recvBaseType)
2667 throws MPIException;
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680 public final Request iNeighborAllToAll(
2681 Buffer sendbuf, int sendcount, Datatype sendtype,
2682 Buffer recvbuf, int recvcount, Datatype recvtype)
2683 throws MPIException
2684 {
2685 MPI.check();
2686 assertDirectBuffer(sendbuf, recvbuf);
2687 Request req = new Request(iNeighborAllToAll(
2688 handle, sendbuf, sendcount, sendtype.handle,
2689 recvbuf, recvcount, recvtype.handle));
2690 req.addSendBufRef(sendbuf);
2691 req.addRecvBufRef(recvbuf);
2692 return req;
2693 }
2694
2695 private native long iNeighborAllToAll(
2696 long comm, Buffer sendBuf, int sendCount, long sendType,
2697 Buffer recvBuf, int recvCount, long recvType);
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711 public final void neighborAllToAllv(
2712 Object sendbuf, int[] sendcount, int[] sdispls, Datatype sendtype,
2713 Object recvbuf, int[] recvcount, int[] rdispls, Datatype recvtype)
2714 throws MPIException
2715 {
2716 MPI.check();
2717
2718 int sendoff = 0,
2719 recvoff = 0;
2720
2721 boolean sdb = false,
2722 rdb = false;
2723
2724 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
2725 {
2726 sendoff = sendtype.getOffset(sendbuf);
2727 sendbuf = ((Buffer)sendbuf).array();
2728 }
2729
2730 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
2731 {
2732 recvoff = recvtype.getOffset(recvbuf);
2733 recvbuf = ((Buffer)recvbuf).array();
2734 }
2735
2736 neighborAllToAllv(handle,
2737 sendbuf, sdb, sendoff, sendcount, sdispls,
2738 sendtype.handle, sendtype.baseType,
2739 recvbuf, rdb, recvoff, recvcount, rdispls,
2740 recvtype.handle, recvtype.baseType);
2741 }
2742
2743 private native void neighborAllToAllv(
2744 long comm, Object sendBuf, boolean sdb, int sendOff,
2745 int[] sendCount, int[] sdispls, long sendType, int sendBaseType,
2746 Object recvBuf, boolean rdb, int recvOff,
2747 int[] recvCount, int[] rdispls, long recvType, int recvBaseType)
2748 throws MPIException;
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763 public final Request iNeighborAllToAllv(
2764 Buffer sendbuf, int[] sendcount, int[] sdispls, Datatype sendtype,
2765 Buffer recvbuf, int[] recvcount, int[] rdispls, Datatype recvtype)
2766 throws MPIException
2767 {
2768 MPI.check();
2769 assertDirectBuffer(sendbuf, recvbuf);
2770 Request req = new Request(iNeighborAllToAllv(
2771 handle, sendbuf, sendcount, sdispls, sendtype.handle,
2772 recvbuf, recvcount, rdispls, recvtype.handle));
2773 req.addSendBufRef(sendbuf);
2774 req.addRecvBufRef(recvbuf);
2775 return req;
2776 }
2777
2778 private native long iNeighborAllToAllv(
2779 long comm, Buffer sendBuf, int[] sendCount, int[] sdispls, long sType,
2780 Buffer recvBuf, int[] recvCount, int[] rdispls, long rType)
2781 throws MPIException;
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802 public final void reduce(Object sendbuf, Object recvbuf, int count,
2803 Datatype type, Op op, int root)
2804 throws MPIException
2805 {
2806 MPI.check();
2807 op.setDatatype(type);
2808
2809 int sendoff = 0,
2810 recvoff = 0;
2811
2812 boolean sdb = false,
2813 rdb = false;
2814
2815 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
2816 {
2817 sendoff = type.getOffset(sendbuf);
2818 sendbuf = ((Buffer)sendbuf).array();
2819 }
2820
2821 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
2822 {
2823 recvoff = type.getOffset(recvbuf);
2824 recvbuf = ((Buffer)recvbuf).array();
2825 }
2826
2827 reduce(handle, sendbuf, sdb, sendoff, recvbuf, rdb, recvoff,
2828 count, type.handle, type.baseType, op, op.handle, root);
2829 }
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844 public final void reduce(Object buf, int count, Datatype type, Op op, int root)
2845 throws MPIException
2846 {
2847 MPI.check();
2848 op.setDatatype(type);
2849 int off = 0;
2850 boolean db = false;
2851
2852 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
2853 {
2854 off = type.getOffset(buf);
2855 buf = ((Buffer)buf).array();
2856 }
2857
2858 reduce(handle, null, false, 0, buf, db, off, count,
2859 type.handle, type.baseType, op, op.handle, root);
2860 }
2861
2862 private native void reduce(
2863 long comm, Object sendbuf, boolean sdb, int sendoff,
2864 Object recvbuf, boolean rdb, int recvoff, int count,
2865 long type, int baseType, Op jOp, long hOp, int root)
2866 throws MPIException;
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882 public final Request iReduce(Buffer sendbuf, Buffer recvbuf,
2883 int count, Datatype type, Op op, int root)
2884 throws MPIException
2885 {
2886 MPI.check();
2887 assertDirectBuffer(sendbuf, recvbuf);
2888 op.setDatatype(type);
2889 Request req = new Request(iReduce(
2890 handle, sendbuf, recvbuf, count,
2891 type.handle, type.baseType, op, op.handle, root));
2892 req.addSendBufRef(sendbuf);
2893 req.addRecvBufRef(recvbuf);
2894 return req;
2895 }
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911 public final Request iReduce(Buffer buf, int count,
2912 Datatype type, Op op, int root)
2913 throws MPIException
2914 {
2915 MPI.check();
2916 assertDirectBuffer(buf);
2917 op.setDatatype(type);
2918 Request req = new Request(iReduce(
2919 handle, null, buf, count,
2920 type.handle, type.baseType, op, op.handle, root));
2921 req.addSendBufRef(buf);
2922 return req;
2923 }
2924
2925 private native long iReduce(
2926 long comm, Buffer sendbuf, Buffer recvbuf, int count,
2927 long type, int baseType, Op jOp, long hOp, int root)
2928 throws MPIException;
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941 public final void allReduce(Object sendbuf, Object recvbuf,
2942 int count, Datatype type, Op op)
2943 throws MPIException
2944 {
2945 MPI.check();
2946 op.setDatatype(type);
2947
2948 int sendoff = 0,
2949 recvoff = 0;
2950
2951 boolean sdb = false,
2952 rdb = false;
2953
2954 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
2955 {
2956 sendoff = type.getOffset(sendbuf);
2957 sendbuf = ((Buffer)sendbuf).array();
2958 }
2959
2960 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
2961 {
2962 recvoff = type.getOffset(recvbuf);
2963 recvbuf = ((Buffer)recvbuf).array();
2964 }
2965
2966 allReduce(handle, sendbuf, sdb, sendoff, recvbuf, rdb, recvoff,
2967 count, type.handle, type.baseType, op, op.handle);
2968 }
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981 public final void allReduce(Object buf, int count, Datatype type, Op op)
2982 throws MPIException
2983 {
2984 MPI.check();
2985 op.setDatatype(type);
2986 int off = 0;
2987 boolean db = false;
2988
2989 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
2990 {
2991 off = type.getOffset(buf);
2992 buf = ((Buffer)buf).array();
2993 }
2994
2995 allReduce(handle, null, false, 0, buf, db, off, count,
2996 type.handle, type.baseType, op, op.handle);
2997 }
2998
2999 private native void allReduce(
3000 long comm, Object sendbuf, boolean sdb, int sendoff,
3001 Object recvbuf, boolean rdb, int recvoff, int count,
3002 long type, int baseType, Op jOp, long hOp) throws MPIException;
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016 public final Request iAllReduce(Buffer sendbuf, Buffer recvbuf,
3017 int count, Datatype type, Op op)
3018 throws MPIException
3019 {
3020 MPI.check();
3021 assertDirectBuffer(sendbuf, recvbuf);
3022 op.setDatatype(type);
3023 Request req = new Request(iAllReduce(handle, sendbuf, recvbuf, count,
3024 type.handle, type.baseType, op, op.handle));
3025 req.addSendBufRef(sendbuf);
3026 req.addRecvBufRef(recvbuf);
3027 return req;
3028 }
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042 public final Request iAllReduce(Buffer buf, int count, Datatype type, Op op)
3043 throws MPIException
3044 {
3045 MPI.check();
3046 op.setDatatype(type);
3047 assertDirectBuffer(buf);
3048 Request req = new Request(iAllReduce(
3049 handle, null, buf, count,
3050 type.handle, type.baseType, op, op.handle));
3051 req.addRecvBufRef(buf);
3052 return req;
3053 }
3054
3055 private native long iAllReduce(
3056 long comm, Buffer sendbuf, Buffer recvbuf, int count,
3057 long type, int baseType, Op jOp, long hOp) throws MPIException;
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071 public final void reduceScatter(Object sendbuf, Object recvbuf,
3072 int[] recvcounts, Datatype type, Op op)
3073 throws MPIException
3074 {
3075 MPI.check();
3076 op.setDatatype(type);
3077
3078 int sendoff = 0,
3079 recvoff = 0;
3080
3081 boolean sdb = false,
3082 rdb = false;
3083
3084 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
3085 {
3086 sendoff = type.getOffset(sendbuf);
3087 sendbuf = ((Buffer)sendbuf).array();
3088 }
3089
3090 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
3091 {
3092 recvoff = type.getOffset(recvbuf);
3093 recvbuf = ((Buffer)recvbuf).array();
3094 }
3095
3096 reduceScatter(handle, sendbuf, sdb, sendoff, recvbuf, rdb, recvoff,
3097 recvcounts, type.handle, type.baseType, op, op.handle);
3098 }
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112 public final void reduceScatter(Object buf, int[] counts, Datatype type, Op op)
3113 throws MPIException
3114 {
3115 MPI.check();
3116 op.setDatatype(type);
3117 int off = 0;
3118 boolean db = false;
3119
3120 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
3121 {
3122 off = type.getOffset(buf);
3123 buf = ((Buffer)buf).array();
3124 }
3125
3126 reduceScatter(handle, null, false, 0, buf, db, off, counts,
3127 type.handle, type.baseType, op, op.handle);
3128 }
3129
3130 private native void reduceScatter(
3131 long comm, Object sendbuf, boolean sdb, int sendoff,
3132 Object recvbuf, boolean rdb, int recvoff, int[] recvcounts,
3133 long type, int baseType, Op jOp, long hOp) throws MPIException;
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148 public final Request iReduceScatter(Buffer sendbuf, Buffer recvbuf,
3149 int[] recvcounts, Datatype type, Op op)
3150 throws MPIException
3151 {
3152 MPI.check();
3153 op.setDatatype(type);
3154 assertDirectBuffer(sendbuf, recvbuf);
3155 Request req = new Request(iReduceScatter(
3156 handle, sendbuf, recvbuf, recvcounts,
3157 type.handle, type.baseType, op, op.handle));
3158 req.addSendBufRef(sendbuf);
3159 req.addRecvBufRef(recvbuf);
3160 return req;
3161 }
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176 public final Request iReduceScatter(
3177 Buffer buf, int[] counts, Datatype type, Op op)
3178 throws MPIException
3179 {
3180 MPI.check();
3181 op.setDatatype(type);
3182 assertDirectBuffer(buf);
3183 Request req = new Request(iReduceScatter(
3184 handle, null, buf, counts,
3185 type.handle, type.baseType, op, op.handle));
3186 req.addRecvBufRef(buf);
3187 return req;
3188 }
3189
3190 private native long iReduceScatter(
3191 long handle, Buffer sendbuf, Object recvbuf, int[] recvcounts,
3192 long type, int baseType, Op jOp, long hOp) throws MPIException;
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204 public final void reduceScatterBlock(Object sendbuf, Object recvbuf,
3205 int recvcount, Datatype type, Op op)
3206 throws MPIException
3207 {
3208 MPI.check();
3209 op.setDatatype(type);
3210
3211 int sendoff = 0,
3212 recvoff = 0;
3213
3214 boolean sdb = false,
3215 rdb = false;
3216
3217 if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
3218 {
3219 sendoff = type.getOffset(sendbuf);
3220 sendbuf = ((Buffer)sendbuf).array();
3221 }
3222
3223 if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
3224 {
3225 recvoff = type.getOffset(recvbuf);
3226 recvbuf = ((Buffer)recvbuf).array();
3227 }
3228
3229 reduceScatterBlock(handle, sendbuf, sdb, sendoff, recvbuf, rdb, recvoff,
3230 recvcount, type.handle, type.baseType, op, op.handle);
3231 }
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243 public final void reduceScatterBlock(
3244 Object buf, int count, Datatype type, Op op)
3245 throws MPIException
3246 {
3247 MPI.check();
3248 op.setDatatype(type);
3249 int off = 0;
3250 boolean db = false;
3251
3252 if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
3253 {
3254 off = type.getOffset(buf);
3255 buf = ((Buffer)buf).array();
3256 }
3257
3258 reduceScatterBlock(handle, null, false, 0, buf, db, off, count,
3259 type.handle, type.baseType, op, op.handle);
3260 }
3261
3262 private native void reduceScatterBlock(
3263 long comm, Object sendBuf, boolean sdb, int sOffset,
3264 Object recvBuf, boolean rdb, int rOffset, int rCount,
3265 long type, int baseType, Op jOp, long hOp) throws MPIException;
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278 public final Request iReduceScatterBlock(
3279 Buffer sendbuf, Buffer recvbuf, int recvcount, Datatype type, Op op)
3280 throws MPIException
3281 {
3282 MPI.check();
3283 op.setDatatype(type);
3284 assertDirectBuffer(sendbuf, recvbuf);
3285 Request req = new Request(iReduceScatterBlock(
3286 handle, sendbuf, recvbuf, recvcount,
3287 type.handle, type.baseType, op, op.handle));
3288 req.addSendBufRef(sendbuf);
3289 req.addRecvBufRef(recvbuf);
3290 return req;
3291 }
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304 public final Request iReduceScatterBlock(
3305 Buffer buf, int count, Datatype type, Op op)
3306 throws MPIException
3307 {
3308 MPI.check();
3309 op.setDatatype(type);
3310 assertDirectBuffer(buf);
3311 Request req = new Request(iReduceScatterBlock(
3312 handle, null, buf, count, type.handle,
3313 type.baseType, op, op.handle));
3314 req.addRecvBufRef(buf);
3315 return req;
3316 }
3317
3318 private native long iReduceScatterBlock(
3319 long handle, Buffer sendbuf, Buffer recvbuf, int recvcount,
3320 long type, int baseType, Op jOp, long hOp) throws MPIException;
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334 public static void reduceLocal(
3335 Object inBuf, Object inOutBuf, int count, Datatype type, Op op)
3336 throws MPIException
3337 {
3338 MPI.check();
3339 op.setDatatype(type);
3340
3341 int inOff = 0,
3342 inOutOff = 0;
3343
3344 boolean idb = false,
3345 iodb = false;
3346
3347 if(inBuf instanceof Buffer && !(idb = ((Buffer)inBuf).isDirect()))
3348 {
3349 inOff = type.getOffset(inBuf);
3350 inBuf = ((Buffer)inBuf).array();
3351 }
3352
3353 if(inOutBuf instanceof Buffer && !(iodb = ((Buffer)inOutBuf).isDirect()))
3354 {
3355 inOutOff = type.getOffset(inOutBuf);
3356 inOutBuf = ((Buffer)inOutBuf).array();
3357 }
3358
3359 if(op.uf == null)
3360 {
3361 reduceLocal(inBuf, idb, inOff, inOutBuf, iodb, inOutOff,
3362 count, type.handle, op.handle);
3363 }
3364 else
3365 {
3366 reduceLocalUf(inBuf, idb, inOff, inOutBuf, iodb, inOutOff,
3367 count, type.handle, type.baseType, op, op.handle);
3368 }
3369 }
3370
3371 private static native void reduceLocal(
3372 Object inBuf, boolean idb, int inOff,
3373 Object inOutBuf, boolean iodb, int inOutOff, int count,
3374 long type, long op) throws MPIException;
3375
3376 private static native void reduceLocalUf(
3377 Object inBuf, boolean idb, int inOff,
3378 Object inOutBuf, boolean iodb, int inOutOff, int count,
3379 long type, int baseType, Op jOp, long hOp) throws MPIException;
3380
3381
3382
3383
3384
3385
3386 public final void setName(String name) throws MPIException
3387 {
3388 MPI.check();
3389 setName(handle, name);
3390 }
3391
3392 private native void setName(long handle, String name) throws MPIException;
3393
3394
3395
3396
3397
3398
3399 public final String getName() throws MPIException
3400 {
3401 MPI.check();
3402 return getName(handle);
3403 }
3404
3405 private native String getName(long handle) throws MPIException;
3406
3407
3408
3409
3410
3411
3412
3413 private long[] convertTypeArray(Datatype[] dArray) {
3414 long[] lArray = new long[dArray.length];
3415
3416 for(int i = 0; i < lArray.length; i++) {
3417 if(dArray[i] != null) {
3418 lArray[i] = dArray[i].handle;
3419 }
3420 }
3421 return lArray;
3422 }
3423
3424 }