1 /* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include "smpi_coll_private.h"
9 #include "smpi_mpi_dt_private.h"
11 #define MPI_CALL_IMPLEM(type,name,args) \
12 type name args __attribute__((weak,alias("P"#name))); \
15 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi,
16 "Logging specific to SMPI (mpi)");
19 //this function need to be here because of the calls to smpi_bench
20 int TRACE_smpi_set_category(const char *category)
22 //need to end bench otherwise categories for execution tasks are wrong
28 if (category != NULL) {
29 ret = TRACE_category(category);
30 TRACE_category_set(SIMIX_process_self(), category);
32 //if category is NULL, trace of platform is disabled for this process
33 TRACE_category_unset(SIMIX_process_self());
37 //begin bench after changing process's category
43 /* MPI User level calls */
45 MPI_CALL_IMPLEM(int, MPI_Init, (int *argc, char ***argv))
47 smpi_process_init(argc, argv);
49 TRACE_smpi_init(smpi_process_index());
55 MPI_CALL_IMPLEM(int, MPI_Finalize, (void))
59 TRACE_smpi_finalize(smpi_process_index());
61 smpi_process_destroy();
65 MPI_CALL_IMPLEM(int, MPI_Init_thread, (int *argc, char ***argv, int required, int *provided))
67 if (provided != NULL) {
68 *provided = MPI_THREAD_MULTIPLE;
70 return MPI_Init(argc, argv);
73 MPI_CALL_IMPLEM(int, MPI_Query_thread, (int *provided))
78 if (provided == NULL) {
81 *provided = MPI_THREAD_MULTIPLE;
88 MPI_CALL_IMPLEM(int, MPI_Is_thread_main, (int *flag))
96 *flag = smpi_process_index() == 0;
103 MPI_CALL_IMPLEM(int, MPI_Abort, (MPI_Comm comm, int errorcode))
106 smpi_process_destroy();
107 // FIXME: should kill all processes in comm instead
108 SIMIX_process_kill(SIMIX_process_self());
112 double MPI_Wtime(void)
117 time = SIMIX_get_clock();
122 MPI_CALL_IMPLEM(int, MPI_Address, (void *location, MPI_Aint * address))
128 retval = MPI_ERR_ARG;
130 *address = (MPI_Aint) location;
136 MPI_CALL_IMPLEM(int, MPI_Type_free, (MPI_Datatype * datatype))
142 retval = MPI_ERR_ARG;
144 // FIXME: always fail for now
145 retval = MPI_ERR_TYPE;
151 MPI_CALL_IMPLEM(int, MPI_Type_size, (MPI_Datatype datatype, int *size))
156 if (datatype == MPI_DATATYPE_NULL) {
157 retval = MPI_ERR_TYPE;
158 } else if (size == NULL) {
159 retval = MPI_ERR_ARG;
161 *size = (int) smpi_datatype_size(datatype);
162 retval = MPI_SUCCESS;
168 MPI_CALL_IMPLEM(int, MPI_Type_get_extent,
169 (MPI_Datatype datatype, MPI_Aint * lb,
175 if (datatype == MPI_DATATYPE_NULL) {
176 retval = MPI_ERR_TYPE;
177 } else if (lb == NULL || extent == NULL) {
178 retval = MPI_ERR_ARG;
180 retval = smpi_datatype_extent(datatype, lb, extent);
186 MPI_CALL_IMPLEM(int, MPI_Type_extent, (MPI_Datatype datatype, MPI_Aint * extent))
192 if (datatype == MPI_DATATYPE_NULL) {
193 retval = MPI_ERR_TYPE;
194 } else if (extent == NULL) {
195 retval = MPI_ERR_ARG;
197 retval = smpi_datatype_extent(datatype, &dummy, extent);
203 MPI_CALL_IMPLEM(int, MPI_Type_lb, (MPI_Datatype datatype, MPI_Aint * disp))
208 if (datatype == MPI_DATATYPE_NULL) {
209 retval = MPI_ERR_TYPE;
210 } else if (disp == NULL) {
211 retval = MPI_ERR_ARG;
213 *disp = smpi_datatype_lb(datatype);
214 retval = MPI_SUCCESS;
220 MPI_CALL_IMPLEM(int, MPI_Type_ub, (MPI_Datatype datatype, MPI_Aint * disp))
225 if (datatype == MPI_DATATYPE_NULL) {
226 retval = MPI_ERR_TYPE;
227 } else if (disp == NULL) {
228 retval = MPI_ERR_ARG;
230 *disp = smpi_datatype_ub(datatype);
231 retval = MPI_SUCCESS;
237 MPI_CALL_IMPLEM(int, MPI_Op_create, (MPI_User_function * function, int commute, MPI_Op * op))
242 if (function == NULL || op == NULL) {
243 retval = MPI_ERR_ARG;
245 *op = smpi_op_new(function, commute);
246 retval = MPI_SUCCESS;
252 MPI_CALL_IMPLEM(int, MPI_Op_free, (MPI_Op * op))
258 retval = MPI_ERR_ARG;
259 } else if (*op == MPI_OP_NULL) {
262 smpi_op_destroy(*op);
264 retval = MPI_SUCCESS;
270 MPI_CALL_IMPLEM(int, MPI_Group_free, (MPI_Group * group))
276 retval = MPI_ERR_ARG;
278 smpi_group_destroy(*group);
279 *group = MPI_GROUP_NULL;
280 retval = MPI_SUCCESS;
286 MPI_CALL_IMPLEM(int, MPI_Group_size, (MPI_Group group, int *size))
291 if (group == MPI_GROUP_NULL) {
292 retval = MPI_ERR_GROUP;
293 } else if (size == NULL) {
294 retval = MPI_ERR_ARG;
296 *size = smpi_group_size(group);
297 retval = MPI_SUCCESS;
303 MPI_CALL_IMPLEM(int, MPI_Group_rank, (MPI_Group group, int *rank))
308 if (group == MPI_GROUP_NULL) {
309 retval = MPI_ERR_GROUP;
310 } else if (rank == NULL) {
311 retval = MPI_ERR_ARG;
313 *rank = smpi_group_rank(group, smpi_process_index());
314 retval = MPI_SUCCESS;
320 MPI_CALL_IMPLEM(int, MPI_Group_translate_ranks,
321 (MPI_Group group1, int n, int *ranks1,
322 MPI_Group group2, int *ranks2))
324 int retval, i, index;
327 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
328 retval = MPI_ERR_GROUP;
330 for (i = 0; i < n; i++) {
331 index = smpi_group_index(group1, ranks1[i]);
332 ranks2[i] = smpi_group_rank(group2, index);
334 retval = MPI_SUCCESS;
340 MPI_CALL_IMPLEM(int, MPI_Group_compare, (MPI_Group group1, MPI_Group group2, int *result))
345 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
346 retval = MPI_ERR_GROUP;
347 } else if (result == NULL) {
348 retval = MPI_ERR_ARG;
350 *result = smpi_group_compare(group1, group2);
351 retval = MPI_SUCCESS;
357 MPI_CALL_IMPLEM(int, MPI_Group_union,
358 (MPI_Group group1, MPI_Group group2,
359 MPI_Group * newgroup))
361 int retval, i, proc1, proc2, size, size2;
364 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
365 retval = MPI_ERR_GROUP;
366 } else if (newgroup == NULL) {
367 retval = MPI_ERR_ARG;
369 size = smpi_group_size(group1);
370 size2 = smpi_group_size(group2);
371 for (i = 0; i < size2; i++) {
372 proc2 = smpi_group_index(group2, i);
373 proc1 = smpi_group_rank(group1, proc2);
374 if (proc1 == MPI_UNDEFINED) {
379 *newgroup = MPI_GROUP_EMPTY;
381 *newgroup = smpi_group_new(size);
382 size2 = smpi_group_size(group1);
383 for (i = 0; i < size2; i++) {
384 proc1 = smpi_group_index(group1, i);
385 smpi_group_set_mapping(*newgroup, proc1, i);
387 for (i = size2; i < size; i++) {
388 proc2 = smpi_group_index(group2, i - size2);
389 smpi_group_set_mapping(*newgroup, proc2, i);
392 smpi_group_use(*newgroup);
393 retval = MPI_SUCCESS;
399 MPI_CALL_IMPLEM(int, MPI_Group_intersection,
400 (MPI_Group group1, MPI_Group group2,
401 MPI_Group * newgroup))
403 int retval, i, proc1, proc2, size, size2;
406 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
407 retval = MPI_ERR_GROUP;
408 } else if (newgroup == NULL) {
409 retval = MPI_ERR_ARG;
411 size = smpi_group_size(group1);
412 size2 = smpi_group_size(group2);
413 for (i = 0; i < size2; i++) {
414 proc2 = smpi_group_index(group2, i);
415 proc1 = smpi_group_rank(group1, proc2);
416 if (proc1 == MPI_UNDEFINED) {
421 *newgroup = MPI_GROUP_EMPTY;
423 *newgroup = smpi_group_new(size);
424 size2 = smpi_group_size(group1);
425 for (i = 0; i < size2; i++) {
426 proc1 = smpi_group_index(group1, i);
427 proc2 = smpi_group_rank(group2, proc1);
428 if (proc2 != MPI_UNDEFINED) {
429 smpi_group_set_mapping(*newgroup, proc1, i);
433 smpi_group_use(*newgroup);
434 retval = MPI_SUCCESS;
440 MPI_CALL_IMPLEM(int, MPI_Group_difference,
441 (MPI_Group group1, MPI_Group group2,
442 MPI_Group * newgroup))
444 int retval, i, proc1, proc2, size, size2;
447 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
448 retval = MPI_ERR_GROUP;
449 } else if (newgroup == NULL) {
450 retval = MPI_ERR_ARG;
452 size = size2 = smpi_group_size(group1);
453 for (i = 0; i < size2; i++) {
454 proc1 = smpi_group_index(group1, i);
455 proc2 = smpi_group_rank(group2, proc1);
456 if (proc2 != MPI_UNDEFINED) {
461 *newgroup = MPI_GROUP_EMPTY;
463 *newgroup = smpi_group_new(size);
464 for (i = 0; i < size2; i++) {
465 proc1 = smpi_group_index(group1, i);
466 proc2 = smpi_group_rank(group2, proc1);
467 if (proc2 == MPI_UNDEFINED) {
468 smpi_group_set_mapping(*newgroup, proc1, i);
472 smpi_group_use(*newgroup);
473 retval = MPI_SUCCESS;
479 MPI_CALL_IMPLEM(int, MPI_Group_incl,
480 (MPI_Group group, int n, int *ranks,
481 MPI_Group * newgroup))
483 int retval, i, index;
486 if (group == MPI_GROUP_NULL) {
487 retval = MPI_ERR_GROUP;
488 } else if (newgroup == NULL) {
489 retval = MPI_ERR_ARG;
492 *newgroup = MPI_GROUP_EMPTY;
493 } else if (n == smpi_group_size(group)) {
496 *newgroup = smpi_group_new(n);
497 for (i = 0; i < n; i++) {
498 index = smpi_group_index(group, ranks[i]);
499 smpi_group_set_mapping(*newgroup, index, i);
502 smpi_group_use(*newgroup);
503 retval = MPI_SUCCESS;
509 MPI_CALL_IMPLEM(int, MPI_Group_excl,
510 (MPI_Group group, int n, int *ranks,
511 MPI_Group * newgroup))
513 int retval, i, size, rank, index;
516 if (group == MPI_GROUP_NULL) {
517 retval = MPI_ERR_GROUP;
518 } else if (newgroup == NULL) {
519 retval = MPI_ERR_ARG;
523 } else if (n == smpi_group_size(group)) {
524 *newgroup = MPI_GROUP_EMPTY;
526 size = smpi_group_size(group) - n;
527 *newgroup = smpi_group_new(size);
529 while (rank < size) {
530 for (i = 0; i < n; i++) {
531 if (ranks[i] == rank) {
536 index = smpi_group_index(group, rank);
537 smpi_group_set_mapping(*newgroup, index, rank);
542 smpi_group_use(*newgroup);
543 retval = MPI_SUCCESS;
549 MPI_CALL_IMPLEM(int, MPI_Group_range_incl,
550 (MPI_Group group, int n, int ranges[][3],
551 MPI_Group * newgroup))
553 int retval, i, j, rank, size, index;
556 if (group == MPI_GROUP_NULL) {
557 retval = MPI_ERR_GROUP;
558 } else if (newgroup == NULL) {
559 retval = MPI_ERR_ARG;
562 *newgroup = MPI_GROUP_EMPTY;
565 for (i = 0; i < n; i++) {
566 for (rank = ranges[i][0]; /* First */
567 rank >= 0 && rank <= ranges[i][1]; /* Last */
568 rank += ranges[i][2] /* Stride */ ) {
572 if (size == smpi_group_size(group)) {
575 *newgroup = smpi_group_new(size);
577 for (i = 0; i < n; i++) {
578 for (rank = ranges[i][0]; /* First */
579 rank >= 0 && rank <= ranges[i][1]; /* Last */
580 rank += ranges[i][2] /* Stride */ ) {
581 index = smpi_group_index(group, rank);
582 smpi_group_set_mapping(*newgroup, index, j);
588 smpi_group_use(*newgroup);
589 retval = MPI_SUCCESS;
595 MPI_CALL_IMPLEM(int, MPI_Group_range_excl,
596 (MPI_Group group, int n, int ranges[][3],
597 MPI_Group * newgroup))
599 int retval, i, newrank, rank, size, index, add;
602 if (group == MPI_GROUP_NULL) {
603 retval = MPI_ERR_GROUP;
604 } else if (newgroup == NULL) {
605 retval = MPI_ERR_ARG;
610 size = smpi_group_size(group);
611 for (i = 0; i < n; i++) {
612 for (rank = ranges[i][0]; /* First */
613 rank >= 0 && rank <= ranges[i][1]; /* Last */
614 rank += ranges[i][2] /* Stride */ ) {
619 *newgroup = MPI_GROUP_EMPTY;
621 *newgroup = smpi_group_new(size);
623 while (newrank < size) {
624 for (i = 0; i < n; i++) {
626 for (rank = ranges[i][0]; /* First */
627 rank >= 0 && rank <= ranges[i][1]; /* Last */
628 rank += ranges[i][2] /* Stride */ ) {
629 if (rank == newrank) {
635 index = smpi_group_index(group, newrank);
636 smpi_group_set_mapping(*newgroup, index, newrank);
642 smpi_group_use(*newgroup);
643 retval = MPI_SUCCESS;
649 MPI_CALL_IMPLEM(int, MPI_Comm_rank, (MPI_Comm comm, int *rank))
654 if (comm == MPI_COMM_NULL) {
655 retval = MPI_ERR_COMM;
657 *rank = smpi_comm_rank(comm);
658 retval = MPI_SUCCESS;
664 MPI_CALL_IMPLEM(int, MPI_Comm_size, (MPI_Comm comm, int *size))
669 if (comm == MPI_COMM_NULL) {
670 retval = MPI_ERR_COMM;
671 } else if (size == NULL) {
672 retval = MPI_ERR_ARG;
674 *size = smpi_comm_size(comm);
675 retval = MPI_SUCCESS;
681 MPI_CALL_IMPLEM(int, MPI_Comm_group, (MPI_Comm comm, MPI_Group * group))
686 if (comm == MPI_COMM_NULL) {
687 retval = MPI_ERR_COMM;
688 } else if (group == NULL) {
689 retval = MPI_ERR_ARG;
691 *group = smpi_comm_group(comm);
692 retval = MPI_SUCCESS;
698 MPI_CALL_IMPLEM(int, MPI_Comm_compare, (MPI_Comm comm1, MPI_Comm comm2, int *result))
703 if (comm1 == MPI_COMM_NULL || comm2 == MPI_COMM_NULL) {
704 retval = MPI_ERR_COMM;
705 } else if (result == NULL) {
706 retval = MPI_ERR_ARG;
708 if (comm1 == comm2) { /* Same communicators means same groups */
712 smpi_group_compare(smpi_comm_group(comm1),
713 smpi_comm_group(comm2));
714 if (*result == MPI_IDENT) {
715 *result = MPI_CONGRUENT;
718 retval = MPI_SUCCESS;
724 MPI_CALL_IMPLEM(int, MPI_Comm_dup, (MPI_Comm comm, MPI_Comm * newcomm))
729 if (comm == MPI_COMM_NULL) {
730 retval = MPI_ERR_COMM;
731 } else if (newcomm == NULL) {
732 retval = MPI_ERR_ARG;
734 *newcomm = smpi_comm_new(smpi_comm_group(comm));
735 retval = MPI_SUCCESS;
741 MPI_CALL_IMPLEM(int, MPI_Comm_create, (MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm))
746 if (comm == MPI_COMM_NULL) {
747 retval = MPI_ERR_COMM;
748 } else if (group == MPI_GROUP_NULL) {
749 retval = MPI_ERR_GROUP;
750 } else if (newcomm == NULL) {
751 retval = MPI_ERR_ARG;
753 *newcomm = smpi_comm_new(group);
754 retval = MPI_SUCCESS;
760 MPI_CALL_IMPLEM(int, MPI_Comm_free, (MPI_Comm * comm))
766 retval = MPI_ERR_ARG;
767 } else if (*comm == MPI_COMM_NULL) {
768 retval = MPI_ERR_COMM;
770 smpi_comm_destroy(*comm);
771 *comm = MPI_COMM_NULL;
772 retval = MPI_SUCCESS;
778 MPI_CALL_IMPLEM(int, MPI_Comm_split, (MPI_Comm comm, int color, int key, MPI_Comm* comm_out))
783 if (comm_out == NULL) {
784 retval = MPI_ERR_ARG;
785 } else if (comm == MPI_COMM_NULL) {
786 retval = MPI_ERR_COMM;
788 *comm_out = smpi_comm_split(comm, color, key);
789 retval = MPI_SUCCESS;
795 MPI_CALL_IMPLEM(int, MPI_Send_init,
796 (void *buf, int count, MPI_Datatype datatype, int dst,
797 int tag, MPI_Comm comm, MPI_Request * request))
802 if (request == NULL) {
803 retval = MPI_ERR_ARG;
804 } else if (comm == MPI_COMM_NULL) {
805 retval = MPI_ERR_COMM;
807 *request = smpi_mpi_send_init(buf, count, datatype, dst, tag, comm);
808 retval = MPI_SUCCESS;
814 MPI_CALL_IMPLEM(int, MPI_Recv_init,
815 (void *buf, int count, MPI_Datatype datatype, int src,
816 int tag, MPI_Comm comm, MPI_Request * request))
821 if (request == NULL) {
822 retval = MPI_ERR_ARG;
823 } else if (comm == MPI_COMM_NULL) {
824 retval = MPI_ERR_COMM;
826 *request = smpi_mpi_recv_init(buf, count, datatype, src, tag, comm);
827 retval = MPI_SUCCESS;
833 MPI_CALL_IMPLEM(int, MPI_Start, (MPI_Request * request))
838 if (request == NULL) {
839 retval = MPI_ERR_ARG;
841 smpi_mpi_start(*request);
842 retval = MPI_SUCCESS;
848 MPI_CALL_IMPLEM(int, MPI_Startall, (int count, MPI_Request * requests))
853 if (requests == NULL) {
854 retval = MPI_ERR_ARG;
856 smpi_mpi_startall(count, requests);
857 retval = MPI_SUCCESS;
863 MPI_CALL_IMPLEM(int, MPI_Request_free, (MPI_Request * request))
868 if (request == NULL) {
869 retval = MPI_ERR_ARG;
871 smpi_mpi_request_free(request);
872 retval = MPI_SUCCESS;
878 MPI_CALL_IMPLEM(int, MPI_Irecv,
879 (void *buf, int count, MPI_Datatype datatype, int src,
880 int tag, MPI_Comm comm, MPI_Request * request))
886 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
887 int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
888 TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
890 if (request == NULL) {
891 retval = MPI_ERR_ARG;
892 } else if (comm == MPI_COMM_NULL) {
893 retval = MPI_ERR_COMM;
895 *request = smpi_mpi_irecv(buf, count, datatype, src, tag, comm);
896 retval = MPI_SUCCESS;
899 TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
900 (*request)->recv = 1;
906 MPI_CALL_IMPLEM(int, MPI_Isend,
907 (void *buf, int count, MPI_Datatype datatype, int dst,
908 int tag, MPI_Comm comm, MPI_Request * request))
914 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
915 int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
916 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
917 TRACE_smpi_send(rank, rank, dst_traced);
919 if (request == NULL) {
920 retval = MPI_ERR_ARG;
921 } else if (comm == MPI_COMM_NULL) {
922 retval = MPI_ERR_COMM;
924 *request = smpi_mpi_isend(buf, count, datatype, dst, tag, comm);
925 retval = MPI_SUCCESS;
928 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
929 (*request)->send = 1;
935 MPI_CALL_IMPLEM(int, MPI_Recv,
936 (void *buf, int count, MPI_Datatype datatype, int src, int tag,
937 MPI_Comm comm, MPI_Status * status))
943 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
944 int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
945 TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
947 if (comm == MPI_COMM_NULL) {
948 retval = MPI_ERR_COMM;
950 smpi_mpi_recv(buf, count, datatype, src, tag, comm, status);
951 retval = MPI_SUCCESS;
954 TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
955 TRACE_smpi_recv(rank, src_traced, rank);
961 MPI_CALL_IMPLEM(int, MPI_Send,
962 (void *buf, int count, MPI_Datatype datatype, int dst, int tag,
969 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
970 int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
971 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
972 TRACE_smpi_send(rank, rank, dst_traced);
974 if (comm == MPI_COMM_NULL) {
975 retval = MPI_ERR_COMM;
977 smpi_mpi_send(buf, count, datatype, dst, tag, comm);
978 retval = MPI_SUCCESS;
981 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
987 MPI_CALL_IMPLEM(int, MPI_Sendrecv,
988 (void *sendbuf, int sendcount, MPI_Datatype sendtype,
989 int dst, int sendtag, void *recvbuf, int recvcount,
990 MPI_Datatype recvtype, int src, int recvtag,
991 MPI_Comm comm, MPI_Status * status))
997 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
998 int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
999 int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
1000 TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
1001 TRACE_smpi_send(rank, rank, dst_traced);
1002 TRACE_smpi_send(rank, src_traced, rank);
1004 if (comm == MPI_COMM_NULL) {
1005 retval = MPI_ERR_COMM;
1006 } else if (sendtype == MPI_DATATYPE_NULL
1007 || recvtype == MPI_DATATYPE_NULL) {
1008 retval = MPI_ERR_TYPE;
1010 smpi_mpi_sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf,
1011 recvcount, recvtype, src, recvtag, comm, status);
1012 retval = MPI_SUCCESS;
1015 TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
1016 TRACE_smpi_recv(rank, rank, dst_traced);
1017 TRACE_smpi_recv(rank, src_traced, rank);
1023 MPI_CALL_IMPLEM(int, MPI_Sendrecv_replace,
1024 (void *buf, int count, MPI_Datatype datatype,
1025 int dst, int sendtag, int src, int recvtag,
1026 MPI_Comm comm, MPI_Status * status))
1028 //TODO: suboptimal implementation
1032 size = smpi_datatype_size(datatype) * count;
1033 recvbuf = xbt_new(char, size);
1035 MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count,
1036 datatype, src, recvtag, comm, status);
1037 memcpy(buf, recvbuf, size * sizeof(char));
1042 MPI_CALL_IMPLEM(int, MPI_Test, (MPI_Request * request, int *flag, MPI_Status * status))
1047 if (request == NULL || flag == NULL) {
1048 retval = MPI_ERR_ARG;
1049 } else if (*request == MPI_REQUEST_NULL) {
1050 retval = MPI_ERR_REQUEST;
1052 *flag = smpi_mpi_test(request, status);
1053 retval = MPI_SUCCESS;
1059 MPI_CALL_IMPLEM(int, MPI_Testany,
1060 (int count, MPI_Request requests[], int *index, int *flag,
1061 MPI_Status * status))
1066 if (index == NULL || flag == NULL) {
1067 retval = MPI_ERR_ARG;
1069 *flag = smpi_mpi_testany(count, requests, index, status);
1070 retval = MPI_SUCCESS;
1076 MPI_CALL_IMPLEM(int, MPI_Wait, (MPI_Request * request, MPI_Status * status))
1082 int rank = request && (*request)->comm != MPI_COMM_NULL
1083 ? smpi_comm_rank((*request)->comm)
1085 MPI_Group group = smpi_comm_group((*request)->comm);
1086 int src_traced = smpi_group_rank(group, (*request)->src);
1087 int dst_traced = smpi_group_rank(group, (*request)->dst);
1088 int is_wait_for_receive = (*request)->recv;
1089 TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
1091 if (request == NULL) {
1092 retval = MPI_ERR_ARG;
1093 } else if (*request == MPI_REQUEST_NULL) {
1094 retval = MPI_ERR_REQUEST;
1096 smpi_mpi_wait(request, status);
1097 retval = MPI_SUCCESS;
1100 TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
1101 if (is_wait_for_receive) {
1102 TRACE_smpi_recv(rank, src_traced, dst_traced);
1109 MPI_CALL_IMPLEM(int, MPI_Waitany,
1110 (int count, MPI_Request requests[], int *index,
1111 MPI_Status * status))
1117 //save requests information for tracing
1119 xbt_dynar_t srcs = xbt_dynar_new(sizeof(int), xbt_free);
1120 xbt_dynar_t dsts = xbt_dynar_new(sizeof(int), xbt_free);
1121 xbt_dynar_t recvs = xbt_dynar_new(sizeof(int), xbt_free);
1122 for (i = 0; i < count; i++) {
1123 MPI_Request req = requests[i]; //already received requests are no longer valid
1125 int *asrc = xbt_new(int, 1);
1126 int *adst = xbt_new(int, 1);
1127 int *arecv = xbt_new(int, 1);
1131 xbt_dynar_insert_at(srcs, i, asrc);
1132 xbt_dynar_insert_at(dsts, i, adst);
1133 xbt_dynar_insert_at(recvs, i, arecv);
1135 int *t = xbt_new(int, 1);
1136 xbt_dynar_insert_at(srcs, i, t);
1137 xbt_dynar_insert_at(dsts, i, t);
1138 xbt_dynar_insert_at(recvs, i, t);
1141 int rank_traced = smpi_comm_rank(MPI_COMM_WORLD);
1142 TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
1144 if (index == NULL) {
1145 retval = MPI_ERR_ARG;
1147 *index = smpi_mpi_waitany(count, requests, status);
1148 retval = MPI_SUCCESS;
1151 int src_traced, dst_traced, is_wait_for_receive;
1152 xbt_dynar_get_cpy(srcs, *index, &src_traced);
1153 xbt_dynar_get_cpy(dsts, *index, &dst_traced);
1154 xbt_dynar_get_cpy(recvs, *index, &is_wait_for_receive);
1155 if (is_wait_for_receive) {
1156 TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
1158 TRACE_smpi_ptp_out(rank_traced, src_traced, dst_traced, __FUNCTION__);
1159 //clean-up of dynars
1168 MPI_CALL_IMPLEM(int, MPI_Waitall, (int count, MPI_Request requests[], MPI_Status status[]))
1173 //save information from requests
1175 xbt_dynar_t srcs = xbt_dynar_new(sizeof(int), xbt_free);
1176 xbt_dynar_t dsts = xbt_dynar_new(sizeof(int), xbt_free);
1177 xbt_dynar_t recvs = xbt_dynar_new(sizeof(int), xbt_free);
1178 for (i = 0; i < count; i++) {
1179 MPI_Request req = requests[i]; //all req should be valid in Waitall
1180 int *asrc = xbt_new(int, 1);
1181 int *adst = xbt_new(int, 1);
1182 int *arecv = xbt_new(int, 1);
1186 xbt_dynar_insert_at(srcs, i, asrc);
1187 xbt_dynar_insert_at(dsts, i, adst);
1188 xbt_dynar_insert_at(recvs, i, arecv);
1190 int rank_traced = smpi_comm_rank (MPI_COMM_WORLD);
1191 TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
1193 smpi_mpi_waitall(count, requests, status);
1195 for (i = 0; i < count; i++) {
1196 int src_traced, dst_traced, is_wait_for_receive;
1197 xbt_dynar_get_cpy(srcs, i, &src_traced);
1198 xbt_dynar_get_cpy(dsts, i, &dst_traced);
1199 xbt_dynar_get_cpy(recvs, i, &is_wait_for_receive);
1200 if (is_wait_for_receive) {
1201 TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
1204 TRACE_smpi_ptp_out(rank_traced, -1, -1, __FUNCTION__);
1205 //clean-up of dynars
1214 MPI_CALL_IMPLEM(int, MPI_Waitsome,
1215 (int incount, MPI_Request requests[], int *outcount,
1216 int *indices, MPI_Status status[]))
1221 if (outcount == NULL || indices == NULL) {
1222 retval = MPI_ERR_ARG;
1224 *outcount = smpi_mpi_waitsome(incount, requests, indices, status);
1225 retval = MPI_SUCCESS;
1231 MPI_CALL_IMPLEM(int, MPI_Bcast,
1232 (void *buf, int count, MPI_Datatype datatype, int root,
1239 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1240 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1241 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1243 if (comm == MPI_COMM_NULL) {
1244 retval = MPI_ERR_COMM;
1246 smpi_mpi_bcast(buf, count, datatype, root, comm);
1247 retval = MPI_SUCCESS;
1250 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1256 MPI_CALL_IMPLEM(int, MPI_Barrier, (MPI_Comm comm))
1262 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1263 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1265 if (comm == MPI_COMM_NULL) {
1266 retval = MPI_ERR_COMM;
1268 smpi_mpi_barrier(comm);
1269 retval = MPI_SUCCESS;
1272 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1278 MPI_CALL_IMPLEM(int, MPI_Gather,
1279 (void *sendbuf, int sendcount, MPI_Datatype sendtype,
1280 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1281 int root, MPI_Comm comm))
1287 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1288 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1289 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1291 if (comm == MPI_COMM_NULL) {
1292 retval = MPI_ERR_COMM;
1293 } else if (sendtype == MPI_DATATYPE_NULL
1294 || recvtype == MPI_DATATYPE_NULL) {
1295 retval = MPI_ERR_TYPE;
1297 smpi_mpi_gather(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1298 recvtype, root, comm);
1299 retval = MPI_SUCCESS;
1302 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1308 MPI_CALL_IMPLEM(int, MPI_Gatherv,
1309 (void *sendbuf, int sendcount, MPI_Datatype sendtype,
1310 void *recvbuf, int *recvcounts, int *displs,
1311 MPI_Datatype recvtype, int root, MPI_Comm comm))
1317 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1318 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1319 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1321 if (comm == MPI_COMM_NULL) {
1322 retval = MPI_ERR_COMM;
1323 } else if (sendtype == MPI_DATATYPE_NULL
1324 || recvtype == MPI_DATATYPE_NULL) {
1325 retval = MPI_ERR_TYPE;
1326 } else if (recvcounts == NULL || displs == NULL) {
1327 retval = MPI_ERR_ARG;
1329 smpi_mpi_gatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
1330 displs, recvtype, root, comm);
1331 retval = MPI_SUCCESS;
1334 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1340 MPI_CALL_IMPLEM(int, MPI_Allgather,
1341 (void *sendbuf, int sendcount, MPI_Datatype sendtype,
1342 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1349 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1350 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1352 if (comm == MPI_COMM_NULL) {
1353 retval = MPI_ERR_COMM;
1354 } else if (sendtype == MPI_DATATYPE_NULL
1355 || recvtype == MPI_DATATYPE_NULL) {
1356 retval = MPI_ERR_TYPE;
1358 smpi_mpi_allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1360 retval = MPI_SUCCESS;
1363 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1369 MPI_CALL_IMPLEM(int, MPI_Allgatherv,
1370 (void *sendbuf, int sendcount, MPI_Datatype sendtype,
1371 void *recvbuf, int *recvcounts, int *displs,
1372 MPI_Datatype recvtype, MPI_Comm comm))
1378 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1379 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1381 if (comm == MPI_COMM_NULL) {
1382 retval = MPI_ERR_COMM;
1383 } else if (sendtype == MPI_DATATYPE_NULL
1384 || recvtype == MPI_DATATYPE_NULL) {
1385 retval = MPI_ERR_TYPE;
1386 } else if (recvcounts == NULL || displs == NULL) {
1387 retval = MPI_ERR_ARG;
1389 smpi_mpi_allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
1390 displs, recvtype, comm);
1391 retval = MPI_SUCCESS;
1394 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1400 MPI_CALL_IMPLEM(int, MPI_Scatter,
1401 (void *sendbuf, int sendcount, MPI_Datatype sendtype,
1402 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1403 int root, MPI_Comm comm))
1409 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1410 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1411 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1413 if (comm == MPI_COMM_NULL) {
1414 retval = MPI_ERR_COMM;
1415 } else if (sendtype == MPI_DATATYPE_NULL
1416 || recvtype == MPI_DATATYPE_NULL) {
1417 retval = MPI_ERR_TYPE;
1419 smpi_mpi_scatter(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1420 recvtype, root, comm);
1421 retval = MPI_SUCCESS;
1424 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1430 MPI_CALL_IMPLEM(int, MPI_Scatterv,
1431 (void *sendbuf, int *sendcounts, int *displs,
1432 MPI_Datatype sendtype, void *recvbuf, int recvcount,
1433 MPI_Datatype recvtype, int root, MPI_Comm comm))
1439 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1440 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1441 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1443 if (comm == MPI_COMM_NULL) {
1444 retval = MPI_ERR_COMM;
1445 } else if (sendtype == MPI_DATATYPE_NULL
1446 || recvtype == MPI_DATATYPE_NULL) {
1447 retval = MPI_ERR_TYPE;
1448 } else if (sendcounts == NULL || displs == NULL) {
1449 retval = MPI_ERR_ARG;
1451 smpi_mpi_scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf,
1452 recvcount, recvtype, root, comm);
1453 retval = MPI_SUCCESS;
1456 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1462 MPI_CALL_IMPLEM(int, MPI_Reduce,
1463 (void *sendbuf, void *recvbuf, int count,
1464 MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm))
1470 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1471 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1472 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1474 if (comm == MPI_COMM_NULL) {
1475 retval = MPI_ERR_COMM;
1476 } else if (datatype == MPI_DATATYPE_NULL || op == MPI_OP_NULL) {
1477 retval = MPI_ERR_ARG;
1479 smpi_mpi_reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
1480 retval = MPI_SUCCESS;
1483 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1489 MPI_CALL_IMPLEM(int, MPI_Allreduce,
1490 (void *sendbuf, void *recvbuf, int count,
1491 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm))
1497 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1498 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1500 if (comm == MPI_COMM_NULL) {
1501 retval = MPI_ERR_COMM;
1502 } else if (datatype == MPI_DATATYPE_NULL) {
1503 retval = MPI_ERR_TYPE;
1504 } else if (op == MPI_OP_NULL) {
1505 retval = MPI_ERR_OP;
1507 smpi_mpi_allreduce(sendbuf, recvbuf, count, datatype, op, comm);
1508 retval = MPI_SUCCESS;
1511 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1517 MPI_CALL_IMPLEM(int, MPI_Scan,
1518 (void *sendbuf, void *recvbuf, int count,
1519 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm))
1525 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1526 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1528 if (comm == MPI_COMM_NULL) {
1529 retval = MPI_ERR_COMM;
1530 } else if (datatype == MPI_DATATYPE_NULL) {
1531 retval = MPI_ERR_TYPE;
1532 } else if (op == MPI_OP_NULL) {
1533 retval = MPI_ERR_OP;
1535 smpi_mpi_scan(sendbuf, recvbuf, count, datatype, op, comm);
1536 retval = MPI_SUCCESS;
1539 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1545 MPI_CALL_IMPLEM(int, MPI_Reduce_scatter,
1546 (void *sendbuf, void *recvbuf, int *recvcounts,
1547 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm))
1549 int retval, i, size, count;
1551 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1555 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1557 if (comm == MPI_COMM_NULL) {
1558 retval = MPI_ERR_COMM;
1559 } else if (datatype == MPI_DATATYPE_NULL) {
1560 retval = MPI_ERR_TYPE;
1561 } else if (op == MPI_OP_NULL) {
1562 retval = MPI_ERR_OP;
1563 } else if (recvcounts == NULL) {
1564 retval = MPI_ERR_ARG;
1566 /* arbitrarily choose root as rank 0 */
1567 /* TODO: faster direct implementation ? */
1568 size = smpi_comm_size(comm);
1570 displs = xbt_new(int, size);
1571 for (i = 0; i < size; i++) {
1572 count += recvcounts[i];
1575 smpi_mpi_reduce(sendbuf, recvbuf, count, datatype, op, 0, comm);
1576 smpi_mpi_scatterv(recvbuf, recvcounts, displs, datatype, recvbuf,
1577 recvcounts[rank], datatype, 0, comm);
1579 retval = MPI_SUCCESS;
1582 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1588 MPI_CALL_IMPLEM(int, MPI_Alltoall,
1589 (void *sendbuf, int sendcount, MPI_Datatype sendtype,
1590 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1593 int retval, size, sendsize;
1597 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1598 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1600 if (comm == MPI_COMM_NULL) {
1601 retval = MPI_ERR_COMM;
1602 } else if (sendtype == MPI_DATATYPE_NULL
1603 || recvtype == MPI_DATATYPE_NULL) {
1604 retval = MPI_ERR_TYPE;
1606 size = smpi_comm_size(comm);
1607 sendsize = smpi_datatype_size(sendtype) * sendcount;
1608 if (sendsize < 200 && size > 12) {
1610 smpi_coll_tuned_alltoall_bruck(sendbuf, sendcount, sendtype,
1611 recvbuf, recvcount, recvtype,
1613 } else if (sendsize < 3000) {
1615 smpi_coll_tuned_alltoall_basic_linear(sendbuf, sendcount,
1617 recvcount, recvtype, comm);
1620 smpi_coll_tuned_alltoall_pairwise(sendbuf, sendcount, sendtype,
1621 recvbuf, recvcount, recvtype,
1626 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1632 MPI_CALL_IMPLEM(int, MPI_Alltoallv,
1633 (void *sendbuf, int *sendcounts, int *senddisps,
1634 MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
1635 int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm))
1641 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1642 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1644 if (comm == MPI_COMM_NULL) {
1645 retval = MPI_ERR_COMM;
1646 } else if (sendtype == MPI_DATATYPE_NULL
1647 || recvtype == MPI_DATATYPE_NULL) {
1648 retval = MPI_ERR_TYPE;
1649 } else if (sendcounts == NULL || senddisps == NULL || recvcounts == NULL
1650 || recvdisps == NULL) {
1651 retval = MPI_ERR_ARG;
1654 smpi_coll_basic_alltoallv(sendbuf, sendcounts, senddisps, sendtype,
1655 recvbuf, recvcounts, recvdisps, recvtype,
1659 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1666 MPI_CALL_IMPLEM(int, MPI_Get_processor_name, (char *name, int *resultlen))
1668 int retval = MPI_SUCCESS;
1671 strncpy(name, SIMIX_host_get_name(SIMIX_host_self()),
1672 MPI_MAX_PROCESSOR_NAME - 1);
1675 MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
1681 MPI_CALL_IMPLEM(int, MPI_Get_count, (MPI_Status * status, MPI_Datatype datatype, int *count))
1683 int retval = MPI_SUCCESS;
1687 if (status == NULL || count == NULL) {
1688 retval = MPI_ERR_ARG;
1689 } else if (datatype == MPI_DATATYPE_NULL) {
1690 retval = MPI_ERR_TYPE;
1692 size = smpi_datatype_size(datatype);
1695 } else if (status->count % size != 0) {
1696 retval = MPI_UNDEFINED;
1698 *count = smpi_mpi_get_count(status, datatype);
1705 /* The following calls are not yet implemented and will fail at runtime. */
1706 /* Once implemented, please move them above this notice. */
1708 static int not_yet_implemented(void) {
1709 xbt_die("Not yet implemented");
1710 return MPI_ERR_OTHER;
1713 MPI_CALL_IMPLEM(int, MPI_Pack_size, (int incount, MPI_Datatype datatype, MPI_Comm comm, int* size)) {
1714 return not_yet_implemented();
1717 MPI_CALL_IMPLEM(int, MPI_Cart_coords, (MPI_Comm comm, int rank, int maxdims, int* coords)) {
1718 return not_yet_implemented();
1721 MPI_CALL_IMPLEM(int, MPI_Cart_create, (MPI_Comm comm_old, int ndims, int* dims, int* periods, int reorder, MPI_Comm* comm_cart)) {
1722 return not_yet_implemented();
1725 MPI_CALL_IMPLEM(int, MPI_Cart_get, (MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords)) {
1726 return not_yet_implemented();
1729 MPI_CALL_IMPLEM(int, MPI_Cart_map, (MPI_Comm comm_old, int ndims, int* dims, int* periods, int* newrank)) {
1730 return not_yet_implemented();
1733 MPI_CALL_IMPLEM(int, MPI_Cart_rank, (MPI_Comm comm, int* coords, int* rank)) {
1734 return not_yet_implemented();
1737 MPI_CALL_IMPLEM(int, MPI_Cart_shift, (MPI_Comm comm, int direction, int displ, int* source, int* dest)) {
1738 return not_yet_implemented();
1741 MPI_CALL_IMPLEM(int, MPI_Cart_sub, (MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new)) {
1742 return not_yet_implemented();
1745 MPI_CALL_IMPLEM(int, MPI_Cartdim_get, (MPI_Comm comm, int* ndims)) {
1746 return not_yet_implemented();
1749 MPI_CALL_IMPLEM(int, MPI_Graph_create, (MPI_Comm comm_old, int nnodes, int* index, int* edges, int reorder, MPI_Comm* comm_graph)) {
1750 return not_yet_implemented();
1753 MPI_CALL_IMPLEM(int, MPI_Graph_get, (MPI_Comm comm, int maxindex, int maxedges, int* index, int* edges)) {
1754 return not_yet_implemented();
1757 MPI_CALL_IMPLEM(int, MPI_Graph_map, (MPI_Comm comm_old, int nnodes, int* index, int* edges, int* newrank)) {
1758 return not_yet_implemented();
1761 MPI_CALL_IMPLEM(int, MPI_Graph_neighbors, (MPI_Comm comm, int rank, int maxneighbors, int* neighbors)) {
1762 return not_yet_implemented();
1765 MPI_CALL_IMPLEM(int, MPI_Graph_neighbors_count, (MPI_Comm comm, int rank, int* nneighbors)) {
1766 return not_yet_implemented();
1769 MPI_CALL_IMPLEM(int, MPI_Graphdims_get, (MPI_Comm comm, int* nnodes, int* nedges)) {
1770 return not_yet_implemented();
1773 MPI_CALL_IMPLEM(int, MPI_Topo_test, (MPI_Comm comm, int* top_type)) {
1774 return not_yet_implemented();
1777 MPI_CALL_IMPLEM(int, MPI_Error_class, (int errorcode, int* errorclass)) {
1778 return not_yet_implemented();
1781 MPI_CALL_IMPLEM(int, MPI_Errhandler_create, (MPI_Handler_function* function, MPI_Errhandler* errhandler)) {
1782 return not_yet_implemented();
1785 MPI_CALL_IMPLEM(int, MPI_Errhandler_free, (MPI_Errhandler* errhandler)) {
1786 return not_yet_implemented();
1789 MPI_CALL_IMPLEM(int, MPI_Errhandler_get, (MPI_Comm comm, MPI_Errhandler* errhandler)) {
1790 return not_yet_implemented();
1793 MPI_CALL_IMPLEM(int, MPI_Error_string, (int errorcode, char* string, int* resultlen)) {
1794 return not_yet_implemented();
1797 MPI_CALL_IMPLEM(int, MPI_Errhandler_set, (MPI_Comm comm, MPI_Errhandler errhandler)) {
1798 return not_yet_implemented();
1801 MPI_CALL_IMPLEM(int, MPI_Type_contiguous, (int count, MPI_Datatype old_type, MPI_Datatype* newtype)) {
1802 return not_yet_implemented();
1805 MPI_CALL_IMPLEM(int, MPI_Cancel, (MPI_Request* request)) {
1806 return not_yet_implemented();
1809 MPI_CALL_IMPLEM(int, MPI_Buffer_attach, (void* buffer, int size)) {
1810 return not_yet_implemented();
1813 MPI_CALL_IMPLEM(int, MPI_Buffer_detach, (void* buffer, int* size)) {
1814 return not_yet_implemented();
1817 MPI_CALL_IMPLEM(int, MPI_Testsome, (int incount, MPI_Request* requests, int* outcount, int* indices, MPI_Status* statuses)) {
1818 return not_yet_implemented();
1821 MPI_CALL_IMPLEM(int, MPI_Comm_test_inter, (MPI_Comm comm, int* flag)) {
1822 return not_yet_implemented();
1825 MPI_CALL_IMPLEM(int, MPI_Unpack, (void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm)) {
1826 return not_yet_implemented();
1829 MPI_CALL_IMPLEM(int, MPI_Type_commit, (MPI_Datatype* datatype)) {
1830 return not_yet_implemented();
1833 MPI_CALL_IMPLEM(int, MPI_Type_hindexed, (int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype)) {
1834 return not_yet_implemented();
1837 MPI_CALL_IMPLEM(int, MPI_Type_hvector, (int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* newtype)) {
1838 return not_yet_implemented();
1841 MPI_CALL_IMPLEM(int, MPI_Type_indexed, (int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* newtype)) {
1842 return not_yet_implemented();
1845 MPI_CALL_IMPLEM(int, MPI_Type_struct, (int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype)) {
1846 return not_yet_implemented();
1849 MPI_CALL_IMPLEM(int, MPI_Type_vector, (int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* newtype)) {
1850 return not_yet_implemented();
1853 MPI_CALL_IMPLEM(int, MPI_Ssend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)) {
1854 return not_yet_implemented();
1857 MPI_CALL_IMPLEM(int, MPI_Ssend_init, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request)) {
1858 return not_yet_implemented();
1861 MPI_CALL_IMPLEM(int, MPI_Intercomm_create, (MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out)) {
1862 return not_yet_implemented();
1865 MPI_CALL_IMPLEM(int, MPI_Intercomm_merge, (MPI_Comm comm, int high, MPI_Comm* comm_out)) {
1866 return not_yet_implemented();
1869 MPI_CALL_IMPLEM(int, MPI_Bsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)) {
1870 return not_yet_implemented();
1873 MPI_CALL_IMPLEM(int, MPI_Bsend_init, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request)) {
1874 return not_yet_implemented();
1877 MPI_CALL_IMPLEM(int, MPI_Ibsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request)) {
1878 return not_yet_implemented();
1881 MPI_CALL_IMPLEM(int, MPI_Comm_remote_group, (MPI_Comm comm, MPI_Group* group)) {
1882 return not_yet_implemented();
1885 MPI_CALL_IMPLEM(int, MPI_Comm_remote_size, (MPI_Comm comm, int* size)) {
1886 return not_yet_implemented();
1889 MPI_CALL_IMPLEM(int, MPI_Issend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request)) {
1890 return not_yet_implemented();
1893 MPI_CALL_IMPLEM(int, MPI_Probe, (int source, int tag, MPI_Comm comm, MPI_Status* status)) {
1894 return not_yet_implemented();
1897 MPI_CALL_IMPLEM(int, MPI_Attr_delete, (MPI_Comm comm, int keyval)) {
1898 return not_yet_implemented();
1901 MPI_CALL_IMPLEM(int, MPI_Attr_get, (MPI_Comm comm, int keyval, void* attr_value, int* flag)) {
1902 return not_yet_implemented();
1905 MPI_CALL_IMPLEM(int, MPI_Attr_put, (MPI_Comm comm, int keyval, void* attr_value)) {
1906 return not_yet_implemented();
1909 MPI_CALL_IMPLEM(int, MPI_Rsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)) {
1910 return not_yet_implemented();
1913 MPI_CALL_IMPLEM(int, MPI_Rsend_init, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request)) {
1914 return not_yet_implemented();
1917 MPI_CALL_IMPLEM(int, MPI_Irsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request)) {
1918 return not_yet_implemented();
1921 MPI_CALL_IMPLEM(int, MPI_Keyval_create, (MPI_Copy_function* copy_fn, MPI_Delete_function* delete_fn, int* keyval, void* extra_state)) {
1922 return not_yet_implemented();
1925 MPI_CALL_IMPLEM(int, MPI_Keyval_free, (int* keyval)) {
1926 return not_yet_implemented();
1929 MPI_CALL_IMPLEM(int, MPI_Test_cancelled, (MPI_Status* status, int* flag)) {
1930 return not_yet_implemented();
1933 MPI_CALL_IMPLEM(int, MPI_Pack, (void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm)) {
1934 return not_yet_implemented();
1937 MPI_CALL_IMPLEM(int, MPI_Testall, (int count, MPI_Request* requests, int* flag, MPI_Status* statuses)) {
1938 return not_yet_implemented();
1941 MPI_CALL_IMPLEM(int, MPI_Get_elements, (MPI_Status* status, MPI_Datatype datatype, int* elements)) {
1942 return not_yet_implemented();
1945 MPI_CALL_IMPLEM(int, MPI_Dims_create, (int nnodes, int ndims, int* dims)) {
1946 return not_yet_implemented();
1949 MPI_CALL_IMPLEM(int, MPI_Iprobe, (int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status)) {
1950 return not_yet_implemented();
1953 MPI_CALL_IMPLEM(int, MPI_Initialized, (int* flag)) {
1954 return not_yet_implemented();