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_Finalized(int* flag)
55 *flag=smpi_process_finalized();
59 int PMPI_Get_version (int *version,int *subversion){
60 *version = MPI_VERSION;
61 *subversion= MPI_SUBVERSION;
65 int PMPI_Get_library_version (char *version,int *len){
66 int retval = MPI_SUCCESS;
68 snprintf(version,MPI_MAX_LIBRARY_VERSION_STRING,"SMPI Version %d.%d. Copyright The Simgrid Team 2007-2013",SIMGRID_VERSION_MAJOR,
69 SIMGRID_VERSION_MINOR);
70 *len = strlen(version) > MPI_MAX_LIBRARY_VERSION_STRING ? MPI_MAX_LIBRARY_VERSION_STRING : strlen(version);
75 int PMPI_Init_thread(int *argc, char ***argv, int required, int *provided)
77 if (provided != NULL) {
78 *provided = MPI_THREAD_MULTIPLE;
80 return MPI_Init(argc, argv);
83 int PMPI_Query_thread(int *provided)
88 if (provided == NULL) {
91 *provided = MPI_THREAD_MULTIPLE;
98 int PMPI_Is_thread_main(int *flag)
104 retval = MPI_ERR_ARG;
106 *flag = smpi_process_index() == 0;
107 retval = MPI_SUCCESS;
113 int PMPI_Abort(MPI_Comm comm, int errorcode)
116 smpi_process_destroy();
118 int rank = smpi_process_index();
119 TRACE_smpi_computing_out(rank);
121 // FIXME: should kill all processes in comm instead
122 simcall_process_kill(SIMIX_process_self());
126 double PMPI_Wtime(void)
131 time = SIMIX_get_clock();
135 extern double sg_maxmin_precision;
136 double PMPI_Wtick(void)
138 return sg_maxmin_precision;
141 int PMPI_Address(void *location, MPI_Aint * address)
147 retval = MPI_ERR_ARG;
149 *address = (MPI_Aint) location;
150 retval = MPI_SUCCESS;
156 int PMPI_Get_address(void *location, MPI_Aint * address)
158 return PMPI_Address(location, address);
161 int PMPI_Type_free(MPI_Datatype * datatype)
167 retval = MPI_ERR_ARG;
169 smpi_datatype_free(datatype);
170 retval = MPI_SUCCESS;
176 int PMPI_Type_size(MPI_Datatype datatype, int *size)
181 if (datatype == MPI_DATATYPE_NULL) {
182 retval = MPI_ERR_TYPE;
183 } else if (size == NULL) {
184 retval = MPI_ERR_ARG;
186 *size = (int) smpi_datatype_size(datatype);
187 retval = MPI_SUCCESS;
193 int PMPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent)
198 if (datatype == MPI_DATATYPE_NULL) {
199 retval = MPI_ERR_TYPE;
200 } else if (lb == NULL || extent == NULL) {
201 retval = MPI_ERR_ARG;
203 retval = smpi_datatype_extent(datatype, lb, extent);
209 int PMPI_Type_get_true_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent)
211 return PMPI_Type_get_extent(datatype, lb, extent);
214 int PMPI_Type_extent(MPI_Datatype datatype, MPI_Aint * extent)
219 if (datatype == MPI_DATATYPE_NULL) {
220 retval = MPI_ERR_TYPE;
221 } else if (extent == NULL) {
222 retval = MPI_ERR_ARG;
224 *extent = smpi_datatype_get_extent(datatype);
225 retval = MPI_SUCCESS;
231 int PMPI_Type_lb(MPI_Datatype datatype, MPI_Aint * disp)
236 if (datatype == MPI_DATATYPE_NULL) {
237 retval = MPI_ERR_TYPE;
238 } else if (disp == NULL) {
239 retval = MPI_ERR_ARG;
241 *disp = smpi_datatype_lb(datatype);
242 retval = MPI_SUCCESS;
248 int PMPI_Type_ub(MPI_Datatype datatype, MPI_Aint * disp)
253 if (datatype == MPI_DATATYPE_NULL) {
254 retval = MPI_ERR_TYPE;
255 } else if (disp == NULL) {
256 retval = MPI_ERR_ARG;
258 *disp = smpi_datatype_ub(datatype);
259 retval = MPI_SUCCESS;
265 int PMPI_Op_create(MPI_User_function * function, int commute, MPI_Op * op)
270 if (function == NULL || op == NULL) {
271 retval = MPI_ERR_ARG;
273 *op = smpi_op_new(function, commute);
274 retval = MPI_SUCCESS;
280 int PMPI_Op_free(MPI_Op * op)
286 retval = MPI_ERR_ARG;
287 } else if (*op == MPI_OP_NULL) {
290 smpi_op_destroy(*op);
292 retval = MPI_SUCCESS;
298 int PMPI_Group_free(MPI_Group * group)
304 retval = MPI_ERR_ARG;
306 if(*group!= smpi_comm_group(MPI_COMM_WORLD))// do not free the group of the comm_world
307 smpi_group_destroy(*group);
308 *group = MPI_GROUP_NULL;
309 retval = MPI_SUCCESS;
315 int PMPI_Group_size(MPI_Group group, int *size)
320 if (group == MPI_GROUP_NULL) {
321 retval = MPI_ERR_GROUP;
322 } else if (size == NULL) {
323 retval = MPI_ERR_ARG;
325 *size = smpi_group_size(group);
326 retval = MPI_SUCCESS;
332 int PMPI_Group_rank(MPI_Group group, int *rank)
337 if (group == MPI_GROUP_NULL) {
338 retval = MPI_ERR_GROUP;
339 } else if (rank == NULL) {
340 retval = MPI_ERR_ARG;
342 *rank = smpi_group_rank(group, smpi_process_index());
343 retval = MPI_SUCCESS;
349 int PMPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
350 MPI_Group group2, int *ranks2)
352 int retval, i, index;
355 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
356 retval = MPI_ERR_GROUP;
358 for (i = 0; i < n; i++) {
359 index = smpi_group_index(group1, ranks1[i]);
360 ranks2[i] = smpi_group_rank(group2, index);
362 retval = MPI_SUCCESS;
368 int PMPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result)
373 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
374 retval = MPI_ERR_GROUP;
375 } else if (result == NULL) {
376 retval = MPI_ERR_ARG;
378 *result = smpi_group_compare(group1, group2);
379 retval = MPI_SUCCESS;
385 int PMPI_Group_union(MPI_Group group1, MPI_Group group2,
386 MPI_Group * newgroup)
388 int retval, i, proc1, proc2, size, size2;
391 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
392 retval = MPI_ERR_GROUP;
393 } else if (newgroup == NULL) {
394 retval = MPI_ERR_ARG;
396 size = smpi_group_size(group1);
397 size2 = smpi_group_size(group2);
398 for (i = 0; i < size2; i++) {
399 proc2 = smpi_group_index(group2, i);
400 proc1 = smpi_group_rank(group1, proc2);
401 if (proc1 == MPI_UNDEFINED) {
406 *newgroup = MPI_GROUP_EMPTY;
408 *newgroup = smpi_group_new(size);
409 size2 = smpi_group_size(group1);
410 for (i = 0; i < size2; i++) {
411 proc1 = smpi_group_index(group1, i);
412 smpi_group_set_mapping(*newgroup, proc1, i);
414 for (i = size2; i < size; i++) {
415 proc2 = smpi_group_index(group2, i - size2);
416 smpi_group_set_mapping(*newgroup, proc2, i);
419 smpi_group_use(*newgroup);
420 retval = MPI_SUCCESS;
426 int PMPI_Group_intersection(MPI_Group group1, MPI_Group group2,
427 MPI_Group * newgroup)
429 int retval, i, proc1, proc2, size;
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 = smpi_group_size(group2);
438 for (i = 0; i < size; i++) {
439 proc2 = smpi_group_index(group2, i);
440 proc1 = smpi_group_rank(group1, proc2);
441 if (proc1 == MPI_UNDEFINED) {
446 *newgroup = MPI_GROUP_EMPTY;
448 *newgroup = smpi_group_new(size);
450 for (i = 0; i < smpi_group_size(group2); i++) {
451 proc2 = smpi_group_index(group2, i);
452 proc1 = smpi_group_rank(group1, proc2);
453 if (proc1 != MPI_UNDEFINED) {
454 smpi_group_set_mapping(*newgroup, proc2, j);
459 smpi_group_use(*newgroup);
460 retval = MPI_SUCCESS;
466 int PMPI_Group_difference(MPI_Group group1, MPI_Group group2, MPI_Group * newgroup)
468 int retval, i, proc1, proc2, size, size2;
471 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
472 retval = MPI_ERR_GROUP;
473 } else if (newgroup == NULL) {
474 retval = MPI_ERR_ARG;
476 size = size2 = smpi_group_size(group1);
477 for (i = 0; i < size2; i++) {
478 proc1 = smpi_group_index(group1, i);
479 proc2 = smpi_group_rank(group2, proc1);
480 if (proc2 != MPI_UNDEFINED) {
485 *newgroup = MPI_GROUP_EMPTY;
487 *newgroup = smpi_group_new(size);
488 for (i = 0; i < size2; i++) {
489 proc1 = smpi_group_index(group1, i);
490 proc2 = smpi_group_rank(group2, proc1);
491 if (proc2 == MPI_UNDEFINED) {
492 smpi_group_set_mapping(*newgroup, proc1, i);
496 smpi_group_use(*newgroup);
497 retval = MPI_SUCCESS;
503 int PMPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
505 int retval, i, index;
508 if (group == MPI_GROUP_NULL) {
509 retval = MPI_ERR_GROUP;
510 } else if (newgroup == NULL) {
511 retval = MPI_ERR_ARG;
514 *newgroup = MPI_GROUP_EMPTY;
515 } else if (n == smpi_group_size(group)) {
518 *newgroup = smpi_group_new(n);
519 for (i = 0; i < n; i++) {
520 index = smpi_group_index(group, ranks[i]);
521 smpi_group_set_mapping(*newgroup, index, i);
524 smpi_group_use(*newgroup);
525 retval = MPI_SUCCESS;
531 int PMPI_Group_excl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
533 int retval, i, j, newsize, oldsize, index;
536 if (group == MPI_GROUP_NULL) {
537 retval = MPI_ERR_GROUP;
538 } else if (newgroup == NULL) {
539 retval = MPI_ERR_ARG;
543 } else if (n == smpi_group_size(group)) {
544 *newgroup = MPI_GROUP_EMPTY;
546 oldsize=smpi_group_size(group);
547 newsize = oldsize - n;
548 *newgroup = smpi_group_new(newsize);
550 int* to_exclude=xbt_new(int, smpi_group_size(group));
551 for(i=0; i<oldsize; i++)
554 to_exclude[ranks[i]]=1;
557 for(i=0; i<oldsize; i++){
558 if(to_exclude[i]==0){
559 index = smpi_group_index(group, i);
560 smpi_group_set_mapping(*newgroup, index, j);
565 xbt_free(to_exclude);
567 smpi_group_use(*newgroup);
568 retval = MPI_SUCCESS;
574 int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
575 MPI_Group * newgroup)
577 int retval, i, j, rank, size, index;
580 if (group == MPI_GROUP_NULL) {
581 retval = MPI_ERR_GROUP;
582 } else if (newgroup == NULL) {
583 retval = MPI_ERR_ARG;
586 *newgroup = MPI_GROUP_EMPTY;
589 for (i = 0; i < n; i++) {
590 for (rank = ranges[i][0]; /* First */
591 rank >= 0 && rank <= ranges[i][1]; /* Last */
592 rank += ranges[i][2] /* Stride */ ) {
596 if (size == smpi_group_size(group)) {
599 *newgroup = smpi_group_new(size);
601 for (i = 0; i < n; i++) {
602 for (rank = ranges[i][0]; /* First */
603 rank >= 0 && rank <= ranges[i][1]; /* Last */
604 rank += ranges[i][2] /* Stride */ ) {
605 index = smpi_group_index(group, rank);
606 smpi_group_set_mapping(*newgroup, index, j);
612 smpi_group_use(*newgroup);
613 retval = MPI_SUCCESS;
619 int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
620 MPI_Group * newgroup)
622 int retval, i, newrank, rank, size, index, add;
625 if (group == MPI_GROUP_NULL) {
626 retval = MPI_ERR_GROUP;
627 } else if (newgroup == NULL) {
628 retval = MPI_ERR_ARG;
633 size = smpi_group_size(group);
634 for (i = 0; i < n; i++) {
635 for (rank = ranges[i][0]; /* First */
636 rank >= 0 && rank <= ranges[i][1]; /* Last */
637 rank += ranges[i][2] /* Stride */ ) {
642 *newgroup = MPI_GROUP_EMPTY;
644 *newgroup = smpi_group_new(size);
646 while (newrank < size) {
647 for (i = 0; i < n; i++) {
649 for (rank = ranges[i][0]; /* First */
650 rank >= 0 && rank <= ranges[i][1]; /* Last */
651 rank += ranges[i][2] /* Stride */ ) {
652 if (rank == newrank) {
658 index = smpi_group_index(group, newrank);
659 smpi_group_set_mapping(*newgroup, index, newrank);
662 newrank++; //added to avoid looping, need to be checked ..
666 smpi_group_use(*newgroup);
667 retval = MPI_SUCCESS;
673 int PMPI_Comm_rank(MPI_Comm comm, int *rank)
678 if (comm == MPI_COMM_NULL) {
679 retval = MPI_ERR_COMM;
680 } else if (rank == NULL) {
681 retval = MPI_ERR_ARG;
683 *rank = smpi_comm_rank(comm);
684 retval = MPI_SUCCESS;
690 int PMPI_Comm_size(MPI_Comm comm, int *size)
695 if (comm == MPI_COMM_NULL) {
696 retval = MPI_ERR_COMM;
697 } else if (size == NULL) {
698 retval = MPI_ERR_ARG;
700 *size = smpi_comm_size(comm);
701 retval = MPI_SUCCESS;
707 int PMPI_Comm_get_name (MPI_Comm comm, char* name, int* len)
712 if (comm == MPI_COMM_NULL) {
713 retval = MPI_ERR_COMM;
714 } else if (name == NULL || len == NULL) {
715 retval = MPI_ERR_ARG;
717 smpi_comm_get_name(comm, name, len);
718 retval = MPI_SUCCESS;
724 int PMPI_Comm_group(MPI_Comm comm, MPI_Group * group)
729 if (comm == MPI_COMM_NULL) {
730 retval = MPI_ERR_COMM;
731 } else if (group == NULL) {
732 retval = MPI_ERR_ARG;
734 *group = smpi_comm_group(comm);
735 retval = MPI_SUCCESS;
741 int PMPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result)
746 if (comm1 == MPI_COMM_NULL || comm2 == MPI_COMM_NULL) {
747 retval = MPI_ERR_COMM;
748 } else if (result == NULL) {
749 retval = MPI_ERR_ARG;
751 if (comm1 == comm2) { /* Same communicators means same groups */
755 smpi_group_compare(smpi_comm_group(comm1),
756 smpi_comm_group(comm2));
757 if (*result == MPI_IDENT) {
758 *result = MPI_CONGRUENT;
761 retval = MPI_SUCCESS;
767 int PMPI_Comm_dup(MPI_Comm comm, MPI_Comm * newcomm)
772 if (comm == MPI_COMM_NULL) {
773 retval = MPI_ERR_COMM;
774 } else if (newcomm == NULL) {
775 retval = MPI_ERR_ARG;
777 *newcomm = smpi_comm_new(smpi_comm_group(comm));
778 retval = MPI_SUCCESS;
784 int PMPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm)
789 if (comm == MPI_COMM_NULL) {
790 retval = MPI_ERR_COMM;
791 } else if (group == MPI_GROUP_NULL) {
792 retval = MPI_ERR_GROUP;
793 } else if (newcomm == NULL) {
794 retval = MPI_ERR_ARG;
795 } else if(smpi_group_rank(group,smpi_process_index())==MPI_UNDEFINED){
796 *newcomm= MPI_COMM_NULL;
797 retval = MPI_SUCCESS;
800 *newcomm = smpi_comm_new(group);
801 retval = MPI_SUCCESS;
807 int PMPI_Comm_free(MPI_Comm * comm)
813 retval = MPI_ERR_ARG;
814 } else if (*comm == MPI_COMM_NULL) {
815 retval = MPI_ERR_COMM;
817 smpi_comm_destroy(*comm);
818 *comm = MPI_COMM_NULL;
819 retval = MPI_SUCCESS;
825 int PMPI_Comm_disconnect(MPI_Comm * comm)
827 /* TODO: wait until all communication in comm are done */
832 retval = MPI_ERR_ARG;
833 } else if (*comm == MPI_COMM_NULL) {
834 retval = MPI_ERR_COMM;
836 smpi_comm_destroy(*comm);
837 *comm = MPI_COMM_NULL;
838 retval = MPI_SUCCESS;
844 int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out)
849 if (comm_out == NULL) {
850 retval = MPI_ERR_ARG;
851 } else if (comm == MPI_COMM_NULL) {
852 retval = MPI_ERR_COMM;
854 *comm_out = smpi_comm_split(comm, color, key);
855 retval = MPI_SUCCESS;
861 int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst,
862 int tag, MPI_Comm comm, MPI_Request * request)
867 if (request == NULL) {
868 retval = MPI_ERR_ARG;
869 } else if (comm == MPI_COMM_NULL) {
870 retval = MPI_ERR_COMM;
871 } else if (dst == MPI_PROC_NULL) {
872 retval = MPI_SUCCESS;
874 *request = smpi_mpi_send_init(buf, count, datatype, dst, tag, comm);
875 retval = MPI_SUCCESS;
881 int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src,
882 int tag, MPI_Comm comm, MPI_Request * request)
887 if (request == NULL) {
888 retval = MPI_ERR_ARG;
889 } else if (comm == MPI_COMM_NULL) {
890 retval = MPI_ERR_COMM;
891 } else if (src == MPI_PROC_NULL) {
892 retval = MPI_SUCCESS;
894 *request = smpi_mpi_recv_init(buf, count, datatype, src, tag, comm);
895 retval = MPI_SUCCESS;
901 int PMPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request) {
905 if (request == NULL) {
906 retval = MPI_ERR_ARG;
907 } else if (comm == MPI_COMM_NULL) {
908 retval = MPI_ERR_COMM;
909 } else if (dst == MPI_PROC_NULL) {
910 retval = MPI_SUCCESS;
912 *request = smpi_mpi_ssend_init(buf, count, datatype, dst, tag, comm);
913 retval = MPI_SUCCESS;
919 int PMPI_Start(MPI_Request * request)
924 if (request == NULL || *request == MPI_REQUEST_NULL) {
925 retval = MPI_ERR_ARG;
927 smpi_mpi_start(*request);
928 retval = MPI_SUCCESS;
934 int PMPI_Startall(int count, MPI_Request * requests)
939 if (requests == NULL) {
940 retval = MPI_ERR_ARG;
942 smpi_mpi_startall(count, requests);
943 retval = MPI_SUCCESS;
949 int PMPI_Request_free(MPI_Request * request)
954 if (*request == MPI_REQUEST_NULL) {
955 retval = MPI_ERR_ARG;
957 if((*request)->flags & PERSISTENT)(*request)->refcount--;
958 smpi_mpi_request_free(request);
959 retval = MPI_SUCCESS;
965 int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
966 int tag, MPI_Comm comm, MPI_Request * request)
972 if (request == NULL) {
973 retval = MPI_ERR_ARG;
974 } else if (comm == MPI_COMM_NULL) {
975 retval = MPI_ERR_COMM;
976 } else if (src == MPI_PROC_NULL) {
977 *request = MPI_REQUEST_NULL;
978 retval = MPI_SUCCESS;
979 } else if (src!=MPI_ANY_SOURCE && (src >= smpi_group_size(smpi_comm_group(comm)) || src <0)){
980 retval = MPI_ERR_COMM;
981 } else if (count < 0) {
982 retval = MPI_ERR_COUNT;
983 } else if (buf==NULL && count > 0) {
984 retval = MPI_ERR_COUNT;
985 } else if (datatype == MPI_DATATYPE_NULL){
986 retval = MPI_ERR_TYPE;
987 } else if(tag<0 && tag != MPI_ANY_TAG){
988 retval = MPI_ERR_TAG;
992 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
993 int src_traced = smpi_group_index(smpi_comm_group(comm), src);
994 TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
997 *request = smpi_mpi_irecv(buf, count, datatype, src, tag, comm);
998 retval = MPI_SUCCESS;
1001 TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
1002 (*request)->recv = 1;
1011 int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst,
1012 int tag, MPI_Comm comm, MPI_Request * request)
1017 if (request == NULL) {
1018 retval = MPI_ERR_ARG;
1019 } else if (comm == MPI_COMM_NULL) {
1020 retval = MPI_ERR_COMM;
1021 } else if (dst == MPI_PROC_NULL) {
1022 *request = MPI_REQUEST_NULL;
1023 retval = MPI_SUCCESS;
1024 } else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0){
1025 retval = MPI_ERR_RANK;
1026 } else if (count < 0) {
1027 retval = MPI_ERR_COUNT;
1028 } else if (buf==NULL && count > 0) {
1029 retval = MPI_ERR_COUNT;
1030 } else if (datatype == MPI_DATATYPE_NULL){
1031 retval = MPI_ERR_TYPE;
1032 } else if(tag<0 && tag != MPI_ANY_TAG){
1033 retval = MPI_ERR_TAG;
1037 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1038 TRACE_smpi_computing_out(rank);
1039 int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
1040 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
1041 TRACE_smpi_send(rank, rank, dst_traced);
1044 *request = smpi_mpi_isend(buf, count, datatype, dst, tag, comm);
1045 retval = MPI_SUCCESS;
1048 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
1049 (*request)->send = 1;
1050 TRACE_smpi_computing_in(rank);
1058 int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request) {
1062 if (request == NULL) {
1063 retval = MPI_ERR_ARG;
1064 } else if (comm == MPI_COMM_NULL) {
1065 retval = MPI_ERR_COMM;
1066 } else if (dst == MPI_PROC_NULL) {
1067 *request = MPI_REQUEST_NULL;
1068 retval = MPI_SUCCESS;
1069 } else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0){
1070 retval = MPI_ERR_RANK;
1071 } else if (count < 0) {
1072 retval = MPI_ERR_COUNT;
1073 } else if (buf==NULL && count > 0) {
1074 retval = MPI_ERR_COUNT;
1075 } else if (datatype == MPI_DATATYPE_NULL){
1076 retval = MPI_ERR_TYPE;
1077 } else if(tag<0 && tag != MPI_ANY_TAG){
1078 retval = MPI_ERR_TAG;
1082 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1083 TRACE_smpi_computing_out(rank);
1084 int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
1085 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
1086 TRACE_smpi_send(rank, rank, dst_traced);
1089 *request = smpi_mpi_issend(buf, count, datatype, dst, tag, comm);
1090 retval = MPI_SUCCESS;
1093 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
1094 (*request)->send = 1;
1095 TRACE_smpi_computing_in(rank);
1103 int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag,
1104 MPI_Comm comm, MPI_Status * status)
1109 if (comm == MPI_COMM_NULL) {
1110 retval = MPI_ERR_COMM;
1111 } else if (src == MPI_PROC_NULL) {
1112 smpi_empty_status(status);
1113 status->MPI_SOURCE = MPI_PROC_NULL;
1114 retval = MPI_SUCCESS;
1115 } else if (src!=MPI_ANY_SOURCE && (src >= smpi_group_size(smpi_comm_group(comm)) || src <0)){
1116 retval = MPI_ERR_RANK;
1117 } else if (count < 0) {
1118 retval = MPI_ERR_COUNT;
1119 } else if (buf==NULL && count > 0) {
1120 retval = MPI_ERR_COUNT;
1121 } else if (datatype == MPI_DATATYPE_NULL){
1122 retval = MPI_ERR_TYPE;
1123 } else if(tag<0 && tag != MPI_ANY_TAG){
1124 retval = MPI_ERR_TAG;
1127 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1128 int src_traced = smpi_group_index(smpi_comm_group(comm), src);
1129 TRACE_smpi_computing_out(rank);
1131 TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
1134 smpi_mpi_recv(buf, count, datatype, src, tag, comm, status);
1135 retval = MPI_SUCCESS;
1138 //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
1139 if(status!=MPI_STATUS_IGNORE)src_traced = smpi_group_index(smpi_comm_group(comm), status->MPI_SOURCE);
1140 TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
1141 TRACE_smpi_recv(rank, src_traced, rank);
1142 TRACE_smpi_computing_in(rank);
1150 int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
1157 if (comm == MPI_COMM_NULL) {
1158 retval = MPI_ERR_COMM;
1159 } else if (dst == MPI_PROC_NULL) {
1160 retval = MPI_SUCCESS;
1161 } else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0){
1162 retval = MPI_ERR_RANK;
1163 } else if (count < 0) {
1164 retval = MPI_ERR_COUNT;
1165 } else if (buf==NULL && count > 0) {
1166 retval = MPI_ERR_COUNT;
1167 } else if (datatype == MPI_DATATYPE_NULL){
1168 retval = MPI_ERR_TYPE;
1169 } else if(tag<0 && tag != MPI_ANY_TAG){
1170 retval = MPI_ERR_TAG;
1174 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1175 TRACE_smpi_computing_out(rank);
1176 int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
1177 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
1178 TRACE_smpi_send(rank, rank, dst_traced);
1181 smpi_mpi_send(buf, count, datatype, dst, tag, comm);
1182 retval = MPI_SUCCESS;
1185 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
1186 TRACE_smpi_computing_in(rank);
1196 int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) {
1201 if (comm == MPI_COMM_NULL) {
1202 retval = MPI_ERR_COMM;
1203 } else if (dst == MPI_PROC_NULL) {
1204 retval = MPI_SUCCESS;
1205 } else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0){
1206 retval = MPI_ERR_RANK;
1207 } else if (count < 0) {
1208 retval = MPI_ERR_COUNT;
1209 } else if (buf==NULL && count > 0) {
1210 retval = MPI_ERR_COUNT;
1211 } else if (datatype == MPI_DATATYPE_NULL){
1212 retval = MPI_ERR_TYPE;
1213 } else if(tag<0 && tag != MPI_ANY_TAG){
1214 retval = MPI_ERR_TAG;
1218 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1219 TRACE_smpi_computing_out(rank);
1220 int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
1221 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
1222 TRACE_smpi_send(rank, rank, dst_traced);
1225 smpi_mpi_ssend(buf, count, datatype, dst, tag, comm);
1226 retval = MPI_SUCCESS;
1229 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
1230 TRACE_smpi_computing_in(rank);
1238 int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1239 int dst, int sendtag, void *recvbuf, int recvcount,
1240 MPI_Datatype recvtype, int src, int recvtag,
1241 MPI_Comm comm, MPI_Status * status)
1247 if (comm == MPI_COMM_NULL) {
1248 retval = MPI_ERR_COMM;
1249 } else if (sendtype == MPI_DATATYPE_NULL
1250 || recvtype == MPI_DATATYPE_NULL) {
1251 retval = MPI_ERR_TYPE;
1252 } else if (src == MPI_PROC_NULL || dst == MPI_PROC_NULL) {
1253 smpi_empty_status(status);
1254 status->MPI_SOURCE = MPI_PROC_NULL;
1255 retval = MPI_SUCCESS;
1256 }else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0 ||
1257 (src!=MPI_ANY_SOURCE && (src >= smpi_group_size(smpi_comm_group(comm)) || src <0))){
1258 retval = MPI_ERR_RANK;
1259 } else if (sendcount < 0 || recvcount<0) {
1260 retval = MPI_ERR_COUNT;
1261 } else if ((sendbuf==NULL && sendcount > 0)||(recvbuf==NULL && recvcount>0)) {
1262 retval = MPI_ERR_COUNT;
1263 } else if((sendtag<0 && sendtag != MPI_ANY_TAG)||(recvtag<0 && recvtag != MPI_ANY_TAG)){
1264 retval = MPI_ERR_TAG;
1268 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1269 TRACE_smpi_computing_out(rank);
1270 int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
1271 int src_traced = smpi_group_index(smpi_comm_group(comm), src);
1272 TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
1273 TRACE_smpi_send(rank, rank, dst_traced);
1277 smpi_mpi_sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf,
1278 recvcount, recvtype, src, recvtag, comm, status);
1279 retval = MPI_SUCCESS;
1282 TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
1283 TRACE_smpi_recv(rank, src_traced, rank);
1284 TRACE_smpi_computing_in(rank);
1293 int PMPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
1294 int dst, int sendtag, int src, int recvtag,
1295 MPI_Comm comm, MPI_Status * status)
1297 //TODO: suboptimal implementation
1300 if (datatype == MPI_DATATYPE_NULL) {
1301 retval = MPI_ERR_TYPE;
1302 } else if (count < 0) {
1303 retval = MPI_ERR_COUNT;
1305 int size = smpi_datatype_get_extent(datatype) * count;
1306 recvbuf = xbt_new(char, size);
1308 MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count,
1309 datatype, src, recvtag, comm, status);
1310 if(retval==MPI_SUCCESS){
1311 smpi_datatype_copy(recvbuf, count, datatype, buf, count, datatype);
1319 int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
1324 if (request == MPI_REQUEST_NULL || flag == NULL) {
1325 retval = MPI_ERR_ARG;
1326 } else if (*request == MPI_REQUEST_NULL) {
1328 retval = MPI_ERR_REQUEST;
1330 *flag = smpi_mpi_test(request, status);
1331 retval = MPI_SUCCESS;
1337 int PMPI_Testany(int count, MPI_Request requests[], int *index, int *flag,
1338 MPI_Status * status)
1343 if (index == NULL || flag == NULL) {
1344 retval = MPI_ERR_ARG;
1346 *flag = smpi_mpi_testany(count, requests, index, status);
1347 retval = MPI_SUCCESS;
1353 int PMPI_Testall(int count, MPI_Request* requests, int* flag, MPI_Status* statuses)
1359 retval = MPI_ERR_ARG;
1361 *flag = smpi_mpi_testall(count, requests, statuses);
1362 retval = MPI_SUCCESS;
1368 int PMPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status* status) {
1372 if (status == NULL) {
1373 retval = MPI_ERR_ARG;
1374 } else if (comm == MPI_COMM_NULL) {
1375 retval = MPI_ERR_COMM;
1376 } else if (source == MPI_PROC_NULL) {
1377 smpi_empty_status(status);
1378 status->MPI_SOURCE = MPI_PROC_NULL;
1379 retval = MPI_SUCCESS;
1381 smpi_mpi_probe(source, tag, comm, status);
1382 retval = MPI_SUCCESS;
1389 int PMPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status) {
1394 retval = MPI_ERR_ARG;
1395 } else if (status == NULL) {
1396 retval = MPI_ERR_ARG;
1397 } else if (comm == MPI_COMM_NULL) {
1398 retval = MPI_ERR_COMM;
1399 } else if (source == MPI_PROC_NULL) {
1400 smpi_empty_status(status);
1401 status->MPI_SOURCE = MPI_PROC_NULL;
1402 retval = MPI_SUCCESS;
1404 smpi_mpi_iprobe(source, tag, comm, flag, status);
1405 retval = MPI_SUCCESS;
1411 int PMPI_Wait(MPI_Request * request, MPI_Status * status)
1417 if (request == NULL) {
1418 retval = MPI_ERR_ARG;
1419 } else if (*request == MPI_REQUEST_NULL) {
1420 retval = MPI_ERR_REQUEST;
1424 int rank = request && (*request)->comm != MPI_COMM_NULL
1425 ? smpi_process_index()
1427 TRACE_smpi_computing_out(rank);
1429 int src_traced = (*request)->src;
1430 int dst_traced = (*request)->dst;
1431 int is_wait_for_receive = (*request)->recv;
1432 TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
1435 smpi_mpi_wait(request, status);
1436 retval = MPI_SUCCESS;
1439 TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
1440 if (is_wait_for_receive) {
1441 TRACE_smpi_recv(rank, src_traced, dst_traced);
1443 TRACE_smpi_computing_in(rank);
1452 int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * status)
1458 //save requests information for tracing
1460 int *srcs = xbt_new(int, count);
1461 int *dsts = xbt_new(int, count);
1462 int *recvs = xbt_new(int, count);
1463 for (i = 0; i < count; i++) {
1464 MPI_Request req = requests[i]; //already received requests are no longer valid
1468 recvs[i] = req->recv;
1471 int rank_traced = smpi_process_index();
1472 TRACE_smpi_computing_out(rank_traced);
1474 TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
1477 if (index == NULL) {
1478 retval = MPI_ERR_ARG;
1480 *index = smpi_mpi_waitany(count, requests, status);
1481 retval = MPI_SUCCESS;
1484 if(*index!=MPI_UNDEFINED){
1485 int src_traced = srcs[*index];
1486 int dst_traced = dsts[*index];
1487 int is_wait_for_receive = recvs[*index];
1488 if (is_wait_for_receive) {
1489 TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
1491 TRACE_smpi_ptp_out(rank_traced, src_traced, dst_traced, __FUNCTION__);
1496 TRACE_smpi_computing_in(rank_traced);
1502 int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
1507 //save information from requests
1509 int *srcs = xbt_new(int, count);
1510 int *dsts = xbt_new(int, count);
1511 int *recvs = xbt_new(int, count);
1512 int valid_count = 0;
1513 for (i = 0; i < count; i++) {
1514 MPI_Request req = requests[i];
1515 if(req!=MPI_REQUEST_NULL){
1516 srcs[valid_count] = req->src;
1517 dsts[valid_count] = req->dst;
1518 recvs[valid_count] = req->recv;
1522 int rank_traced = smpi_process_index();
1523 TRACE_smpi_computing_out(rank_traced);
1525 TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
1527 int retval = smpi_mpi_waitall(count, requests, status);
1529 for (i = 0; i < valid_count; i++) {
1530 int src_traced = srcs[i];
1531 int dst_traced = dsts[i];
1532 int is_wait_for_receive = recvs[i];
1533 if (is_wait_for_receive) {
1534 TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
1537 TRACE_smpi_ptp_out(rank_traced, -1, -1, __FUNCTION__);
1541 TRACE_smpi_computing_in(rank_traced);
1547 int PMPI_Waitsome(int incount, MPI_Request requests[], int *outcount,
1548 int *indices, MPI_Status status[])
1553 if (outcount == NULL || indices == NULL) {
1554 retval = MPI_ERR_ARG;
1556 *outcount = smpi_mpi_waitsome(incount, requests, indices, status);
1557 retval = MPI_SUCCESS;
1563 int PMPI_Testsome(int incount, MPI_Request requests[], int* outcount,
1564 int* indices, MPI_Status status[])
1569 if (outcount == NULL || indices == NULL) {
1570 retval = MPI_ERR_ARG;
1572 *outcount = smpi_mpi_testsome(incount, requests, indices, status);
1573 retval = MPI_SUCCESS;
1580 int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
1586 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1587 TRACE_smpi_computing_out(rank);
1588 int root_traced = smpi_group_index(smpi_comm_group(comm), root);
1589 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1591 if (comm == MPI_COMM_NULL) {
1592 retval = MPI_ERR_COMM;
1594 mpi_coll_bcast_fun(buf, count, datatype, root, comm);
1595 retval = MPI_SUCCESS;
1598 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1599 TRACE_smpi_computing_in(rank);
1605 int PMPI_Barrier(MPI_Comm comm)
1611 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1612 TRACE_smpi_computing_out(rank);
1613 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1615 if (comm == MPI_COMM_NULL) {
1616 retval = MPI_ERR_COMM;
1618 mpi_coll_barrier_fun(comm);
1619 retval = MPI_SUCCESS;
1622 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1623 TRACE_smpi_computing_in(rank);
1629 int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1630 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1631 int root, MPI_Comm comm)
1637 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1638 TRACE_smpi_computing_out(rank);
1639 int root_traced = smpi_group_index(smpi_comm_group(comm), root);
1640 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1642 if (comm == MPI_COMM_NULL) {
1643 retval = MPI_ERR_COMM;
1644 } else if (sendtype == MPI_DATATYPE_NULL
1645 || recvtype == MPI_DATATYPE_NULL) {
1646 retval = MPI_ERR_TYPE;
1648 mpi_coll_gather_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1649 recvtype, root, comm);
1650 retval = MPI_SUCCESS;
1653 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1654 TRACE_smpi_computing_in(rank);
1660 int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1661 void *recvbuf, int *recvcounts, int *displs,
1662 MPI_Datatype recvtype, int root, MPI_Comm comm)
1668 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1669 TRACE_smpi_computing_out(rank);
1670 int root_traced = smpi_group_index(smpi_comm_group(comm), root);
1671 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1673 if (comm == MPI_COMM_NULL) {
1674 retval = MPI_ERR_COMM;
1675 } else if (sendtype == MPI_DATATYPE_NULL
1676 || recvtype == MPI_DATATYPE_NULL) {
1677 retval = MPI_ERR_TYPE;
1678 } else if (recvcounts == NULL || displs == NULL) {
1679 retval = MPI_ERR_ARG;
1681 smpi_mpi_gatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
1682 displs, recvtype, root, comm);
1683 retval = MPI_SUCCESS;
1686 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1687 TRACE_smpi_computing_in(rank);
1693 int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1694 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1701 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1702 TRACE_smpi_computing_out(rank);
1703 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1705 if (comm == MPI_COMM_NULL) {
1706 retval = MPI_ERR_COMM;
1707 } else if (sendtype == MPI_DATATYPE_NULL
1708 || recvtype == MPI_DATATYPE_NULL) {
1709 retval = MPI_ERR_TYPE;
1711 mpi_coll_allgather_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1713 retval = MPI_SUCCESS;
1716 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1722 int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1723 void *recvbuf, int *recvcounts, int *displs,
1724 MPI_Datatype recvtype, MPI_Comm comm)
1730 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1731 TRACE_smpi_computing_out(rank);
1732 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1734 if (comm == MPI_COMM_NULL) {
1735 retval = MPI_ERR_COMM;
1736 } else if (sendtype == MPI_DATATYPE_NULL
1737 || recvtype == MPI_DATATYPE_NULL) {
1738 retval = MPI_ERR_TYPE;
1739 } else if (recvcounts == NULL || displs == NULL) {
1740 retval = MPI_ERR_ARG;
1742 mpi_coll_allgatherv_fun(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
1743 displs, recvtype, comm);
1744 retval = MPI_SUCCESS;
1747 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1748 TRACE_smpi_computing_in(rank);
1754 int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1755 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1756 int root, MPI_Comm comm)
1762 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1763 TRACE_smpi_computing_out(rank);
1764 int root_traced = smpi_group_index(smpi_comm_group(comm), root);
1766 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1768 if (comm == MPI_COMM_NULL) {
1769 retval = MPI_ERR_COMM;
1770 } else if (sendtype == MPI_DATATYPE_NULL
1771 || recvtype == MPI_DATATYPE_NULL) {
1772 retval = MPI_ERR_TYPE;
1774 mpi_coll_scatter_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1775 recvtype, root, comm);
1776 retval = MPI_SUCCESS;
1779 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1780 TRACE_smpi_computing_in(rank);
1786 int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
1787 MPI_Datatype sendtype, void *recvbuf, int recvcount,
1788 MPI_Datatype recvtype, int root, MPI_Comm comm)
1794 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1795 TRACE_smpi_computing_out(rank);
1796 int root_traced = smpi_group_index(smpi_comm_group(comm), root);
1797 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1799 if (comm == MPI_COMM_NULL) {
1800 retval = MPI_ERR_COMM;
1801 } else if (sendtype == MPI_DATATYPE_NULL
1802 || recvtype == MPI_DATATYPE_NULL) {
1803 retval = MPI_ERR_TYPE;
1804 } else if (sendcounts == NULL || displs == NULL) {
1805 retval = MPI_ERR_ARG;
1807 smpi_mpi_scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf,
1808 recvcount, recvtype, root, comm);
1809 retval = MPI_SUCCESS;
1812 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1813 TRACE_smpi_computing_in(rank);
1819 int PMPI_Reduce(void *sendbuf, void *recvbuf, int count,
1820 MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
1826 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1827 TRACE_smpi_computing_out(rank);
1828 int root_traced = smpi_group_index(smpi_comm_group(comm), root);
1829 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1831 if (comm == MPI_COMM_NULL) {
1832 retval = MPI_ERR_COMM;
1833 } else if (datatype == MPI_DATATYPE_NULL || op == MPI_OP_NULL) {
1834 retval = MPI_ERR_ARG;
1836 mpi_coll_reduce_fun(sendbuf, recvbuf, count, datatype, op, root, comm);
1837 retval = MPI_SUCCESS;
1840 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1841 TRACE_smpi_computing_in(rank);
1847 int PMPI_Reduce_local(void *inbuf, void *inoutbuf, int count,
1848 MPI_Datatype datatype, MPI_Op op){
1852 if (datatype == MPI_DATATYPE_NULL || op == MPI_OP_NULL) {
1853 retval = MPI_ERR_ARG;
1855 smpi_op_apply(op, inbuf, inoutbuf, &count, &datatype);
1862 int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count,
1863 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1869 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1870 TRACE_smpi_computing_out(rank);
1871 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1873 if (comm == MPI_COMM_NULL) {
1874 retval = MPI_ERR_COMM;
1875 } else if (datatype == MPI_DATATYPE_NULL) {
1876 retval = MPI_ERR_TYPE;
1877 } else if (op == MPI_OP_NULL) {
1878 retval = MPI_ERR_OP;
1880 mpi_coll_allreduce_fun(sendbuf, recvbuf, count, datatype, op, comm);
1881 retval = MPI_SUCCESS;
1884 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1885 TRACE_smpi_computing_in(rank);
1891 int PMPI_Scan(void *sendbuf, void *recvbuf, int count,
1892 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1898 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1899 TRACE_smpi_computing_out(rank);
1900 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1902 if (comm == MPI_COMM_NULL) {
1903 retval = MPI_ERR_COMM;
1904 } else if (datatype == MPI_DATATYPE_NULL) {
1905 retval = MPI_ERR_TYPE;
1906 } else if (op == MPI_OP_NULL) {
1907 retval = MPI_ERR_OP;
1909 smpi_mpi_scan(sendbuf, recvbuf, count, datatype, op, comm);
1910 retval = MPI_SUCCESS;
1913 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1914 TRACE_smpi_computing_in(rank);
1920 int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
1921 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1926 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1927 TRACE_smpi_computing_out(rank);
1928 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1930 if (comm == MPI_COMM_NULL) {
1931 retval = MPI_ERR_COMM;
1932 } else if (datatype == MPI_DATATYPE_NULL) {
1933 retval = MPI_ERR_TYPE;
1934 } else if (op == MPI_OP_NULL) {
1935 retval = MPI_ERR_OP;
1936 } else if (recvcounts == NULL) {
1937 retval = MPI_ERR_ARG;
1940 mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts,
1941 datatype, op, comm);
1942 retval = MPI_SUCCESS;
1945 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1946 TRACE_smpi_computing_in(rank);
1952 int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
1953 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1958 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1959 TRACE_smpi_computing_out(rank);
1960 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1962 if (comm == MPI_COMM_NULL) {
1963 retval = MPI_ERR_COMM;
1964 } else if (datatype == MPI_DATATYPE_NULL) {
1965 retval = MPI_ERR_TYPE;
1966 } else if (op == MPI_OP_NULL) {
1967 retval = MPI_ERR_OP;
1968 } else if (recvcount < 0) {
1969 retval = MPI_ERR_ARG;
1971 int count=smpi_comm_size(comm);
1972 int* recvcounts=(int*)xbt_malloc(count);
1973 for (i=0; i<count;i++)recvcounts[i]=recvcount;
1974 mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts,
1975 datatype, op, comm);
1976 xbt_free(recvcounts);
1977 retval = MPI_SUCCESS;
1980 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1981 TRACE_smpi_computing_in(rank);
1987 int PMPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1988 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1995 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1996 TRACE_smpi_computing_out(rank);
1997 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1999 if (comm == MPI_COMM_NULL) {
2000 retval = MPI_ERR_COMM;
2001 } else if (sendtype == MPI_DATATYPE_NULL
2002 || recvtype == MPI_DATATYPE_NULL) {
2003 retval = MPI_ERR_TYPE;
2005 retval = mpi_coll_alltoall_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
2008 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
2009 TRACE_smpi_computing_in(rank);
2015 int PMPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
2016 MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
2017 int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm)
2023 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
2024 TRACE_smpi_computing_out(rank);
2025 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
2027 if (comm == MPI_COMM_NULL) {
2028 retval = MPI_ERR_COMM;
2029 } else if (sendtype == MPI_DATATYPE_NULL
2030 || recvtype == MPI_DATATYPE_NULL) {
2031 retval = MPI_ERR_TYPE;
2032 } else if (sendcounts == NULL || senddisps == NULL || recvcounts == NULL
2033 || recvdisps == NULL) {
2034 retval = MPI_ERR_ARG;
2037 mpi_coll_alltoallv_fun(sendbuf, sendcounts, senddisps, sendtype,
2038 recvbuf, recvcounts, recvdisps, recvtype,
2042 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
2043 TRACE_smpi_computing_in(rank);
2050 int PMPI_Get_processor_name(char *name, int *resultlen)
2052 int retval = MPI_SUCCESS;
2055 strncpy(name, SIMIX_host_get_name(SIMIX_host_self()),
2056 strlen(SIMIX_host_get_name(SIMIX_host_self())) < MPI_MAX_PROCESSOR_NAME - 1 ?
2057 strlen(SIMIX_host_get_name(SIMIX_host_self())) +1 :
2058 MPI_MAX_PROCESSOR_NAME - 1 );
2061 MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
2067 int PMPI_Get_count(MPI_Status * status, MPI_Datatype datatype, int *count)
2069 int retval = MPI_SUCCESS;
2073 if (status == NULL || count == NULL) {
2074 retval = MPI_ERR_ARG;
2075 } else if (datatype == MPI_DATATYPE_NULL) {
2076 retval = MPI_ERR_TYPE;
2078 size = smpi_datatype_size(datatype);
2081 } else if (status->count % size != 0) {
2082 retval = MPI_UNDEFINED;
2084 *count = smpi_mpi_get_count(status, datatype);
2091 int PMPI_Type_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_type) {
2095 if (old_type == MPI_DATATYPE_NULL) {
2096 retval = MPI_ERR_TYPE;
2097 } else if (count<0){
2098 retval = MPI_ERR_COUNT;
2100 retval = smpi_datatype_contiguous(count, old_type, new_type, 0);
2106 int PMPI_Type_commit(MPI_Datatype* datatype) {
2110 if (datatype == MPI_DATATYPE_NULL) {
2111 retval = MPI_ERR_TYPE;
2113 smpi_datatype_commit(datatype);
2114 retval = MPI_SUCCESS;
2121 int PMPI_Type_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
2125 if (old_type == MPI_DATATYPE_NULL) {
2126 retval = MPI_ERR_TYPE;
2127 } else if (count<0 || blocklen<0){
2128 retval = MPI_ERR_COUNT;
2130 retval = smpi_datatype_vector(count, blocklen, stride, old_type, new_type);
2136 int PMPI_Type_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
2140 if (old_type == MPI_DATATYPE_NULL) {
2141 retval = MPI_ERR_TYPE;
2142 } else if (count<0 || blocklen<0){
2143 retval = MPI_ERR_COUNT;
2145 retval = smpi_datatype_hvector(count, blocklen, stride, old_type, new_type);
2151 int PMPI_Type_create_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
2152 return MPI_Type_hvector(count, blocklen, stride, old_type, new_type);
2155 int PMPI_Type_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
2159 if (old_type == MPI_DATATYPE_NULL) {
2160 retval = MPI_ERR_TYPE;
2161 } else if (count<0){
2162 retval = MPI_ERR_COUNT;
2164 retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
2170 int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
2174 if (old_type == MPI_DATATYPE_NULL) {
2175 retval = MPI_ERR_TYPE;
2176 } else if (count<0){
2177 retval = MPI_ERR_COUNT;
2179 int* blocklens=(int*)xbt_malloc(blocklength*count);
2180 for (i=0; i<count;i++)blocklens[i]=blocklength;
2181 retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
2182 xbt_free(blocklens);
2189 int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
2193 if (old_type == MPI_DATATYPE_NULL) {
2194 retval = MPI_ERR_TYPE;
2195 } else if (count<0){
2196 retval = MPI_ERR_COUNT;
2198 retval = smpi_datatype_hindexed(count, blocklens, indices, old_type, new_type);
2204 int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
2208 if (old_type == MPI_DATATYPE_NULL) {
2209 retval = MPI_ERR_TYPE;
2210 } else if (count<0){
2211 retval = MPI_ERR_COUNT;
2213 int* blocklens=(int*)xbt_malloc(blocklength*count);
2214 for (i=0; i<count;i++)blocklens[i]=blocklength;
2215 retval = smpi_datatype_hindexed(count, blocklens, indices, old_type, new_type);
2216 xbt_free(blocklens);
2223 int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
2228 retval = MPI_ERR_COUNT;
2230 retval = smpi_datatype_struct(count, blocklens, indices, old_types, new_type);
2236 int PMPI_Type_create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
2237 return PMPI_Type_struct(count, blocklens, indices, old_types, new_type);
2241 int PMPI_Error_class(int errorcode, int* errorclass) {
2242 // assume smpi uses only standard mpi error codes
2243 *errorclass=errorcode;
2248 int PMPI_Initialized(int* flag) {
2249 *flag=(smpi_process_data()!=NULL);
2253 /* The following calls are not yet implemented and will fail at runtime. */
2254 /* Once implemented, please move them above this notice. */
2256 #define NOT_YET_IMPLEMENTED {\
2257 XBT_WARN("Not yet implemented : %s. Please contact the Simgrid team if support is needed", __FUNCTION__);\
2258 return MPI_SUCCESS;\
2262 int PMPI_Type_dup(MPI_Datatype datatype, MPI_Datatype *newtype){
2266 int PMPI_Type_set_name(MPI_Datatype datatype, char * name)
2271 int PMPI_Type_get_name(MPI_Datatype datatype, char * name, int* len)
2276 int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
2280 int PMPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int* coords) {
2284 int PMPI_Cart_create(MPI_Comm comm_old, int ndims, int* dims, int* periods, int reorder, MPI_Comm* comm_cart) {
2288 int PMPI_Cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords) {
2292 int PMPI_Cart_map(MPI_Comm comm_old, int ndims, int* dims, int* periods, int* newrank) {
2296 int PMPI_Cart_rank(MPI_Comm comm, int* coords, int* rank) {
2300 int PMPI_Cart_shift(MPI_Comm comm, int direction, int displ, int* source, int* dest) {
2304 int PMPI_Cart_sub(MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new) {
2308 int PMPI_Cartdim_get(MPI_Comm comm, int* ndims) {
2312 int PMPI_Graph_create(MPI_Comm comm_old, int nnodes, int* index, int* edges, int reorder, MPI_Comm* comm_graph) {
2316 int PMPI_Graph_get(MPI_Comm comm, int maxindex, int maxedges, int* index, int* edges) {
2320 int PMPI_Graph_map(MPI_Comm comm_old, int nnodes, int* index, int* edges, int* newrank) {
2324 int PMPI_Graph_neighbors(MPI_Comm comm, int rank, int maxneighbors, int* neighbors) {
2328 int PMPI_Graph_neighbors_count(MPI_Comm comm, int rank, int* nneighbors) {
2332 int PMPI_Graphdims_get(MPI_Comm comm, int* nnodes, int* nedges) {
2336 int PMPI_Topo_test(MPI_Comm comm, int* top_type) {
2340 int PMPI_Errhandler_create(MPI_Handler_function* function, MPI_Errhandler* errhandler) {
2344 int PMPI_Errhandler_free(MPI_Errhandler* errhandler) {
2348 int PMPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler* errhandler) {
2352 int PMPI_Error_string(int errorcode, char* string, int* resultlen) {
2356 int PMPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler) {
2360 int PMPI_Comm_set_errhandler(MPI_Comm comm, MPI_Errhandler errhandler) {
2364 int PMPI_Cancel(MPI_Request* request) {
2368 int PMPI_Buffer_attach(void* buffer, int size) {
2372 int PMPI_Buffer_detach(void* buffer, int* size) {
2376 int PMPI_Comm_test_inter(MPI_Comm comm, int* flag) {
2380 int PMPI_Comm_get_attr (MPI_Comm comm, int comm_keyval, void *attribute_val, int *flag)
2385 int PMPI_Comm_set_attr (MPI_Comm comm, int comm_keyval, void *attribute_val)
2390 int PMPI_Comm_delete_attr (MPI_Comm comm, int comm_keyval)
2395 int PMPI_Comm_create_keyval(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval, void* extra_state)
2400 int PMPI_Comm_free_keyval(int* keyval) {
2404 int PMPI_Pcontrol(const int level )
2409 int PMPI_Unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
2413 int PMPI_Type_get_attr (MPI_Datatype type, int type_keyval, void *attribute_val, int* flag)
2418 int PMPI_Type_set_attr (MPI_Datatype type, int type_keyval, void *attribute_val)
2423 int PMPI_Type_delete_attr (MPI_Datatype type, int comm_keyval)
2428 int PMPI_Type_create_keyval(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state)
2433 int PMPI_Type_free_keyval(int* keyval) {
2437 int PMPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out) {
2441 int PMPI_Intercomm_merge(MPI_Comm comm, int high, MPI_Comm* comm_out) {
2445 int PMPI_Bsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
2449 int PMPI_Bsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
2453 int PMPI_Ibsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
2457 int PMPI_Comm_remote_group(MPI_Comm comm, MPI_Group* group) {
2461 int PMPI_Comm_remote_size(MPI_Comm comm, int* size) {
2465 int PMPI_Attr_delete(MPI_Comm comm, int keyval) {
2469 int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) {
2473 int PMPI_Attr_put(MPI_Comm comm, int keyval, void* attr_value) {
2477 int PMPI_Rsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
2481 int PMPI_Rsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
2485 int PMPI_Irsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
2489 int PMPI_Keyval_create(MPI_Copy_function* copy_fn, MPI_Delete_function* delete_fn, int* keyval, void* extra_state) {
2493 int PMPI_Keyval_free(int* keyval) {
2497 int PMPI_Test_cancelled(MPI_Status* status, int* flag) {
2501 int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
2505 int PMPI_Pack_external_size(char *datarep, int incount, MPI_Datatype datatype, MPI_Aint *size){
2509 int PMPI_Pack_external(char *datarep, void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, MPI_Aint outcount, MPI_Aint *position){
2513 int PMPI_Unpack_external( char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position, void *outbuf, int outcount, MPI_Datatype datatype){
2517 int PMPI_Get_elements(MPI_Status* status, MPI_Datatype datatype, int* elements) {
2521 int PMPI_Dims_create(int nnodes, int ndims, int* dims) {
2525 int PMPI_Win_fence( int assert, MPI_Win win){
2529 int PMPI_Win_free( MPI_Win* win){
2533 int PMPI_Win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win){
2537 int PMPI_Info_create( MPI_Info *info){
2541 int PMPI_Info_set( MPI_Info info, char *key, char *value){
2545 int PMPI_Info_free( MPI_Info *info){
2549 int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
2550 MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win){
2554 int PMPI_Type_get_envelope( MPI_Datatype datatype, int *num_integers,
2555 int *num_addresses, int *num_datatypes, int *combiner){
2559 int PMPI_Type_get_contents(MPI_Datatype datatype, int max_integers, int max_addresses,
2560 int max_datatypes, int* array_of_integers, MPI_Aint* array_of_addresses,
2561 MPI_Datatype* array_of_datatypes){
2565 int PMPI_Type_create_darray(int size, int rank, int ndims, int* array_of_gsizes,
2566 int* array_of_distribs, int* array_of_dargs, int* array_of_psizes,
2567 int order, MPI_Datatype oldtype, MPI_Datatype *newtype) {
2571 int PMPI_Type_create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype){
2575 int PMPI_Type_create_subarray(int ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts, int order, MPI_Datatype oldtype, MPI_Datatype *newtype){
2579 int PMPI_Type_match_size(int typeclass,int size,MPI_Datatype *datatype){
2583 int PMPI_Alltoallw( void *sendbuf, int *sendcnts, int *sdispls, MPI_Datatype *sendtypes,
2584 void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype *recvtypes,
2589 int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
2590 MPI_Op op, MPI_Comm comm){
2594 int PMPI_Comm_set_name(MPI_Comm comm, char* name){
2598 int PMPI_Comm_dup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm * newcomm){
2602 int PMPI_Comm_split_type(MPI_Comm comm, int split_type, int key, MPI_Info info, MPI_Comm *newcomm){
2606 int PMPI_Comm_set_info (MPI_Comm comm, MPI_Info info){
2610 int PMPI_Comm_get_info (MPI_Comm comm, MPI_Info* info){
2614 int PMPI_Info_get(MPI_Info info,char *key,int valuelen, char *value, int *flag){
2618 int PMPI_Comm_create_errhandler( MPI_Comm_errhandler_fn *function, MPI_Errhandler *errhandler){
2622 int PMPI_Add_error_class( int *errorclass){
2626 int PMPI_Add_error_code( int errorclass, int *errorcode){
2630 int PMPI_Add_error_string( int errorcode, char *string){
2634 int PMPI_Comm_call_errhandler(MPI_Comm comm,int errorcode){
2638 int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo){
2642 int PMPI_Info_delete(MPI_Info info, char *key){
2646 int PMPI_Info_get_nkeys( MPI_Info info, int *nkeys){
2650 int PMPI_Info_get_nthkey( MPI_Info info, int n, char *key){
2654 int PMPI_Info_get_valuelen( MPI_Info info, char *key, int *valuelen, int *flag){
2658 int PMPI_Request_get_status( MPI_Request request, int *flag, MPI_Status *status){
2662 int MPI_Request_get_status( MPI_Request request, int *flag, MPI_Status *status){
2666 int PMPI_Grequest_start( MPI_Grequest_query_function *query_fn, MPI_Grequest_free_function *free_fn, MPI_Grequest_cancel_function *cancel_fn, void *extra_state, MPI_Request *request){
2670 int PMPI_Grequest_complete( MPI_Request request){
2674 int PMPI_Status_set_cancelled(MPI_Status *status,int flag){
2678 int PMPI_Status_set_elements( MPI_Status *status, MPI_Datatype datatype, int count){
2682 int PMPI_Comm_connect( char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm){
2686 int PMPI_Publish_name( char *service_name, MPI_Info info, char *port_name){
2690 int PMPI_Unpublish_name( char *service_name, MPI_Info info, char *port_name){
2694 int PMPI_Lookup_name( char *service_name, MPI_Info info, char *port_name){
2698 int PMPI_Comm_join( int fd, MPI_Comm *intercomm){
2702 int PMPI_Open_port( MPI_Info info, char *port_name){
2706 int PMPI_Close_port(char *port_name){
2710 int PMPI_Comm_accept( char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm){
2714 int PMPI_Comm_spawn( char *command, char **argv, int maxprocs, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes){
2718 int PMPI_Comm_spawn_multiple( int count, char **array_of_commands, char*** array_of_argv,
2719 int* array_of_maxprocs, MPI_Info* array_of_info, int root,
2720 MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes){
2724 int PMPI_Comm_get_parent( MPI_Comm *parent){