1 /*****************************************************************************
2 * Copyright (c) 2019 FrontISTR Commons
3 * This software is released under the MIT License, see LICENSE.txt
4 *****************************************************************************/
5
6 #include <stdio.h>
7 #include "hecmw_config.h"
8 #include "hecmw_comm.h"
9 #include "hecmw_util.h"
10
11 static int is_initialized;
12
13 static HECMW_Comm hecmw_comm;
14 static HECMW_Group hecmw_group;
15 static int comm_size;
16 static int comm_rank;
17
HECMW_Comm_rank(HECMW_Comm comm,int * rank)18 int HECMW_Comm_rank(HECMW_Comm comm, int *rank) {
19 #ifndef HECMW_SERIAL
20 int rtc;
21 rtc = MPI_Comm_rank(comm, rank);
22
23 if (rtc != MPI_SUCCESS) {
24 HECMW_set_error(HECMW_ALL_E1003, "MPI_Comm_rank");
25 goto error;
26 }
27
28 return 0;
29 error:
30 return -1;
31 #else
32 *rank = 0;
33 return 0;
34 #endif
35 }
36
HECMW_Comm_size(HECMW_Comm comm,int * size)37 int HECMW_Comm_size(HECMW_Comm comm, int *size) {
38 #ifndef HECMW_SERIAL
39 int rtc;
40 rtc = MPI_Comm_size(comm, size);
41
42 if (rtc != MPI_SUCCESS) {
43 HECMW_set_error(HECMW_ALL_E1003, "MPI_Comm_size");
44 goto error;
45 }
46
47 return 0;
48 error:
49 return -1;
50 #else
51 *size = 1;
52 return 0;
53 #endif
54 }
55
HECMW_Comm_dup(HECMW_Comm comm,HECMW_Comm * new_comm)56 int HECMW_Comm_dup(HECMW_Comm comm, HECMW_Comm *new_comm) {
57 #ifndef HECMW_SERIAL
58 int rtc;
59 rtc = MPI_Comm_dup(comm, new_comm);
60
61 if (rtc != MPI_SUCCESS) {
62 HECMW_set_error(HECMW_ALL_E1003, "MPI_Comm_dup");
63 goto error;
64 }
65
66 return 0;
67 error:
68 return -1;
69 #else
70 *new_comm = 0;
71 return 0;
72 #endif
73 }
74
HECMW_Comm_free(HECMW_Comm * comm)75 int HECMW_Comm_free(HECMW_Comm *comm) {
76 #ifndef HECMW_SERIAL
77 int rtc;
78 rtc = MPI_Comm_free(comm);
79
80 if (rtc != MPI_SUCCESS) {
81 HECMW_set_error(HECMW_ALL_E1003, "MPI_Comm_free");
82 goto error;
83 }
84
85 return 0;
86 error:
87 return -1;
88 #else
89 return 0;
90 #endif
91 }
92
93 /*-----------------------------------------------------------------------------*/
94
HECMW_Barrier(HECMW_Comm comm)95 extern int HECMW_Barrier(HECMW_Comm comm) {
96 #ifndef HECMW_SERIAL
97 int rtc;
98 rtc = MPI_Barrier(comm);
99
100 if (rtc != MPI_SUCCESS) {
101 HECMW_set_error(HECMW_ALL_E1003, "MPI_Barrier");
102 goto error;
103 }
104
105 return 0;
106 error:
107 return -1;
108 #else
109 return 0;
110 #endif
111 }
112
HECMW_Wait(HECMW_Request * array_of_requests,HECMW_Status * array_of_statuses)113 extern int HECMW_Wait(HECMW_Request *array_of_requests,
114 HECMW_Status *array_of_statuses) {
115 #ifndef HECMW_SERIAL
116 int rtc;
117 rtc = MPI_Wait(array_of_requests, array_of_statuses);
118
119 if (rtc != MPI_SUCCESS) {
120 HECMW_set_error(HECMW_ALL_E1003, "MPI_Waitall");
121 goto error;
122 }
123
124 return 0;
125 error:
126 return -1;
127 #else
128 return 0;
129 #endif
130 }
131
HECMW_Waitall(int count,HECMW_Request * array_of_requests,HECMW_Status * array_of_statuses)132 extern int HECMW_Waitall(int count, HECMW_Request *array_of_requests,
133 HECMW_Status *array_of_statuses) {
134 #ifndef HECMW_SERIAL
135 int rtc;
136 rtc = MPI_Waitall(count, array_of_requests, array_of_statuses);
137
138 if (rtc != MPI_SUCCESS) {
139 HECMW_set_error(HECMW_ALL_E1003, "MPI_Waitall");
140 goto error;
141 }
142
143 return 0;
144 error:
145 return -1;
146 #else
147 return 0;
148 #endif
149 }
150
HECMW_Bcast(void * buffer,int count,HECMW_Datatype datatype,int root,HECMW_Comm comm)151 extern int HECMW_Bcast(void *buffer, int count, HECMW_Datatype datatype,
152 int root, HECMW_Comm comm) {
153 #ifndef HECMW_SERIAL
154 int rtc;
155
156 if (datatype == HECMW_INT) {
157 rtc = MPI_Bcast(buffer, count, MPI_INT, root, comm);
158
159 if (rtc != MPI_SUCCESS) {
160 HECMW_set_error(HECMW_ALL_E1003, "MPI_Bcast");
161 goto error;
162 }
163
164 } else if (datatype == HECMW_DOUBLE) {
165 rtc = MPI_Bcast(buffer, count, MPI_DOUBLE, root, comm);
166
167 if (rtc != MPI_SUCCESS) {
168 HECMW_set_error(HECMW_ALL_E1003, "MPI_Bcast");
169 goto error;
170 }
171
172 } else if (datatype == HECMW_CHAR) {
173 rtc = MPI_Bcast(buffer, count, MPI_CHAR, root, comm);
174
175 if (rtc != MPI_SUCCESS) {
176 HECMW_set_error(HECMW_ALL_E1003, "MPI_Bcast");
177 goto error;
178 }
179
180 } else {
181 HECMW_set_error(HECMW_ALL_E1003, "Invalid data type is found");
182 goto error;
183 }
184
185 return 0;
186 error:
187 return -1;
188 #else
189 return 0;
190 #endif
191 }
192
HECMW_Send(void * buffer,int count,HECMW_Datatype datatype,int dest,int tag,HECMW_Comm comm)193 extern int HECMW_Send(void *buffer, int count, HECMW_Datatype datatype,
194 int dest, int tag, HECMW_Comm comm) {
195 #ifndef HECMW_SERIAL
196 int rtc;
197
198 if (datatype == HECMW_INT) {
199 rtc = MPI_Send(buffer, count, MPI_INT, dest, tag, comm);
200
201 if (rtc != MPI_SUCCESS) {
202 HECMW_set_error(HECMW_ALL_E1003, "MPI_Send");
203 goto error;
204 }
205
206 } else if (datatype == HECMW_DOUBLE) {
207 rtc = MPI_Send(buffer, count, MPI_DOUBLE, dest, tag, comm);
208
209 if (rtc != MPI_SUCCESS) {
210 HECMW_set_error(HECMW_ALL_E1003, "MPI_Send");
211 goto error;
212 }
213
214 } else if (datatype == HECMW_CHAR) {
215 rtc = MPI_Send(buffer, count, MPI_CHAR, dest, tag, comm);
216
217 if (rtc != MPI_SUCCESS) {
218 HECMW_set_error(HECMW_ALL_E1003, "MPI_Send");
219 goto error;
220 }
221
222 } else {
223 HECMW_set_error(HECMW_ALL_E1003, "Invalid data type is found");
224 goto error;
225 }
226
227 return 0;
228 error:
229 return -1;
230 #else
231 return 0;
232 #endif
233 }
234
HECMW_Recv(void * buffer,int count,HECMW_Datatype datatype,int source,int tag,HECMW_Comm comm,HECMW_Status * status)235 extern int HECMW_Recv(void *buffer, int count, HECMW_Datatype datatype,
236 int source, int tag, HECMW_Comm comm,
237 HECMW_Status *status) {
238 #ifndef HECMW_SERIAL
239 int rtc;
240
241 if (datatype == HECMW_INT) {
242 rtc = MPI_Recv(buffer, count, MPI_INT, source, tag, comm, status);
243
244 if (rtc != MPI_SUCCESS) {
245 HECMW_set_error(HECMW_ALL_E1003, "MPI_Recv");
246 goto error;
247 }
248
249 } else if (datatype == HECMW_DOUBLE) {
250 rtc = MPI_Recv(buffer, count, MPI_DOUBLE, source, tag, comm, status);
251
252 if (rtc != MPI_SUCCESS) {
253 HECMW_set_error(HECMW_ALL_E1003, "MPI_Recv");
254 goto error;
255 }
256
257 } else if (datatype == HECMW_CHAR) {
258 rtc = MPI_Recv(buffer, count, MPI_CHAR, source, tag, comm, status);
259
260 if (rtc != MPI_SUCCESS) {
261 HECMW_set_error(HECMW_ALL_E1003, "MPI_Recv");
262 goto error;
263 }
264
265 } else {
266 HECMW_set_error(HECMW_ALL_E1003, "Invalid data type is found");
267 goto error;
268 }
269
270 return 0;
271 error:
272 return -1;
273 #else
274 return 0;
275 #endif
276 }
277
HECMW_Isend(void * buffer,int count,HECMW_Datatype datatype,int dest,int tag,HECMW_Comm comm,HECMW_Request * request)278 extern int HECMW_Isend(void *buffer, int count, HECMW_Datatype datatype,
279 int dest, int tag, HECMW_Comm comm,
280 HECMW_Request *request) {
281 #ifndef HECMW_SERIAL
282 int rtc;
283
284 if (datatype == HECMW_INT) {
285 rtc = MPI_Isend(buffer, count, MPI_INT, dest, tag, comm, request);
286
287 if (rtc != MPI_SUCCESS) {
288 HECMW_set_error(HECMW_ALL_E1003, "MPI_Isend");
289 goto error;
290 }
291
292 } else if (datatype == HECMW_DOUBLE) {
293 rtc = MPI_Isend(buffer, count, MPI_DOUBLE, dest, tag, comm, request);
294
295 if (rtc != MPI_SUCCESS) {
296 HECMW_set_error(HECMW_ALL_E1003, "MPI_Isend");
297 goto error;
298 }
299
300 } else if (datatype == HECMW_CHAR) {
301 rtc = MPI_Isend(buffer, count, MPI_CHAR, dest, tag, comm, request);
302
303 if (rtc != MPI_SUCCESS) {
304 HECMW_set_error(HECMW_ALL_E1003, "MPI_Isend");
305 goto error;
306 }
307
308 } else {
309 HECMW_set_error(HECMW_ALL_E1003, "Invalid data type is found");
310 goto error;
311 }
312
313 return 0;
314 error:
315 return -1;
316 #else
317 return 0;
318 #endif
319 }
320
HECMW_Irecv(void * buffer,int count,HECMW_Datatype datatype,int source,int tag,HECMW_Comm comm,HECMW_Request * request)321 extern int HECMW_Irecv(void *buffer, int count, HECMW_Datatype datatype,
322 int source, int tag, HECMW_Comm comm,
323 HECMW_Request *request) {
324 #ifndef HECMW_SERIAL
325 int rtc;
326
327 if (datatype == HECMW_INT) {
328 rtc = MPI_Irecv(buffer, count, MPI_INT, source, tag, comm, request);
329
330 if (rtc != MPI_SUCCESS) {
331 HECMW_set_error(HECMW_ALL_E1003, "MPI_Irecv");
332 goto error;
333 }
334
335 } else if (datatype == HECMW_DOUBLE) {
336 rtc = MPI_Irecv(buffer, count, MPI_DOUBLE, source, tag, comm, request);
337
338 if (rtc != MPI_SUCCESS) {
339 HECMW_set_error(HECMW_ALL_E1003, "MPI_Irecv");
340 goto error;
341 }
342
343 } else if (datatype == HECMW_CHAR) {
344 rtc = MPI_Irecv(buffer, count, MPI_CHAR, source, tag, comm, request);
345
346 if (rtc != MPI_SUCCESS) {
347 HECMW_set_error(HECMW_ALL_E1003, "MPI_Irecv");
348 goto error;
349 }
350
351 } else {
352 HECMW_set_error(HECMW_ALL_E1003, "Invalid data type is found");
353 goto error;
354 }
355
356 return 0;
357 error:
358 return -1;
359 #else
360 return 0;
361 #endif
362 }
363
HECMW_Allreduce(void * sendbuf,void * recvbuf,int count,HECMW_Datatype datatype,HECMW_Op op,HECMW_Comm comm)364 extern int HECMW_Allreduce(void *sendbuf, void *recvbuf, int count,
365 HECMW_Datatype datatype, HECMW_Op op,
366 HECMW_Comm comm) {
367 #ifndef HECMW_SERIAL
368 MPI_Datatype _datatype;
369 MPI_Op _op;
370 int rtc;
371
372 if (datatype == HECMW_INT) {
373 _datatype = MPI_INT;
374
375 } else if (datatype == HECMW_DOUBLE) {
376 _datatype = MPI_DOUBLE;
377
378 } else if (datatype == HECMW_CHAR) {
379 _datatype = MPI_CHAR;
380
381 } else {
382 HECMW_set_error(HECMW_ALL_E1003, "Invalid data type is found");
383 goto error;
384 }
385
386 if (op == HECMW_SUM) {
387 _op = MPI_SUM;
388
389 } else if (op == HECMW_MIN) {
390 _op = MPI_MIN;
391
392 } else if (op == HECMW_MAX) {
393 _op = MPI_MAX;
394
395 } else {
396 HECMW_set_error(HECMW_ALL_E1003, "Invalid operation is found");
397 goto error;
398 }
399
400 rtc = MPI_Allreduce(sendbuf, recvbuf, count, _datatype, _op, comm);
401
402 if (rtc != MPI_SUCCESS) {
403 HECMW_set_error(HECMW_ALL_E1003, "MPI_Allreduce");
404 goto error;
405 }
406
407 return 0;
408 error:
409 return -1;
410 #else
411
412 if (datatype == HECMW_INT) {
413 memcpy(recvbuf, sendbuf, sizeof(int) * count);
414
415 } else if (datatype == HECMW_DOUBLE) {
416 memcpy(recvbuf, sendbuf, sizeof(double) * count);
417
418 } else if (datatype == HECMW_CHAR) {
419 memcpy(recvbuf, sendbuf, sizeof(char) * count);
420
421 } else {
422 HECMW_set_error(HECMW_ALL_E1003, "Invalid data type is found");
423 goto error;
424 }
425
426 return 0;
427 error:
428 return -1;
429 #endif
430 }
431
HECMW_Allgather(void * sendbuf,int sendcount,HECMW_Datatype sendtype,void * recvbuf,int recvcount,HECMW_Datatype recvtype,HECMW_Comm comm)432 extern int HECMW_Allgather(void *sendbuf, int sendcount,
433 HECMW_Datatype sendtype, void *recvbuf,
434 int recvcount, HECMW_Datatype recvtype,
435 HECMW_Comm comm) {
436 #ifndef HECMW_SERIAL
437 MPI_Datatype _sendtype, _recvtype;
438 int rtc;
439
440 if (sendtype == HECMW_INT) {
441 _sendtype = MPI_INT;
442
443 } else if (sendtype == HECMW_DOUBLE) {
444 _sendtype = MPI_DOUBLE;
445
446 } else if (sendtype == HECMW_CHAR) {
447 _sendtype = MPI_CHAR;
448
449 } else {
450 HECMW_set_error(HECMW_ALL_E1003, "Invalid data type is found");
451 goto error;
452 }
453
454 if (recvtype == HECMW_INT) {
455 _recvtype = MPI_INT;
456
457 } else if (recvtype == HECMW_DOUBLE) {
458 _recvtype = MPI_DOUBLE;
459
460 } else if (recvtype == HECMW_CHAR) {
461 _recvtype = MPI_CHAR;
462
463 } else {
464 HECMW_set_error(HECMW_ALL_E1003, "Invalid data type is found");
465 goto error;
466 }
467
468 rtc = MPI_Allgather(sendbuf, sendcount, _sendtype, recvbuf, recvcount,
469 _recvtype, comm);
470
471 if (rtc != MPI_SUCCESS) {
472 HECMW_set_error(HECMW_ALL_E1003, "MPI_Allgather");
473 goto error;
474 }
475
476 return 0;
477 error:
478 return -1;
479 #else
480 return 0;
481 #endif
482 }
483
HECMW_Group_incl(HECMW_Group group,int n,int * ranks,HECMW_Group * newgroup)484 extern int HECMW_Group_incl(HECMW_Group group, int n, int *ranks,
485 HECMW_Group *newgroup) {
486 #ifndef HECMW_SERIAL
487 int rtc;
488 rtc = MPI_Group_incl(group, n, ranks, newgroup);
489
490 if (rtc != MPI_SUCCESS) {
491 HECMW_set_error(HECMW_ALL_E1003, "MPI_Group_excl");
492 goto error;
493 }
494
495 return 0;
496 error:
497 return -1;
498 #else
499 return 0;
500 #endif
501 }
502
HECMW_Group_excl(HECMW_Group group,int n,int * ranks,HECMW_Group * newgroup)503 extern int HECMW_Group_excl(HECMW_Group group, int n, int *ranks,
504 HECMW_Group *newgroup) {
505 #ifndef HECMW_SERIAL
506 int rtc;
507 rtc = MPI_Group_excl(group, n, ranks, newgroup);
508
509 if (rtc != MPI_SUCCESS) {
510 HECMW_set_error(HECMW_ALL_E1003, "MPI_Group_excl");
511 goto error;
512 }
513
514 return 0;
515 error:
516 return -1;
517 #else
518 return 0;
519 #endif
520 }
521
HECMW_Comm_create(HECMW_Comm comm,HECMW_Group group,HECMW_Comm * comm_out)522 extern int HECMW_Comm_create(HECMW_Comm comm, HECMW_Group group,
523 HECMW_Comm *comm_out) {
524 #ifndef HECMW_SERIAL
525 int rtc;
526 rtc = MPI_Comm_create(comm, group, comm_out);
527
528 if (rtc != MPI_SUCCESS) {
529 HECMW_set_error(HECMW_ALL_E1003, "MPI_Comm_create");
530 goto error;
531 }
532
533 return 0;
534 error:
535 return -1;
536 #else
537 return 0;
538 #endif
539 }
540
HECMW_Group_rank(HECMW_Group group,int * rank)541 extern int HECMW_Group_rank(HECMW_Group group, int *rank) {
542 #ifndef HECMW_SERIAL
543 int rtc;
544 rtc = MPI_Group_rank(group, rank);
545
546 if (rtc != MPI_SUCCESS) {
547 HECMW_set_error(HECMW_ALL_E1003, "MPI_Group_rank");
548 goto error;
549 }
550
551 return 0;
552 error:
553 return -1;
554 #else
555 *rank = 0;
556 return 0;
557 #endif
558 }
559
HECMW_Group_size(HECMW_Group group,int * size)560 extern int HECMW_Group_size(HECMW_Group group, int *size) {
561 #ifndef HECMW_SERIAL
562 int rtc;
563 rtc = MPI_Group_size(group, size);
564
565 if (rtc != MPI_SUCCESS) {
566 HECMW_set_error(HECMW_ALL_E1003, "MPI_Group_size");
567 goto error;
568 }
569
570 return 0;
571 error:
572 return -1;
573 #else
574 *size = 1;
575 return 0;
576 #endif
577 }
578
HECMW_Comm_group(HECMW_Comm comm,HECMW_Group * group)579 extern int HECMW_Comm_group(HECMW_Comm comm, HECMW_Group *group) {
580 #ifndef HECMW_SERIAL
581 int rtc;
582 rtc = MPI_Comm_group(comm, group);
583
584 if (rtc != MPI_SUCCESS) {
585 HECMW_set_error(HECMW_ALL_E1003, "MPI_Comm_group");
586 goto error;
587 }
588
589 return 0;
590 error:
591 return -1;
592 #else
593 return 0;
594 #endif
595 }
596
check_is_initialized(void)597 static int check_is_initialized(void) {
598 #ifdef HECMW_SERIAL
599 is_initialized = 1;
600 #endif
601
602 if (!is_initialized) {
603 HECMW_set_error(HECMW_ALL_E1002, "");
604 return 0;
605 }
606
607 return 1;
608 }
609
setup_comm(void)610 static int setup_comm(void) {
611 #ifndef HECMW_SERIAL
612
613 if (MPI_Comm_dup(MPI_COMM_WORLD, &hecmw_comm) != MPI_SUCCESS) {
614 HECMW_set_error(HECMW_ALL_E1003, "");
615 return -1;
616 }
617
618 #else
619 hecmw_comm = 0;
620 #endif
621 return 0;
622 }
623
setup_comm_size(void)624 static int setup_comm_size(void) {
625 #ifndef HECMW_SERIAL
626
627 if (MPI_Comm_size(MPI_COMM_WORLD, &comm_size) != MPI_SUCCESS) {
628 HECMW_set_error(HECMW_ALL_E1003, "");
629 return -1;
630 }
631
632 #else
633 comm_size = 1;
634 #endif
635 return 0;
636 }
637
setup_comm_rank(void)638 static int setup_comm_rank(void) {
639 #ifndef HECMW_SERIAL
640
641 if (MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank) != MPI_SUCCESS) {
642 HECMW_set_error(HECMW_ALL_E1003, "");
643 return -1;
644 }
645
646 #else
647 comm_rank = 0;
648 #endif
649 return 0;
650 }
651
setup_comm_group(void)652 static int setup_comm_group(void) {
653 #ifndef HECMW_SERIAL
654
655 if (MPI_Comm_group(MPI_COMM_WORLD, &hecmw_group) != MPI_SUCCESS) {
656 HECMW_set_error(HECMW_ALL_E1003, "");
657 return -1;
658 }
659
660 #else
661 hecmw_group = 0;
662 #endif
663 return 0;
664 }
665
HECMW_comm_init(int * argc,char *** argv)666 int HECMW_comm_init(int *argc, char ***argv) {
667 #ifndef HECMW_SERIAL
668
669 if (MPI_Init(argc, argv) != MPI_SUCCESS) {
670 HECMW_set_error(HECMW_ALL_E1001, "");
671 return -1;
672 }
673
674 is_initialized = 1;
675 HECMW_log(HECMW_LOG_DEBUG, "MPI initialized");
676 #endif
677
678 if (setup_comm()) {
679 return -1;
680 }
681
682 if (setup_comm_size()) {
683 return -1;
684 }
685
686 if (setup_comm_rank()) {
687 return -1;
688 }
689
690 if (setup_comm_group()) {
691 return -1;
692 }
693
694 return 0;
695 }
696
HECMW_comm_is_initialized(void)697 int HECMW_comm_is_initialized(void) { return is_initialized; }
698
HECMW_comm_get_comm(void)699 HECMW_Comm HECMW_comm_get_comm(void) {
700 return check_is_initialized() ? hecmw_comm : (HECMW_Comm)-1;
701 }
702
HECMW_comm_get_size(void)703 int HECMW_comm_get_size(void) {
704 return check_is_initialized() ? comm_size : -1;
705 }
706
HECMW_comm_get_rank(void)707 int HECMW_comm_get_rank(void) {
708 return check_is_initialized() ? comm_rank : -1;
709 }
710
HECMW_comm_get_group(void)711 HECMW_Group HECMW_comm_get_group(void) {
712 return check_is_initialized() ? hecmw_group : (HECMW_Group)-1;
713 }
714
HECMW_Comm_c2f(HECMW_Comm comm)715 HECMW_Fint HECMW_Comm_c2f(HECMW_Comm comm) {
716 #ifndef HECMW_SERIAL
717 return MPI_Comm_c2f(comm);
718 #else
719 return comm;
720 #endif
721 }
722
HECMW_Comm_f2c(HECMW_Fint comm)723 HECMW_Comm HECMW_Comm_f2c(HECMW_Fint comm) {
724 #ifndef HECMW_SERIAL
725 return MPI_Comm_f2c(comm);
726 #else
727 return comm;
728 #endif
729 }
730
HECMW_Group_f2c(HECMW_Fint group)731 HECMW_Group HECMW_Group_f2c(HECMW_Fint group) {
732 #ifndef HECMW_SERIAL
733 return MPI_Group_f2c(group);
734 #else
735 return group;
736 #endif
737 }
738
739 /*---------------------------------------------------------------------------*/
740
hecmw_comm_init_if(HECMW_Fint * comm,int * size,int * rank,HECMW_Fint * group)741 extern void hecmw_comm_init_if(HECMW_Fint *comm, int *size, int *rank,
742 HECMW_Fint *group) {
743 is_initialized = 1;
744 hecmw_comm = HECMW_Comm_f2c(*comm);
745 comm_size = *size;
746 comm_rank = *rank;
747 hecmw_group = HECMW_Group_f2c(*group);
748 }
749
hecmw_comm_init_if_(HECMW_Fint * comm,int * size,int * rank,HECMW_Fint * group)750 extern void hecmw_comm_init_if_(HECMW_Fint *comm, int *size, int *rank,
751 HECMW_Fint *group) {
752 hecmw_comm_init_if(comm, size, rank, group);
753 }
754
hecmw_comm_init_if__(HECMW_Fint * comm,int * size,int * rank,HECMW_Fint * group)755 extern void hecmw_comm_init_if__(HECMW_Fint *comm, int *size, int *rank,
756 HECMW_Fint *group) {
757 hecmw_comm_init_if(comm, size, rank, group);
758 }
759
HECMW_COMM_INIT_IF(HECMW_Fint * comm,int * size,int * rank,HECMW_Fint * group)760 extern void HECMW_COMM_INIT_IF(HECMW_Fint *comm, int *size, int *rank,
761 HECMW_Fint *group) {
762 hecmw_comm_init_if(comm, size, rank, group);
763 }
764