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_mpi_dt_private.h"
10 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi,
11 "Logging specific to SMPI (pmpi)");
14 //this function need to be here because of the calls to smpi_bench
15 void TRACE_smpi_set_category(const char *category)
17 //need to end bench otherwise categories for execution tasks are wrong
19 TRACE_internal_smpi_set_category (category);
20 //begin bench after changing process's category
25 /* PMPI User level calls */
27 int PMPI_Init(int *argc, char ***argv)
29 smpi_process_init(argc, argv);
31 int rank = smpi_process_index();
32 TRACE_smpi_init(rank);
34 TRACE_smpi_computing_init(rank);
40 int PMPI_Finalize(void)
42 smpi_process_finalize();
45 int rank = smpi_process_index();
46 TRACE_smpi_computing_out(rank);
47 TRACE_smpi_finalize(smpi_process_index());
49 smpi_process_destroy();
53 int PMPI_Init_thread(int *argc, char ***argv, int required, int *provided)
55 if (provided != NULL) {
56 *provided = MPI_THREAD_MULTIPLE;
58 return MPI_Init(argc, argv);
61 int PMPI_Query_thread(int *provided)
66 if (provided == NULL) {
69 *provided = MPI_THREAD_MULTIPLE;
76 int PMPI_Is_thread_main(int *flag)
84 *flag = smpi_process_index() == 0;
91 int PMPI_Abort(MPI_Comm comm, int errorcode)
94 smpi_process_destroy();
96 int rank = smpi_process_index();
97 TRACE_smpi_computing_out(rank);
99 // FIXME: should kill all processes in comm instead
100 simcall_process_kill(SIMIX_process_self());
104 double PMPI_Wtime(void)
109 time = SIMIX_get_clock();
114 int PMPI_Address(void *location, MPI_Aint * address)
120 retval = MPI_ERR_ARG;
122 *address = (MPI_Aint) location;
128 int PMPI_Type_free(MPI_Datatype * datatype)
134 retval = MPI_ERR_ARG;
136 // FIXME: always fail for now
137 retval = MPI_ERR_TYPE;
143 int PMPI_Type_size(MPI_Datatype datatype, int *size)
148 if (datatype == MPI_DATATYPE_NULL) {
149 retval = MPI_ERR_TYPE;
150 } else if (size == NULL) {
151 retval = MPI_ERR_ARG;
153 *size = (int) smpi_datatype_size(datatype);
154 retval = MPI_SUCCESS;
160 int PMPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent)
165 if (datatype == MPI_DATATYPE_NULL) {
166 retval = MPI_ERR_TYPE;
167 } else if (lb == NULL || extent == NULL) {
168 retval = MPI_ERR_ARG;
170 retval = smpi_datatype_extent(datatype, lb, extent);
176 int PMPI_Type_extent(MPI_Datatype datatype, MPI_Aint * extent)
182 if (datatype == MPI_DATATYPE_NULL) {
183 retval = MPI_ERR_TYPE;
184 } else if (extent == NULL) {
185 retval = MPI_ERR_ARG;
187 retval = smpi_datatype_extent(datatype, &dummy, extent);
193 int PMPI_Type_lb(MPI_Datatype datatype, MPI_Aint * disp)
198 if (datatype == MPI_DATATYPE_NULL) {
199 retval = MPI_ERR_TYPE;
200 } else if (disp == NULL) {
201 retval = MPI_ERR_ARG;
203 *disp = smpi_datatype_lb(datatype);
204 retval = MPI_SUCCESS;
210 int PMPI_Type_ub(MPI_Datatype datatype, MPI_Aint * disp)
215 if (datatype == MPI_DATATYPE_NULL) {
216 retval = MPI_ERR_TYPE;
217 } else if (disp == NULL) {
218 retval = MPI_ERR_ARG;
220 *disp = smpi_datatype_ub(datatype);
221 retval = MPI_SUCCESS;
227 int PMPI_Op_create(MPI_User_function * function, int commute, MPI_Op * op)
232 if (function == NULL || op == NULL) {
233 retval = MPI_ERR_ARG;
235 *op = smpi_op_new(function, commute);
236 retval = MPI_SUCCESS;
242 int PMPI_Op_free(MPI_Op * op)
248 retval = MPI_ERR_ARG;
249 } else if (*op == MPI_OP_NULL) {
252 smpi_op_destroy(*op);
254 retval = MPI_SUCCESS;
260 int PMPI_Group_free(MPI_Group * group)
266 retval = MPI_ERR_ARG;
268 smpi_group_destroy(*group);
269 *group = MPI_GROUP_NULL;
270 retval = MPI_SUCCESS;
276 int PMPI_Group_size(MPI_Group group, int *size)
281 if (group == MPI_GROUP_NULL) {
282 retval = MPI_ERR_GROUP;
283 } else if (size == NULL) {
284 retval = MPI_ERR_ARG;
286 *size = smpi_group_size(group);
287 retval = MPI_SUCCESS;
293 int PMPI_Group_rank(MPI_Group group, int *rank)
298 if (group == MPI_GROUP_NULL) {
299 retval = MPI_ERR_GROUP;
300 } else if (rank == NULL) {
301 retval = MPI_ERR_ARG;
303 *rank = smpi_group_rank(group, smpi_process_index());
304 retval = MPI_SUCCESS;
310 int PMPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
311 MPI_Group group2, int *ranks2)
313 int retval, i, index;
316 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
317 retval = MPI_ERR_GROUP;
319 for (i = 0; i < n; i++) {
320 index = smpi_group_index(group1, ranks1[i]);
321 ranks2[i] = smpi_group_rank(group2, index);
323 retval = MPI_SUCCESS;
329 int PMPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result)
334 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
335 retval = MPI_ERR_GROUP;
336 } else if (result == NULL) {
337 retval = MPI_ERR_ARG;
339 *result = smpi_group_compare(group1, group2);
340 retval = MPI_SUCCESS;
346 int PMPI_Group_union(MPI_Group group1, MPI_Group group2,
347 MPI_Group * newgroup)
349 int retval, i, proc1, proc2, size, size2;
352 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
353 retval = MPI_ERR_GROUP;
354 } else if (newgroup == NULL) {
355 retval = MPI_ERR_ARG;
357 size = smpi_group_size(group1);
358 size2 = smpi_group_size(group2);
359 for (i = 0; i < size2; i++) {
360 proc2 = smpi_group_index(group2, i);
361 proc1 = smpi_group_rank(group1, proc2);
362 if (proc1 == MPI_UNDEFINED) {
367 *newgroup = MPI_GROUP_EMPTY;
369 *newgroup = smpi_group_new(size);
370 size2 = smpi_group_size(group1);
371 for (i = 0; i < size2; i++) {
372 proc1 = smpi_group_index(group1, i);
373 smpi_group_set_mapping(*newgroup, proc1, i);
375 for (i = size2; i < size; i++) {
376 proc2 = smpi_group_index(group2, i - size2);
377 smpi_group_set_mapping(*newgroup, proc2, i);
380 smpi_group_use(*newgroup);
381 retval = MPI_SUCCESS;
387 int PMPI_Group_intersection(MPI_Group group1, MPI_Group group2,
388 MPI_Group * newgroup)
390 int retval, i, proc1, proc2, size, size2;
393 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
394 retval = MPI_ERR_GROUP;
395 } else if (newgroup == NULL) {
396 retval = MPI_ERR_ARG;
398 size = smpi_group_size(group1);
399 size2 = smpi_group_size(group2);
400 for (i = 0; i < size2; i++) {
401 proc2 = smpi_group_index(group2, i);
402 proc1 = smpi_group_rank(group1, proc2);
403 if (proc1 == MPI_UNDEFINED) {
408 *newgroup = MPI_GROUP_EMPTY;
410 *newgroup = smpi_group_new(size);
411 size2 = smpi_group_size(group1);
412 for (i = 0; i < size2; i++) {
413 proc1 = smpi_group_index(group1, i);
414 proc2 = smpi_group_rank(group2, proc1);
415 if (proc2 != MPI_UNDEFINED) {
416 smpi_group_set_mapping(*newgroup, proc1, i);
420 smpi_group_use(*newgroup);
421 retval = MPI_SUCCESS;
427 int PMPI_Group_difference(MPI_Group group1, MPI_Group group2, MPI_Group * newgroup)
429 int retval, i, proc1, proc2, size, size2;
432 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
433 retval = MPI_ERR_GROUP;
434 } else if (newgroup == NULL) {
435 retval = MPI_ERR_ARG;
437 size = size2 = smpi_group_size(group1);
438 for (i = 0; i < size2; i++) {
439 proc1 = smpi_group_index(group1, i);
440 proc2 = smpi_group_rank(group2, proc1);
441 if (proc2 != MPI_UNDEFINED) {
446 *newgroup = MPI_GROUP_EMPTY;
448 *newgroup = smpi_group_new(size);
449 for (i = 0; i < size2; i++) {
450 proc1 = smpi_group_index(group1, i);
451 proc2 = smpi_group_rank(group2, proc1);
452 if (proc2 == MPI_UNDEFINED) {
453 smpi_group_set_mapping(*newgroup, proc1, i);
457 smpi_group_use(*newgroup);
458 retval = MPI_SUCCESS;
464 int PMPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
466 int retval, i, index;
469 if (group == MPI_GROUP_NULL) {
470 retval = MPI_ERR_GROUP;
471 } else if (newgroup == NULL) {
472 retval = MPI_ERR_ARG;
475 *newgroup = MPI_GROUP_EMPTY;
476 } else if (n == smpi_group_size(group)) {
479 *newgroup = smpi_group_new(n);
480 for (i = 0; i < n; i++) {
481 index = smpi_group_index(group, ranks[i]);
482 smpi_group_set_mapping(*newgroup, index, i);
485 smpi_group_use(*newgroup);
486 retval = MPI_SUCCESS;
492 int PMPI_Group_excl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
494 int retval, i, size, rank, index;
497 if (group == MPI_GROUP_NULL) {
498 retval = MPI_ERR_GROUP;
499 } else if (newgroup == NULL) {
500 retval = MPI_ERR_ARG;
504 } else if (n == smpi_group_size(group)) {
505 *newgroup = MPI_GROUP_EMPTY;
507 size = smpi_group_size(group) - n;
508 *newgroup = smpi_group_new(size);
510 while (rank < size) {
511 for (i = 0; i < n; i++) {
512 if (ranks[i] == rank) {
517 index = smpi_group_index(group, rank);
518 smpi_group_set_mapping(*newgroup, index, rank);
523 smpi_group_use(*newgroup);
524 retval = MPI_SUCCESS;
530 int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
531 MPI_Group * newgroup)
533 int retval, i, j, rank, size, index;
536 if (group == MPI_GROUP_NULL) {
537 retval = MPI_ERR_GROUP;
538 } else if (newgroup == NULL) {
539 retval = MPI_ERR_ARG;
542 *newgroup = MPI_GROUP_EMPTY;
545 for (i = 0; i < n; i++) {
546 for (rank = ranges[i][0]; /* First */
547 rank >= 0 && rank <= ranges[i][1]; /* Last */
548 rank += ranges[i][2] /* Stride */ ) {
552 if (size == smpi_group_size(group)) {
555 *newgroup = smpi_group_new(size);
557 for (i = 0; i < n; i++) {
558 for (rank = ranges[i][0]; /* First */
559 rank >= 0 && rank <= ranges[i][1]; /* Last */
560 rank += ranges[i][2] /* Stride */ ) {
561 index = smpi_group_index(group, rank);
562 smpi_group_set_mapping(*newgroup, index, j);
568 smpi_group_use(*newgroup);
569 retval = MPI_SUCCESS;
575 int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
576 MPI_Group * newgroup)
578 int retval, i, newrank, rank, size, index, add;
581 if (group == MPI_GROUP_NULL) {
582 retval = MPI_ERR_GROUP;
583 } else if (newgroup == NULL) {
584 retval = MPI_ERR_ARG;
589 size = smpi_group_size(group);
590 for (i = 0; i < n; i++) {
591 for (rank = ranges[i][0]; /* First */
592 rank >= 0 && rank <= ranges[i][1]; /* Last */
593 rank += ranges[i][2] /* Stride */ ) {
598 *newgroup = MPI_GROUP_EMPTY;
600 *newgroup = smpi_group_new(size);
602 while (newrank < size) {
603 for (i = 0; i < n; i++) {
605 for (rank = ranges[i][0]; /* First */
606 rank >= 0 && rank <= ranges[i][1]; /* Last */
607 rank += ranges[i][2] /* Stride */ ) {
608 if (rank == newrank) {
614 index = smpi_group_index(group, newrank);
615 smpi_group_set_mapping(*newgroup, index, newrank);
621 smpi_group_use(*newgroup);
622 retval = MPI_SUCCESS;
628 int PMPI_Comm_rank(MPI_Comm comm, int *rank)
633 if (comm == MPI_COMM_NULL) {
634 retval = MPI_ERR_COMM;
635 } else if (rank == NULL) {
636 retval = MPI_ERR_ARG;
638 *rank = smpi_comm_rank(comm);
639 retval = MPI_SUCCESS;
645 int PMPI_Comm_size(MPI_Comm comm, int *size)
650 if (comm == MPI_COMM_NULL) {
651 retval = MPI_ERR_COMM;
652 } else if (size == NULL) {
653 retval = MPI_ERR_ARG;
655 *size = smpi_comm_size(comm);
656 retval = MPI_SUCCESS;
662 int PMPI_Comm_get_name (MPI_Comm comm, char* name, int* len)
667 if (comm == MPI_COMM_NULL) {
668 retval = MPI_ERR_COMM;
669 } else if (name == NULL || len == NULL) {
670 retval = MPI_ERR_ARG;
672 smpi_comm_get_name(comm, name, len);
673 retval = MPI_SUCCESS;
679 int PMPI_Comm_group(MPI_Comm comm, MPI_Group * group)
684 if (comm == MPI_COMM_NULL) {
685 retval = MPI_ERR_COMM;
686 } else if (group == NULL) {
687 retval = MPI_ERR_ARG;
689 *group = smpi_comm_group(comm);
690 retval = MPI_SUCCESS;
696 int PMPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result)
701 if (comm1 == MPI_COMM_NULL || comm2 == MPI_COMM_NULL) {
702 retval = MPI_ERR_COMM;
703 } else if (result == NULL) {
704 retval = MPI_ERR_ARG;
706 if (comm1 == comm2) { /* Same communicators means same groups */
710 smpi_group_compare(smpi_comm_group(comm1),
711 smpi_comm_group(comm2));
712 if (*result == MPI_IDENT) {
713 *result = MPI_CONGRUENT;
716 retval = MPI_SUCCESS;
722 int PMPI_Comm_dup(MPI_Comm comm, MPI_Comm * newcomm)
727 if (comm == MPI_COMM_NULL) {
728 retval = MPI_ERR_COMM;
729 } else if (newcomm == NULL) {
730 retval = MPI_ERR_ARG;
732 *newcomm = smpi_comm_new(smpi_comm_group(comm));
733 retval = MPI_SUCCESS;
739 int PMPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm)
744 if (comm == MPI_COMM_NULL) {
745 retval = MPI_ERR_COMM;
746 } else if (group == MPI_GROUP_NULL) {
747 retval = MPI_ERR_GROUP;
748 } else if (newcomm == NULL) {
749 retval = MPI_ERR_ARG;
751 *newcomm = smpi_comm_new(group);
752 retval = MPI_SUCCESS;
758 int PMPI_Comm_free(MPI_Comm * comm)
764 retval = MPI_ERR_ARG;
765 } else if (*comm == MPI_COMM_NULL) {
766 retval = MPI_ERR_COMM;
768 smpi_comm_destroy(*comm);
769 *comm = MPI_COMM_NULL;
770 retval = MPI_SUCCESS;
776 int PMPI_Comm_disconnect(MPI_Comm * comm)
778 /* TODO: wait until all communication in comm are done */
783 retval = MPI_ERR_ARG;
784 } else if (*comm == MPI_COMM_NULL) {
785 retval = MPI_ERR_COMM;
787 smpi_comm_destroy(*comm);
788 *comm = MPI_COMM_NULL;
789 retval = MPI_SUCCESS;
795 int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out)
800 if (comm_out == NULL) {
801 retval = MPI_ERR_ARG;
802 } else if (comm == MPI_COMM_NULL) {
803 retval = MPI_ERR_COMM;
805 *comm_out = smpi_comm_split(comm, color, key);
806 retval = MPI_SUCCESS;
812 int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst,
813 int tag, MPI_Comm comm, MPI_Request * request)
818 if (request == NULL) {
819 retval = MPI_ERR_ARG;
820 } else if (comm == MPI_COMM_NULL) {
821 retval = MPI_ERR_COMM;
823 *request = smpi_mpi_send_init(buf, count, datatype, dst, tag, comm);
824 retval = MPI_SUCCESS;
830 int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src,
831 int tag, MPI_Comm comm, MPI_Request * request)
836 if (request == NULL) {
837 retval = MPI_ERR_ARG;
838 } else if (comm == MPI_COMM_NULL) {
839 retval = MPI_ERR_COMM;
841 *request = smpi_mpi_recv_init(buf, count, datatype, src, tag, comm);
842 retval = MPI_SUCCESS;
848 int PMPI_Start(MPI_Request * request)
853 if (request == NULL) {
854 retval = MPI_ERR_ARG;
856 smpi_mpi_start(*request);
857 retval = MPI_SUCCESS;
863 int PMPI_Startall(int count, MPI_Request * requests)
868 if (requests == NULL) {
869 retval = MPI_ERR_ARG;
871 smpi_mpi_startall(count, requests);
872 retval = MPI_SUCCESS;
878 int PMPI_Request_free(MPI_Request * request)
883 if (request == NULL) {
884 retval = MPI_ERR_ARG;
886 smpi_mpi_request_free(request);
887 retval = MPI_SUCCESS;
893 int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
894 int tag, MPI_Comm comm, MPI_Request * request)
900 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
901 int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
902 TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
904 if (request == NULL) {
905 retval = MPI_ERR_ARG;
906 } else if (comm == MPI_COMM_NULL) {
907 retval = MPI_ERR_COMM;
909 *request = smpi_mpi_irecv(buf, count, datatype, src, tag, comm);
910 retval = MPI_SUCCESS;
913 TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
914 (*request)->recv = 1;
920 int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst,
921 int tag, MPI_Comm comm, MPI_Request * request)
927 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
928 TRACE_smpi_computing_out(rank);
929 int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
930 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
931 TRACE_smpi_send(rank, rank, dst_traced);
933 if (request == NULL) {
934 retval = MPI_ERR_ARG;
935 } else if (comm == MPI_COMM_NULL) {
936 retval = MPI_ERR_COMM;
938 *request = smpi_mpi_isend(buf, count, datatype, dst, tag, comm);
939 retval = MPI_SUCCESS;
942 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
943 (*request)->send = 1;
944 TRACE_smpi_computing_in(rank);
950 int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag,
951 MPI_Comm comm, MPI_Status * status)
957 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
958 int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
959 TRACE_smpi_computing_out(rank);
961 TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
963 if (comm == MPI_COMM_NULL) {
964 retval = MPI_ERR_COMM;
966 smpi_mpi_recv(buf, count, datatype, src, tag, comm, status);
967 retval = MPI_SUCCESS;
970 TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
971 TRACE_smpi_recv(rank, src_traced, rank);
972 TRACE_smpi_computing_in(rank);
978 int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
985 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
986 TRACE_smpi_computing_out(rank);
987 int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
988 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
989 TRACE_smpi_send(rank, rank, dst_traced);
991 if (comm == MPI_COMM_NULL) {
992 retval = MPI_ERR_COMM;
994 smpi_mpi_send(buf, count, datatype, dst, tag, comm);
995 retval = MPI_SUCCESS;
998 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
999 TRACE_smpi_computing_in(rank);
1005 int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1006 int dst, int sendtag, void *recvbuf, int recvcount,
1007 MPI_Datatype recvtype, int src, int recvtag,
1008 MPI_Comm comm, MPI_Status * status)
1014 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1015 TRACE_smpi_computing_out(rank);
1016 int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
1017 int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
1018 TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
1019 TRACE_smpi_send(rank, rank, dst_traced);
1020 TRACE_smpi_send(rank, src_traced, rank);
1022 if (comm == MPI_COMM_NULL) {
1023 retval = MPI_ERR_COMM;
1024 } else if (sendtype == MPI_DATATYPE_NULL
1025 || recvtype == MPI_DATATYPE_NULL) {
1026 retval = MPI_ERR_TYPE;
1028 smpi_mpi_sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf,
1029 recvcount, recvtype, src, recvtag, comm, status);
1030 retval = MPI_SUCCESS;
1033 TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
1034 TRACE_smpi_recv(rank, rank, dst_traced);
1035 TRACE_smpi_recv(rank, src_traced, rank);
1036 TRACE_smpi_computing_in(rank);
1043 int PMPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
1044 int dst, int sendtag, int src, int recvtag,
1045 MPI_Comm comm, MPI_Status * status)
1047 //TODO: suboptimal implementation
1051 size = smpi_datatype_size(datatype) * count;
1052 recvbuf = xbt_new(char, size);
1054 MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count,
1055 datatype, src, recvtag, comm, status);
1056 memcpy(buf, recvbuf, size * sizeof(char));
1061 int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
1066 if (request == NULL || flag == NULL) {
1067 retval = MPI_ERR_ARG;
1068 } else if (*request == MPI_REQUEST_NULL) {
1069 retval = MPI_ERR_REQUEST;
1071 *flag = smpi_mpi_test(request, status);
1072 retval = MPI_SUCCESS;
1078 int PMPI_Testany(int count, MPI_Request requests[], int *index, int *flag,
1079 MPI_Status * status)
1084 if (index == NULL || flag == NULL) {
1085 retval = MPI_ERR_ARG;
1087 *flag = smpi_mpi_testany(count, requests, index, status);
1088 retval = MPI_SUCCESS;
1094 int PMPI_Wait(MPI_Request * request, MPI_Status * status)
1100 int rank = request && (*request)->comm != MPI_COMM_NULL
1101 ? smpi_comm_rank((*request)->comm)
1103 TRACE_smpi_computing_out(rank);
1105 MPI_Group group = smpi_comm_group((*request)->comm);
1106 int src_traced = smpi_group_rank(group, (*request)->src);
1107 int dst_traced = smpi_group_rank(group, (*request)->dst);
1108 int is_wait_for_receive = (*request)->recv;
1109 TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
1111 if (request == NULL) {
1112 retval = MPI_ERR_ARG;
1113 } else if (*request == MPI_REQUEST_NULL) {
1114 retval = MPI_ERR_REQUEST;
1116 smpi_mpi_wait(request, status);
1117 retval = MPI_SUCCESS;
1120 TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
1121 if (is_wait_for_receive) {
1122 TRACE_smpi_recv(rank, src_traced, dst_traced);
1124 TRACE_smpi_computing_in(rank);
1131 int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * status)
1137 //save requests information for tracing
1139 xbt_dynar_t srcs = xbt_dynar_new(sizeof(int), NULL);
1140 xbt_dynar_t dsts = xbt_dynar_new(sizeof(int), NULL);
1141 xbt_dynar_t recvs = xbt_dynar_new(sizeof(int), NULL);
1142 for (i = 0; i < count; i++) {
1143 MPI_Request req = requests[i]; //already received requests are no longer valid
1145 int *asrc = xbt_new(int, 1);
1146 int *adst = xbt_new(int, 1);
1147 int *arecv = xbt_new(int, 1);
1151 xbt_dynar_insert_at(srcs, i, asrc);
1152 xbt_dynar_insert_at(dsts, i, adst);
1153 xbt_dynar_insert_at(recvs, i, arecv);
1158 int *t = xbt_new(int, 1);
1159 xbt_dynar_insert_at(srcs, i, t);
1160 xbt_dynar_insert_at(dsts, i, t);
1161 xbt_dynar_insert_at(recvs, i, t);
1165 int rank_traced = smpi_comm_rank(MPI_COMM_WORLD);
1166 TRACE_smpi_computing_out(rank_traced);
1168 TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
1171 if (index == NULL) {
1172 retval = MPI_ERR_ARG;
1174 *index = smpi_mpi_waitany(count, requests, status);
1175 retval = MPI_SUCCESS;
1178 int src_traced, dst_traced, is_wait_for_receive;
1179 xbt_dynar_get_cpy(srcs, *index, &src_traced);
1180 xbt_dynar_get_cpy(dsts, *index, &dst_traced);
1181 xbt_dynar_get_cpy(recvs, *index, &is_wait_for_receive);
1182 if (is_wait_for_receive) {
1183 TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
1185 TRACE_smpi_ptp_out(rank_traced, src_traced, dst_traced, __FUNCTION__);
1186 //clean-up of dynars
1187 xbt_dynar_free(&srcs);
1188 xbt_dynar_free(&dsts);
1189 xbt_dynar_free(&recvs);
1190 TRACE_smpi_computing_in(rank_traced);
1197 int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
1202 //save information from requests
1204 xbt_dynar_t srcs = xbt_dynar_new(sizeof(int), NULL);
1205 xbt_dynar_t dsts = xbt_dynar_new(sizeof(int), NULL);
1206 xbt_dynar_t recvs = xbt_dynar_new(sizeof(int), NULL);
1207 for (i = 0; i < count; i++) {
1208 MPI_Request req = requests[i]; //all req should be valid in Waitall
1209 int *asrc = xbt_new(int, 1);
1210 int *adst = xbt_new(int, 1);
1211 int *arecv = xbt_new(int, 1);
1215 xbt_dynar_insert_at(srcs, i, asrc);
1216 xbt_dynar_insert_at(dsts, i, adst);
1217 xbt_dynar_insert_at(recvs, i, arecv);
1222 int rank_traced = smpi_comm_rank (MPI_COMM_WORLD);
1223 TRACE_smpi_computing_out(rank_traced);
1225 TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
1227 smpi_mpi_waitall(count, requests, status);
1229 for (i = 0; i < count; i++) {
1230 int src_traced, dst_traced, is_wait_for_receive;
1231 xbt_dynar_get_cpy(srcs, i, &src_traced);
1232 xbt_dynar_get_cpy(dsts, i, &dst_traced);
1233 xbt_dynar_get_cpy(recvs, i, &is_wait_for_receive);
1234 if (is_wait_for_receive) {
1235 TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
1238 TRACE_smpi_ptp_out(rank_traced, -1, -1, __FUNCTION__);
1239 //clean-up of dynars
1240 xbt_dynar_free(&srcs);
1241 xbt_dynar_free(&dsts);
1242 xbt_dynar_free(&recvs);
1243 TRACE_smpi_computing_in(rank_traced);
1249 int PMPI_Waitsome(int incount, MPI_Request requests[], int *outcount,
1250 int *indices, MPI_Status status[])
1255 if (outcount == NULL || indices == NULL) {
1256 retval = MPI_ERR_ARG;
1258 *outcount = smpi_mpi_waitsome(incount, requests, indices, status);
1259 retval = MPI_SUCCESS;
1265 int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
1271 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1272 TRACE_smpi_computing_out(rank);
1273 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1274 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1276 if (comm == MPI_COMM_NULL) {
1277 retval = MPI_ERR_COMM;
1279 smpi_mpi_bcast(buf, count, datatype, root, comm);
1280 retval = MPI_SUCCESS;
1283 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1284 TRACE_smpi_computing_in(rank);
1290 int PMPI_Barrier(MPI_Comm comm)
1296 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1297 TRACE_smpi_computing_out(rank);
1298 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1300 if (comm == MPI_COMM_NULL) {
1301 retval = MPI_ERR_COMM;
1303 smpi_mpi_barrier(comm);
1304 retval = MPI_SUCCESS;
1307 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1308 TRACE_smpi_computing_in(rank);
1314 int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1315 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1316 int root, MPI_Comm comm)
1322 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1323 TRACE_smpi_computing_out(rank);
1324 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1325 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1327 if (comm == MPI_COMM_NULL) {
1328 retval = MPI_ERR_COMM;
1329 } else if (sendtype == MPI_DATATYPE_NULL
1330 || recvtype == MPI_DATATYPE_NULL) {
1331 retval = MPI_ERR_TYPE;
1333 smpi_mpi_gather(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1334 recvtype, root, comm);
1335 retval = MPI_SUCCESS;
1338 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1339 TRACE_smpi_computing_in(rank);
1345 int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1346 void *recvbuf, int *recvcounts, int *displs,
1347 MPI_Datatype recvtype, int root, MPI_Comm comm)
1353 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1354 TRACE_smpi_computing_out(rank);
1355 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1356 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1358 if (comm == MPI_COMM_NULL) {
1359 retval = MPI_ERR_COMM;
1360 } else if (sendtype == MPI_DATATYPE_NULL
1361 || recvtype == MPI_DATATYPE_NULL) {
1362 retval = MPI_ERR_TYPE;
1363 } else if (recvcounts == NULL || displs == NULL) {
1364 retval = MPI_ERR_ARG;
1366 smpi_mpi_gatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
1367 displs, recvtype, root, comm);
1368 retval = MPI_SUCCESS;
1371 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1372 TRACE_smpi_computing_in(rank);
1378 int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1379 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1386 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1387 TRACE_smpi_computing_out(rank);
1388 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1390 if (comm == MPI_COMM_NULL) {
1391 retval = MPI_ERR_COMM;
1392 } else if (sendtype == MPI_DATATYPE_NULL
1393 || recvtype == MPI_DATATYPE_NULL) {
1394 retval = MPI_ERR_TYPE;
1396 smpi_mpi_allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1398 retval = MPI_SUCCESS;
1401 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1407 int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1408 void *recvbuf, int *recvcounts, int *displs,
1409 MPI_Datatype recvtype, MPI_Comm comm)
1415 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1416 TRACE_smpi_computing_out(rank);
1417 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1419 if (comm == MPI_COMM_NULL) {
1420 retval = MPI_ERR_COMM;
1421 } else if (sendtype == MPI_DATATYPE_NULL
1422 || recvtype == MPI_DATATYPE_NULL) {
1423 retval = MPI_ERR_TYPE;
1424 } else if (recvcounts == NULL || displs == NULL) {
1425 retval = MPI_ERR_ARG;
1427 smpi_mpi_allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
1428 displs, recvtype, comm);
1429 retval = MPI_SUCCESS;
1432 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1433 TRACE_smpi_computing_in(rank);
1439 int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1440 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1441 int root, MPI_Comm comm)
1447 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1448 TRACE_smpi_computing_out(rank);
1449 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1450 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1452 if (comm == MPI_COMM_NULL) {
1453 retval = MPI_ERR_COMM;
1454 } else if (sendtype == MPI_DATATYPE_NULL
1455 || recvtype == MPI_DATATYPE_NULL) {
1456 retval = MPI_ERR_TYPE;
1458 smpi_mpi_scatter(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1459 recvtype, root, comm);
1460 retval = MPI_SUCCESS;
1463 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1464 TRACE_smpi_computing_in(rank);
1470 int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
1471 MPI_Datatype sendtype, void *recvbuf, int recvcount,
1472 MPI_Datatype recvtype, int root, MPI_Comm comm)
1478 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1479 TRACE_smpi_computing_out(rank);
1480 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1481 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1483 if (comm == MPI_COMM_NULL) {
1484 retval = MPI_ERR_COMM;
1485 } else if (sendtype == MPI_DATATYPE_NULL
1486 || recvtype == MPI_DATATYPE_NULL) {
1487 retval = MPI_ERR_TYPE;
1488 } else if (sendcounts == NULL || displs == NULL) {
1489 retval = MPI_ERR_ARG;
1491 smpi_mpi_scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf,
1492 recvcount, recvtype, root, comm);
1493 retval = MPI_SUCCESS;
1496 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1497 TRACE_smpi_computing_in(rank);
1503 int PMPI_Reduce(void *sendbuf, void *recvbuf, int count,
1504 MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
1510 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1511 TRACE_smpi_computing_out(rank);
1512 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1513 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1515 if (comm == MPI_COMM_NULL) {
1516 retval = MPI_ERR_COMM;
1517 } else if (datatype == MPI_DATATYPE_NULL || op == MPI_OP_NULL) {
1518 retval = MPI_ERR_ARG;
1520 smpi_mpi_reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
1521 retval = MPI_SUCCESS;
1524 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1525 TRACE_smpi_computing_in(rank);
1531 int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count,
1532 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1538 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1539 TRACE_smpi_computing_out(rank);
1540 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1542 if (comm == MPI_COMM_NULL) {
1543 retval = MPI_ERR_COMM;
1544 } else if (datatype == MPI_DATATYPE_NULL) {
1545 retval = MPI_ERR_TYPE;
1546 } else if (op == MPI_OP_NULL) {
1547 retval = MPI_ERR_OP;
1549 smpi_mpi_allreduce(sendbuf, recvbuf, count, datatype, op, comm);
1550 retval = MPI_SUCCESS;
1553 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1554 TRACE_smpi_computing_in(rank);
1560 int PMPI_Scan(void *sendbuf, void *recvbuf, int count,
1561 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1567 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1568 TRACE_smpi_computing_out(rank);
1569 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1571 if (comm == MPI_COMM_NULL) {
1572 retval = MPI_ERR_COMM;
1573 } else if (datatype == MPI_DATATYPE_NULL) {
1574 retval = MPI_ERR_TYPE;
1575 } else if (op == MPI_OP_NULL) {
1576 retval = MPI_ERR_OP;
1578 smpi_mpi_scan(sendbuf, recvbuf, count, datatype, op, comm);
1579 retval = MPI_SUCCESS;
1582 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1583 TRACE_smpi_computing_in(rank);
1589 int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
1590 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1592 int retval, i, size, count;
1594 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1598 TRACE_smpi_computing_out(rank);
1599 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1601 if (comm == MPI_COMM_NULL) {
1602 retval = MPI_ERR_COMM;
1603 } else if (datatype == MPI_DATATYPE_NULL) {
1604 retval = MPI_ERR_TYPE;
1605 } else if (op == MPI_OP_NULL) {
1606 retval = MPI_ERR_OP;
1607 } else if (recvcounts == NULL) {
1608 retval = MPI_ERR_ARG;
1610 /* arbitrarily choose root as rank 0 */
1611 /* TODO: faster direct implementation ? */
1612 size = smpi_comm_size(comm);
1614 displs = xbt_new(int, size);
1615 for (i = 0; i < size; i++) {
1616 count += recvcounts[i];
1619 smpi_mpi_reduce(sendbuf, recvbuf, count, datatype, op, 0, comm);
1620 smpi_mpi_scatterv(recvbuf, recvcounts, displs, datatype, recvbuf,
1621 recvcounts[rank], datatype, 0, comm);
1623 retval = MPI_SUCCESS;
1626 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1627 TRACE_smpi_computing_in(rank);
1633 int PMPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1634 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1637 int retval, size, sendsize;
1641 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1642 TRACE_smpi_computing_out(rank);
1643 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1645 if (comm == MPI_COMM_NULL) {
1646 retval = MPI_ERR_COMM;
1647 } else if (sendtype == MPI_DATATYPE_NULL
1648 || recvtype == MPI_DATATYPE_NULL) {
1649 retval = MPI_ERR_TYPE;
1651 size = smpi_comm_size(comm);
1652 sendsize = smpi_datatype_size(sendtype) * sendcount;
1653 if (sendsize < 200 && size > 12) {
1655 smpi_coll_tuned_alltoall_bruck(sendbuf, sendcount, sendtype,
1656 recvbuf, recvcount, recvtype,
1658 } else if (sendsize < 3000) {
1660 smpi_coll_tuned_alltoall_basic_linear(sendbuf, sendcount,
1662 recvcount, recvtype, comm);
1665 smpi_coll_tuned_alltoall_pairwise(sendbuf, sendcount, sendtype,
1666 recvbuf, recvcount, recvtype,
1671 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1672 TRACE_smpi_computing_in(rank);
1678 int PMPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
1679 MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
1680 int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm)
1686 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1687 TRACE_smpi_computing_out(rank);
1688 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1690 if (comm == MPI_COMM_NULL) {
1691 retval = MPI_ERR_COMM;
1692 } else if (sendtype == MPI_DATATYPE_NULL
1693 || recvtype == MPI_DATATYPE_NULL) {
1694 retval = MPI_ERR_TYPE;
1695 } else if (sendcounts == NULL || senddisps == NULL || recvcounts == NULL
1696 || recvdisps == NULL) {
1697 retval = MPI_ERR_ARG;
1700 smpi_coll_basic_alltoallv(sendbuf, sendcounts, senddisps, sendtype,
1701 recvbuf, recvcounts, recvdisps, recvtype,
1705 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1706 TRACE_smpi_computing_in(rank);
1713 int PMPI_Get_processor_name(char *name, int *resultlen)
1715 int retval = MPI_SUCCESS;
1718 strncpy(name, SIMIX_host_get_name(SIMIX_host_self()),
1719 MPI_MAX_PROCESSOR_NAME - 1);
1722 MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
1728 int PMPI_Get_count(MPI_Status * status, MPI_Datatype datatype, int *count)
1730 int retval = MPI_SUCCESS;
1734 if (status == NULL || count == NULL) {
1735 retval = MPI_ERR_ARG;
1736 } else if (datatype == MPI_DATATYPE_NULL) {
1737 retval = MPI_ERR_TYPE;
1739 size = smpi_datatype_size(datatype);
1742 } else if (status->count % size != 0) {
1743 retval = MPI_UNDEFINED;
1745 *count = smpi_mpi_get_count(status, datatype);
1752 /* The following calls are not yet implemented and will fail at runtime. */
1753 /* Once implemented, please move them above this notice. */
1755 static int not_yet_implemented(void) {
1756 xbt_die("Not yet implemented");
1757 return MPI_ERR_OTHER;
1760 int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
1761 return not_yet_implemented();
1764 int PMPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int* coords) {
1765 return not_yet_implemented();
1768 int PMPI_Cart_create(MPI_Comm comm_old, int ndims, int* dims, int* periods, int reorder, MPI_Comm* comm_cart) {
1769 return not_yet_implemented();
1772 int PMPI_Cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords) {
1773 return not_yet_implemented();
1776 int PMPI_Cart_map(MPI_Comm comm_old, int ndims, int* dims, int* periods, int* newrank) {
1777 return not_yet_implemented();
1780 int PMPI_Cart_rank(MPI_Comm comm, int* coords, int* rank) {
1781 return not_yet_implemented();
1784 int PMPI_Cart_shift(MPI_Comm comm, int direction, int displ, int* source, int* dest) {
1785 return not_yet_implemented();
1788 int PMPI_Cart_sub(MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new) {
1789 return not_yet_implemented();
1792 int PMPI_Cartdim_get(MPI_Comm comm, int* ndims) {
1793 return not_yet_implemented();
1796 int PMPI_Graph_create(MPI_Comm comm_old, int nnodes, int* index, int* edges, int reorder, MPI_Comm* comm_graph) {
1797 return not_yet_implemented();
1800 int PMPI_Graph_get(MPI_Comm comm, int maxindex, int maxedges, int* index, int* edges) {
1801 return not_yet_implemented();
1804 int PMPI_Graph_map(MPI_Comm comm_old, int nnodes, int* index, int* edges, int* newrank) {
1805 return not_yet_implemented();
1808 int PMPI_Graph_neighbors(MPI_Comm comm, int rank, int maxneighbors, int* neighbors) {
1809 return not_yet_implemented();
1812 int PMPI_Graph_neighbors_count(MPI_Comm comm, int rank, int* nneighbors) {
1813 return not_yet_implemented();
1816 int PMPI_Graphdims_get(MPI_Comm comm, int* nnodes, int* nedges) {
1817 return not_yet_implemented();
1820 int PMPI_Topo_test(MPI_Comm comm, int* top_type) {
1821 return not_yet_implemented();
1824 int PMPI_Error_class(int errorcode, int* errorclass) {
1825 return not_yet_implemented();
1828 int PMPI_Errhandler_create(MPI_Handler_function* function, MPI_Errhandler* errhandler) {
1829 return not_yet_implemented();
1832 int PMPI_Errhandler_free(MPI_Errhandler* errhandler) {
1833 return not_yet_implemented();
1836 int PMPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler* errhandler) {
1837 return not_yet_implemented();
1840 int PMPI_Error_string(int errorcode, char* string, int* resultlen) {
1841 return not_yet_implemented();
1844 int PMPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler) {
1845 return not_yet_implemented();
1848 int PMPI_Type_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* newtype) {
1849 return not_yet_implemented();
1852 int PMPI_Cancel(MPI_Request* request) {
1853 return not_yet_implemented();
1856 int PMPI_Buffer_attach(void* buffer, int size) {
1857 return not_yet_implemented();
1860 int PMPI_Buffer_detach(void* buffer, int* size) {
1861 return not_yet_implemented();
1864 int PMPI_Testsome(int incount, MPI_Request* requests, int* outcount, int* indices, MPI_Status* statuses) {
1865 return not_yet_implemented();
1868 int PMPI_Comm_test_inter(MPI_Comm comm, int* flag) {
1869 return not_yet_implemented();
1872 int PMPI_Unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
1873 return not_yet_implemented();
1876 int PMPI_Type_commit(MPI_Datatype* datatype) {
1877 return not_yet_implemented();
1880 int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype) {
1881 return not_yet_implemented();
1884 int PMPI_Type_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* newtype) {
1885 return not_yet_implemented();
1888 int PMPI_Type_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* newtype) {
1889 return not_yet_implemented();
1892 int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype) {
1893 return not_yet_implemented();
1896 int PMPI_Type_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* newtype) {
1897 return not_yet_implemented();
1900 int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
1901 return not_yet_implemented();
1904 int PMPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
1905 return not_yet_implemented();
1908 int PMPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out) {
1909 return not_yet_implemented();
1912 int PMPI_Intercomm_merge(MPI_Comm comm, int high, MPI_Comm* comm_out) {
1913 return not_yet_implemented();
1916 int PMPI_Bsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
1917 return not_yet_implemented();
1920 int PMPI_Bsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
1921 return not_yet_implemented();
1924 int PMPI_Ibsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
1925 return not_yet_implemented();
1928 int PMPI_Comm_remote_group(MPI_Comm comm, MPI_Group* group) {
1929 return not_yet_implemented();
1932 int PMPI_Comm_remote_size(MPI_Comm comm, int* size) {
1933 return not_yet_implemented();
1936 int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
1937 return not_yet_implemented();
1940 int PMPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status* status) {
1941 return not_yet_implemented();
1944 int PMPI_Attr_delete(MPI_Comm comm, int keyval) {
1945 return not_yet_implemented();
1948 int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) {
1949 return not_yet_implemented();
1952 int PMPI_Attr_put(MPI_Comm comm, int keyval, void* attr_value) {
1953 return not_yet_implemented();
1956 int PMPI_Rsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
1957 return not_yet_implemented();
1960 int PMPI_Rsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
1961 return not_yet_implemented();
1964 int PMPI_Irsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
1965 return not_yet_implemented();
1968 int PMPI_Keyval_create(MPI_Copy_function* copy_fn, MPI_Delete_function* delete_fn, int* keyval, void* extra_state) {
1969 return not_yet_implemented();
1972 int PMPI_Keyval_free(int* keyval) {
1973 return not_yet_implemented();
1976 int PMPI_Test_cancelled(MPI_Status* status, int* flag) {
1977 return not_yet_implemented();
1980 int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
1981 return not_yet_implemented();
1984 int PMPI_Testall(int count, MPI_Request* requests, int* flag, MPI_Status* statuses) {
1985 return not_yet_implemented();
1988 int PMPI_Get_elements(MPI_Status* status, MPI_Datatype datatype, int* elements) {
1989 return not_yet_implemented();
1992 int PMPI_Dims_create(int nnodes, int ndims, int* dims) {
1993 return not_yet_implemented();
1996 int PMPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status) {
1997 return not_yet_implemented();
2000 int PMPI_Initialized(int* flag) {
2001 return not_yet_implemented();