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;
796 *newcomm = smpi_comm_new(group);
797 retval = MPI_SUCCESS;
803 int PMPI_Comm_free(MPI_Comm * comm)
809 retval = MPI_ERR_ARG;
810 } else if (*comm == MPI_COMM_NULL) {
811 retval = MPI_ERR_COMM;
813 smpi_comm_destroy(*comm);
814 *comm = MPI_COMM_NULL;
815 retval = MPI_SUCCESS;
821 int PMPI_Comm_disconnect(MPI_Comm * comm)
823 /* TODO: wait until all communication in comm are done */
828 retval = MPI_ERR_ARG;
829 } else if (*comm == MPI_COMM_NULL) {
830 retval = MPI_ERR_COMM;
832 smpi_comm_destroy(*comm);
833 *comm = MPI_COMM_NULL;
834 retval = MPI_SUCCESS;
840 int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out)
845 if (comm_out == NULL) {
846 retval = MPI_ERR_ARG;
847 } else if (comm == MPI_COMM_NULL) {
848 retval = MPI_ERR_COMM;
850 *comm_out = smpi_comm_split(comm, color, key);
851 retval = MPI_SUCCESS;
857 int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst,
858 int tag, MPI_Comm comm, MPI_Request * request)
863 if (request == NULL) {
864 retval = MPI_ERR_ARG;
865 } else if (comm == MPI_COMM_NULL) {
866 retval = MPI_ERR_COMM;
867 } else if (dst == MPI_PROC_NULL) {
868 retval = MPI_SUCCESS;
870 *request = smpi_mpi_send_init(buf, count, datatype, dst, tag, comm);
871 retval = MPI_SUCCESS;
877 int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src,
878 int tag, MPI_Comm comm, MPI_Request * request)
883 if (request == NULL) {
884 retval = MPI_ERR_ARG;
885 } else if (comm == MPI_COMM_NULL) {
886 retval = MPI_ERR_COMM;
887 } else if (src == MPI_PROC_NULL) {
888 retval = MPI_SUCCESS;
890 *request = smpi_mpi_recv_init(buf, count, datatype, src, tag, comm);
891 retval = MPI_SUCCESS;
897 int PMPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request) {
901 if (request == NULL) {
902 retval = MPI_ERR_ARG;
903 } else if (comm == MPI_COMM_NULL) {
904 retval = MPI_ERR_COMM;
905 } else if (dst == MPI_PROC_NULL) {
906 retval = MPI_SUCCESS;
908 *request = smpi_mpi_ssend_init(buf, count, datatype, dst, tag, comm);
909 retval = MPI_SUCCESS;
915 int PMPI_Start(MPI_Request * request)
920 if (request == NULL || *request == MPI_REQUEST_NULL) {
921 retval = MPI_ERR_ARG;
923 smpi_mpi_start(*request);
924 retval = MPI_SUCCESS;
930 int PMPI_Startall(int count, MPI_Request * requests)
935 if (requests == NULL) {
936 retval = MPI_ERR_ARG;
938 smpi_mpi_startall(count, requests);
939 retval = MPI_SUCCESS;
945 int PMPI_Request_free(MPI_Request * request)
950 if (*request == MPI_REQUEST_NULL) {
951 retval = MPI_ERR_ARG;
953 if((*request)->flags & PERSISTENT)(*request)->refcount--;
954 smpi_mpi_request_free(request);
955 retval = MPI_SUCCESS;
961 int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
962 int tag, MPI_Comm comm, MPI_Request * request)
968 if (request == NULL) {
969 retval = MPI_ERR_ARG;
970 } else if (comm == MPI_COMM_NULL) {
971 retval = MPI_ERR_COMM;
972 } else if (src == MPI_PROC_NULL) {
973 *request = MPI_REQUEST_NULL;
974 retval = MPI_SUCCESS;
975 } else if (src!=MPI_ANY_SOURCE && (src >= smpi_group_size(smpi_comm_group(comm)) || src <0)){
976 retval = MPI_ERR_COMM;
977 } else if (count < 0) {
978 retval = MPI_ERR_COUNT;
979 } else if (buf==NULL && count > 0) {
980 retval = MPI_ERR_COUNT;
981 } else if (datatype == MPI_DATATYPE_NULL){
982 retval = MPI_ERR_TYPE;
983 } else if(tag<0 && tag != MPI_ANY_TAG){
984 retval = MPI_ERR_TAG;
988 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
989 int src_traced = smpi_group_index(smpi_comm_group(comm), src);
990 TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
993 *request = smpi_mpi_irecv(buf, count, datatype, src, tag, comm);
994 retval = MPI_SUCCESS;
997 TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
998 (*request)->recv = 1;
1007 int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst,
1008 int tag, MPI_Comm comm, MPI_Request * request)
1013 if (request == NULL) {
1014 retval = MPI_ERR_ARG;
1015 } else if (comm == MPI_COMM_NULL) {
1016 retval = MPI_ERR_COMM;
1017 } else if (dst == MPI_PROC_NULL) {
1018 *request = MPI_REQUEST_NULL;
1019 retval = MPI_SUCCESS;
1020 } else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0){
1021 retval = MPI_ERR_RANK;
1022 } else if (count < 0) {
1023 retval = MPI_ERR_COUNT;
1024 } else if (buf==NULL && count > 0) {
1025 retval = MPI_ERR_COUNT;
1026 } else if (datatype == MPI_DATATYPE_NULL){
1027 retval = MPI_ERR_TYPE;
1028 } else if(tag<0 && tag != MPI_ANY_TAG){
1029 retval = MPI_ERR_TAG;
1033 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1034 TRACE_smpi_computing_out(rank);
1035 int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
1036 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
1037 TRACE_smpi_send(rank, rank, dst_traced);
1040 *request = smpi_mpi_isend(buf, count, datatype, dst, tag, comm);
1041 retval = MPI_SUCCESS;
1044 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
1045 (*request)->send = 1;
1046 TRACE_smpi_computing_in(rank);
1054 int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request) {
1058 if (request == NULL) {
1059 retval = MPI_ERR_ARG;
1060 } else if (comm == MPI_COMM_NULL) {
1061 retval = MPI_ERR_COMM;
1062 } else if (dst == MPI_PROC_NULL) {
1063 *request = MPI_REQUEST_NULL;
1064 retval = MPI_SUCCESS;
1065 } else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0){
1066 retval = MPI_ERR_RANK;
1067 } else if (count < 0) {
1068 retval = MPI_ERR_COUNT;
1069 } else if (buf==NULL && count > 0) {
1070 retval = MPI_ERR_COUNT;
1071 } else if (datatype == MPI_DATATYPE_NULL){
1072 retval = MPI_ERR_TYPE;
1073 } else if(tag<0 && tag != MPI_ANY_TAG){
1074 retval = MPI_ERR_TAG;
1078 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1079 TRACE_smpi_computing_out(rank);
1080 int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
1081 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
1082 TRACE_smpi_send(rank, rank, dst_traced);
1085 *request = smpi_mpi_issend(buf, count, datatype, dst, tag, comm);
1086 retval = MPI_SUCCESS;
1089 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
1090 (*request)->send = 1;
1091 TRACE_smpi_computing_in(rank);
1099 int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag,
1100 MPI_Comm comm, MPI_Status * status)
1105 if (comm == MPI_COMM_NULL) {
1106 retval = MPI_ERR_COMM;
1107 } else if (src == MPI_PROC_NULL) {
1108 smpi_empty_status(status);
1109 status->MPI_SOURCE = MPI_PROC_NULL;
1110 retval = MPI_SUCCESS;
1111 } else if (src!=MPI_ANY_SOURCE && (src >= smpi_group_size(smpi_comm_group(comm)) || src <0)){
1112 retval = MPI_ERR_RANK;
1113 } else if (count < 0) {
1114 retval = MPI_ERR_COUNT;
1115 } else if (buf==NULL && count > 0) {
1116 retval = MPI_ERR_COUNT;
1117 } else if (datatype == MPI_DATATYPE_NULL){
1118 retval = MPI_ERR_TYPE;
1119 } else if(tag<0 && tag != MPI_ANY_TAG){
1120 retval = MPI_ERR_TAG;
1123 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1124 int src_traced = smpi_group_index(smpi_comm_group(comm), src);
1125 TRACE_smpi_computing_out(rank);
1127 TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
1130 smpi_mpi_recv(buf, count, datatype, src, tag, comm, status);
1131 retval = MPI_SUCCESS;
1134 //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
1135 if(status!=MPI_STATUS_IGNORE)src_traced = smpi_group_index(smpi_comm_group(comm), status->MPI_SOURCE);
1136 TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
1137 TRACE_smpi_recv(rank, src_traced, rank);
1138 TRACE_smpi_computing_in(rank);
1146 int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
1153 if (comm == MPI_COMM_NULL) {
1154 retval = MPI_ERR_COMM;
1155 } else if (dst == MPI_PROC_NULL) {
1156 retval = MPI_SUCCESS;
1157 } else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0){
1158 retval = MPI_ERR_RANK;
1159 } else if (count < 0) {
1160 retval = MPI_ERR_COUNT;
1161 } else if (buf==NULL && count > 0) {
1162 retval = MPI_ERR_COUNT;
1163 } else if (datatype == MPI_DATATYPE_NULL){
1164 retval = MPI_ERR_TYPE;
1165 } else if(tag<0 && tag != MPI_ANY_TAG){
1166 retval = MPI_ERR_TAG;
1170 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1171 TRACE_smpi_computing_out(rank);
1172 int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
1173 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
1174 TRACE_smpi_send(rank, rank, dst_traced);
1177 smpi_mpi_send(buf, count, datatype, dst, tag, comm);
1178 retval = MPI_SUCCESS;
1181 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
1182 TRACE_smpi_computing_in(rank);
1192 int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) {
1197 if (comm == MPI_COMM_NULL) {
1198 retval = MPI_ERR_COMM;
1199 } else if (dst == MPI_PROC_NULL) {
1200 retval = MPI_SUCCESS;
1201 } else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0){
1202 retval = MPI_ERR_RANK;
1203 } else if (count < 0) {
1204 retval = MPI_ERR_COUNT;
1205 } else if (buf==NULL && count > 0) {
1206 retval = MPI_ERR_COUNT;
1207 } else if (datatype == MPI_DATATYPE_NULL){
1208 retval = MPI_ERR_TYPE;
1209 } else if(tag<0 && tag != MPI_ANY_TAG){
1210 retval = MPI_ERR_TAG;
1214 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1215 TRACE_smpi_computing_out(rank);
1216 int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
1217 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
1218 TRACE_smpi_send(rank, rank, dst_traced);
1221 smpi_mpi_ssend(buf, count, datatype, dst, tag, comm);
1222 retval = MPI_SUCCESS;
1225 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
1226 TRACE_smpi_computing_in(rank);
1234 int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1235 int dst, int sendtag, void *recvbuf, int recvcount,
1236 MPI_Datatype recvtype, int src, int recvtag,
1237 MPI_Comm comm, MPI_Status * status)
1243 if (comm == MPI_COMM_NULL) {
1244 retval = MPI_ERR_COMM;
1245 } else if (sendtype == MPI_DATATYPE_NULL
1246 || recvtype == MPI_DATATYPE_NULL) {
1247 retval = MPI_ERR_TYPE;
1248 } else if (src == MPI_PROC_NULL || dst == MPI_PROC_NULL) {
1249 smpi_empty_status(status);
1250 status->MPI_SOURCE = MPI_PROC_NULL;
1251 retval = MPI_SUCCESS;
1252 }else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0 ||
1253 (src!=MPI_ANY_SOURCE && (src >= smpi_group_size(smpi_comm_group(comm)) || src <0))){
1254 retval = MPI_ERR_RANK;
1255 } else if (sendcount < 0 || recvcount<0) {
1256 retval = MPI_ERR_COUNT;
1257 } else if ((sendbuf==NULL && sendcount > 0)||(recvbuf==NULL && recvcount>0)) {
1258 retval = MPI_ERR_COUNT;
1259 } else if((sendtag<0 && sendtag != MPI_ANY_TAG)||(recvtag<0 && recvtag != MPI_ANY_TAG)){
1260 retval = MPI_ERR_TAG;
1264 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1265 TRACE_smpi_computing_out(rank);
1266 int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
1267 int src_traced = smpi_group_index(smpi_comm_group(comm), src);
1268 TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
1269 TRACE_smpi_send(rank, rank, dst_traced);
1273 smpi_mpi_sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf,
1274 recvcount, recvtype, src, recvtag, comm, status);
1275 retval = MPI_SUCCESS;
1278 TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
1279 TRACE_smpi_recv(rank, src_traced, rank);
1280 TRACE_smpi_computing_in(rank);
1289 int PMPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
1290 int dst, int sendtag, int src, int recvtag,
1291 MPI_Comm comm, MPI_Status * status)
1293 //TODO: suboptimal implementation
1296 if (datatype == MPI_DATATYPE_NULL) {
1297 retval = MPI_ERR_TYPE;
1298 } else if (count < 0) {
1299 retval = MPI_ERR_COUNT;
1301 int size = smpi_datatype_get_extent(datatype) * count;
1302 recvbuf = xbt_new(char, size);
1304 MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count,
1305 datatype, src, recvtag, comm, status);
1306 if(retval==MPI_SUCCESS){
1307 smpi_datatype_copy(recvbuf, count, datatype, buf, count, datatype);
1315 int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
1320 if (request == MPI_REQUEST_NULL || flag == NULL) {
1321 retval = MPI_ERR_ARG;
1322 } else if (*request == MPI_REQUEST_NULL) {
1324 retval = MPI_ERR_REQUEST;
1326 *flag = smpi_mpi_test(request, status);
1327 retval = MPI_SUCCESS;
1333 int PMPI_Testany(int count, MPI_Request requests[], int *index, int *flag,
1334 MPI_Status * status)
1339 if (index == NULL || flag == NULL) {
1340 retval = MPI_ERR_ARG;
1342 *flag = smpi_mpi_testany(count, requests, index, status);
1343 retval = MPI_SUCCESS;
1349 int PMPI_Testall(int count, MPI_Request* requests, int* flag, MPI_Status* statuses)
1355 retval = MPI_ERR_ARG;
1357 *flag = smpi_mpi_testall(count, requests, statuses);
1358 retval = MPI_SUCCESS;
1364 int PMPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status* status) {
1368 if (status == NULL) {
1369 retval = MPI_ERR_ARG;
1370 } else if (comm == MPI_COMM_NULL) {
1371 retval = MPI_ERR_COMM;
1372 } else if (source == MPI_PROC_NULL) {
1373 smpi_empty_status(status);
1374 status->MPI_SOURCE = MPI_PROC_NULL;
1375 retval = MPI_SUCCESS;
1377 smpi_mpi_probe(source, tag, comm, status);
1378 retval = MPI_SUCCESS;
1385 int PMPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status) {
1390 retval = MPI_ERR_ARG;
1391 } else if (status == NULL) {
1392 retval = MPI_ERR_ARG;
1393 } else if (comm == MPI_COMM_NULL) {
1394 retval = MPI_ERR_COMM;
1395 } else if (source == MPI_PROC_NULL) {
1396 smpi_empty_status(status);
1397 status->MPI_SOURCE = MPI_PROC_NULL;
1398 retval = MPI_SUCCESS;
1400 smpi_mpi_iprobe(source, tag, comm, flag, status);
1401 retval = MPI_SUCCESS;
1407 int PMPI_Wait(MPI_Request * request, MPI_Status * status)
1413 if (request == NULL) {
1414 retval = MPI_ERR_ARG;
1415 } else if (*request == MPI_REQUEST_NULL) {
1416 retval = MPI_ERR_REQUEST;
1420 int rank = request && (*request)->comm != MPI_COMM_NULL
1421 ? smpi_process_index()
1423 TRACE_smpi_computing_out(rank);
1425 int src_traced = (*request)->src;
1426 int dst_traced = (*request)->dst;
1427 int is_wait_for_receive = (*request)->recv;
1428 TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
1431 smpi_mpi_wait(request, status);
1432 retval = MPI_SUCCESS;
1435 TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
1436 if (is_wait_for_receive) {
1437 TRACE_smpi_recv(rank, src_traced, dst_traced);
1439 TRACE_smpi_computing_in(rank);
1448 int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * status)
1454 //save requests information for tracing
1456 int *srcs = xbt_new(int, count);
1457 int *dsts = xbt_new(int, count);
1458 int *recvs = xbt_new(int, count);
1459 for (i = 0; i < count; i++) {
1460 MPI_Request req = requests[i]; //already received requests are no longer valid
1464 recvs[i] = req->recv;
1467 int rank_traced = smpi_process_index();
1468 TRACE_smpi_computing_out(rank_traced);
1470 TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
1473 if (index == NULL) {
1474 retval = MPI_ERR_ARG;
1476 *index = smpi_mpi_waitany(count, requests, status);
1477 retval = MPI_SUCCESS;
1480 if(*index!=MPI_UNDEFINED){
1481 int src_traced = srcs[*index];
1482 int dst_traced = dsts[*index];
1483 int is_wait_for_receive = recvs[*index];
1484 if (is_wait_for_receive) {
1485 TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
1487 TRACE_smpi_ptp_out(rank_traced, src_traced, dst_traced, __FUNCTION__);
1492 TRACE_smpi_computing_in(rank_traced);
1498 int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
1503 //save information from requests
1505 int *srcs = xbt_new(int, count);
1506 int *dsts = xbt_new(int, count);
1507 int *recvs = xbt_new(int, count);
1508 int valid_count = 0;
1509 for (i = 0; i < count; i++) {
1510 MPI_Request req = requests[i];
1511 if(req!=MPI_REQUEST_NULL){
1512 srcs[valid_count] = req->src;
1513 dsts[valid_count] = req->dst;
1514 recvs[valid_count] = req->recv;
1518 int rank_traced = smpi_process_index();
1519 TRACE_smpi_computing_out(rank_traced);
1521 TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
1523 int retval = smpi_mpi_waitall(count, requests, status);
1525 for (i = 0; i < valid_count; i++) {
1526 int src_traced = srcs[i];
1527 int dst_traced = dsts[i];
1528 int is_wait_for_receive = recvs[i];
1529 if (is_wait_for_receive) {
1530 TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
1533 TRACE_smpi_ptp_out(rank_traced, -1, -1, __FUNCTION__);
1537 TRACE_smpi_computing_in(rank_traced);
1543 int PMPI_Waitsome(int incount, MPI_Request requests[], int *outcount,
1544 int *indices, MPI_Status status[])
1549 if (outcount == NULL || indices == NULL) {
1550 retval = MPI_ERR_ARG;
1552 *outcount = smpi_mpi_waitsome(incount, requests, indices, status);
1553 retval = MPI_SUCCESS;
1559 int PMPI_Testsome(int incount, MPI_Request requests[], int* outcount,
1560 int* indices, MPI_Status status[])
1565 if (outcount == NULL || indices == NULL) {
1566 retval = MPI_ERR_ARG;
1568 *outcount = smpi_mpi_testsome(incount, requests, indices, status);
1569 retval = MPI_SUCCESS;
1576 int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
1582 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1583 TRACE_smpi_computing_out(rank);
1584 int root_traced = smpi_group_index(smpi_comm_group(comm), root);
1585 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1587 if (comm == MPI_COMM_NULL) {
1588 retval = MPI_ERR_COMM;
1590 mpi_coll_bcast_fun(buf, count, datatype, root, comm);
1591 retval = MPI_SUCCESS;
1594 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1595 TRACE_smpi_computing_in(rank);
1601 int PMPI_Barrier(MPI_Comm comm)
1607 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1608 TRACE_smpi_computing_out(rank);
1609 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1611 if (comm == MPI_COMM_NULL) {
1612 retval = MPI_ERR_COMM;
1614 mpi_coll_barrier_fun(comm);
1615 retval = MPI_SUCCESS;
1618 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1619 TRACE_smpi_computing_in(rank);
1625 int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1626 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1627 int root, MPI_Comm comm)
1633 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1634 TRACE_smpi_computing_out(rank);
1635 int root_traced = smpi_group_index(smpi_comm_group(comm), root);
1636 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1638 if (comm == MPI_COMM_NULL) {
1639 retval = MPI_ERR_COMM;
1640 } else if (sendtype == MPI_DATATYPE_NULL
1641 || recvtype == MPI_DATATYPE_NULL) {
1642 retval = MPI_ERR_TYPE;
1644 mpi_coll_gather_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1645 recvtype, root, comm);
1646 retval = MPI_SUCCESS;
1649 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1650 TRACE_smpi_computing_in(rank);
1656 int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1657 void *recvbuf, int *recvcounts, int *displs,
1658 MPI_Datatype recvtype, int root, MPI_Comm comm)
1664 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1665 TRACE_smpi_computing_out(rank);
1666 int root_traced = smpi_group_index(smpi_comm_group(comm), root);
1667 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1669 if (comm == MPI_COMM_NULL) {
1670 retval = MPI_ERR_COMM;
1671 } else if (sendtype == MPI_DATATYPE_NULL
1672 || recvtype == MPI_DATATYPE_NULL) {
1673 retval = MPI_ERR_TYPE;
1674 } else if (recvcounts == NULL || displs == NULL) {
1675 retval = MPI_ERR_ARG;
1677 smpi_mpi_gatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
1678 displs, recvtype, root, comm);
1679 retval = MPI_SUCCESS;
1682 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1683 TRACE_smpi_computing_in(rank);
1689 int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1690 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1697 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1698 TRACE_smpi_computing_out(rank);
1699 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1701 if (comm == MPI_COMM_NULL) {
1702 retval = MPI_ERR_COMM;
1703 } else if (sendtype == MPI_DATATYPE_NULL
1704 || recvtype == MPI_DATATYPE_NULL) {
1705 retval = MPI_ERR_TYPE;
1707 mpi_coll_allgather_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1709 retval = MPI_SUCCESS;
1712 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1718 int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1719 void *recvbuf, int *recvcounts, int *displs,
1720 MPI_Datatype recvtype, MPI_Comm comm)
1726 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1727 TRACE_smpi_computing_out(rank);
1728 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1730 if (comm == MPI_COMM_NULL) {
1731 retval = MPI_ERR_COMM;
1732 } else if (sendtype == MPI_DATATYPE_NULL
1733 || recvtype == MPI_DATATYPE_NULL) {
1734 retval = MPI_ERR_TYPE;
1735 } else if (recvcounts == NULL || displs == NULL) {
1736 retval = MPI_ERR_ARG;
1738 mpi_coll_allgatherv_fun(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
1739 displs, recvtype, comm);
1740 retval = MPI_SUCCESS;
1743 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1744 TRACE_smpi_computing_in(rank);
1750 int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1751 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1752 int root, MPI_Comm comm)
1758 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1759 TRACE_smpi_computing_out(rank);
1760 int root_traced = smpi_group_index(smpi_comm_group(comm), root);
1762 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1764 if (comm == MPI_COMM_NULL) {
1765 retval = MPI_ERR_COMM;
1766 } else if (sendtype == MPI_DATATYPE_NULL
1767 || recvtype == MPI_DATATYPE_NULL) {
1768 retval = MPI_ERR_TYPE;
1770 mpi_coll_scatter_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1771 recvtype, root, comm);
1772 retval = MPI_SUCCESS;
1775 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1776 TRACE_smpi_computing_in(rank);
1782 int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
1783 MPI_Datatype sendtype, void *recvbuf, int recvcount,
1784 MPI_Datatype recvtype, int root, MPI_Comm comm)
1790 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1791 TRACE_smpi_computing_out(rank);
1792 int root_traced = smpi_group_index(smpi_comm_group(comm), root);
1793 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1795 if (comm == MPI_COMM_NULL) {
1796 retval = MPI_ERR_COMM;
1797 } else if (sendtype == MPI_DATATYPE_NULL
1798 || recvtype == MPI_DATATYPE_NULL) {
1799 retval = MPI_ERR_TYPE;
1800 } else if (sendcounts == NULL || displs == NULL) {
1801 retval = MPI_ERR_ARG;
1803 smpi_mpi_scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf,
1804 recvcount, recvtype, root, comm);
1805 retval = MPI_SUCCESS;
1808 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1809 TRACE_smpi_computing_in(rank);
1815 int PMPI_Reduce(void *sendbuf, void *recvbuf, int count,
1816 MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
1822 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1823 TRACE_smpi_computing_out(rank);
1824 int root_traced = smpi_group_index(smpi_comm_group(comm), root);
1825 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1827 if (comm == MPI_COMM_NULL) {
1828 retval = MPI_ERR_COMM;
1829 } else if (datatype == MPI_DATATYPE_NULL || op == MPI_OP_NULL) {
1830 retval = MPI_ERR_ARG;
1832 mpi_coll_reduce_fun(sendbuf, recvbuf, count, datatype, op, root, comm);
1833 retval = MPI_SUCCESS;
1836 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1837 TRACE_smpi_computing_in(rank);
1843 int PMPI_Reduce_local(void *inbuf, void *inoutbuf, int count,
1844 MPI_Datatype datatype, MPI_Op op){
1848 if (datatype == MPI_DATATYPE_NULL || op == MPI_OP_NULL) {
1849 retval = MPI_ERR_ARG;
1851 smpi_op_apply(op, inbuf, inoutbuf, &count, &datatype);
1858 int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count,
1859 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1865 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1866 TRACE_smpi_computing_out(rank);
1867 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1869 if (comm == MPI_COMM_NULL) {
1870 retval = MPI_ERR_COMM;
1871 } else if (datatype == MPI_DATATYPE_NULL) {
1872 retval = MPI_ERR_TYPE;
1873 } else if (op == MPI_OP_NULL) {
1874 retval = MPI_ERR_OP;
1876 mpi_coll_allreduce_fun(sendbuf, recvbuf, count, datatype, op, comm);
1877 retval = MPI_SUCCESS;
1880 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1881 TRACE_smpi_computing_in(rank);
1887 int PMPI_Scan(void *sendbuf, void *recvbuf, int count,
1888 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1894 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1895 TRACE_smpi_computing_out(rank);
1896 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1898 if (comm == MPI_COMM_NULL) {
1899 retval = MPI_ERR_COMM;
1900 } else if (datatype == MPI_DATATYPE_NULL) {
1901 retval = MPI_ERR_TYPE;
1902 } else if (op == MPI_OP_NULL) {
1903 retval = MPI_ERR_OP;
1905 smpi_mpi_scan(sendbuf, recvbuf, count, datatype, op, comm);
1906 retval = MPI_SUCCESS;
1909 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1910 TRACE_smpi_computing_in(rank);
1916 int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
1917 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1922 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1923 TRACE_smpi_computing_out(rank);
1924 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1926 if (comm == MPI_COMM_NULL) {
1927 retval = MPI_ERR_COMM;
1928 } else if (datatype == MPI_DATATYPE_NULL) {
1929 retval = MPI_ERR_TYPE;
1930 } else if (op == MPI_OP_NULL) {
1931 retval = MPI_ERR_OP;
1932 } else if (recvcounts == NULL) {
1933 retval = MPI_ERR_ARG;
1936 mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts,
1937 datatype, op, comm);
1938 retval = MPI_SUCCESS;
1941 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1942 TRACE_smpi_computing_in(rank);
1948 int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
1949 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1954 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1955 TRACE_smpi_computing_out(rank);
1956 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1958 if (comm == MPI_COMM_NULL) {
1959 retval = MPI_ERR_COMM;
1960 } else if (datatype == MPI_DATATYPE_NULL) {
1961 retval = MPI_ERR_TYPE;
1962 } else if (op == MPI_OP_NULL) {
1963 retval = MPI_ERR_OP;
1964 } else if (recvcount < 0) {
1965 retval = MPI_ERR_ARG;
1967 int count=smpi_comm_size(comm);
1968 int* recvcounts=(int*)xbt_malloc(count);
1969 for (i=0; i<count;i++)recvcounts[i]=recvcount;
1970 mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts,
1971 datatype, op, comm);
1972 xbt_free(recvcounts);
1973 retval = MPI_SUCCESS;
1976 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1977 TRACE_smpi_computing_in(rank);
1983 int PMPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1984 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1991 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
1992 TRACE_smpi_computing_out(rank);
1993 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1995 if (comm == MPI_COMM_NULL) {
1996 retval = MPI_ERR_COMM;
1997 } else if (sendtype == MPI_DATATYPE_NULL
1998 || recvtype == MPI_DATATYPE_NULL) {
1999 retval = MPI_ERR_TYPE;
2001 retval = mpi_coll_alltoall_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
2004 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
2005 TRACE_smpi_computing_in(rank);
2011 int PMPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
2012 MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
2013 int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm)
2019 int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
2020 TRACE_smpi_computing_out(rank);
2021 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
2023 if (comm == MPI_COMM_NULL) {
2024 retval = MPI_ERR_COMM;
2025 } else if (sendtype == MPI_DATATYPE_NULL
2026 || recvtype == MPI_DATATYPE_NULL) {
2027 retval = MPI_ERR_TYPE;
2028 } else if (sendcounts == NULL || senddisps == NULL || recvcounts == NULL
2029 || recvdisps == NULL) {
2030 retval = MPI_ERR_ARG;
2033 mpi_coll_alltoallv_fun(sendbuf, sendcounts, senddisps, sendtype,
2034 recvbuf, recvcounts, recvdisps, recvtype,
2038 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
2039 TRACE_smpi_computing_in(rank);
2046 int PMPI_Get_processor_name(char *name, int *resultlen)
2048 int retval = MPI_SUCCESS;
2051 strncpy(name, SIMIX_host_get_name(SIMIX_host_self()),
2052 strlen(SIMIX_host_get_name(SIMIX_host_self())) < MPI_MAX_PROCESSOR_NAME - 1 ?
2053 strlen(SIMIX_host_get_name(SIMIX_host_self())) +1 :
2054 MPI_MAX_PROCESSOR_NAME - 1 );
2057 MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
2063 int PMPI_Get_count(MPI_Status * status, MPI_Datatype datatype, int *count)
2065 int retval = MPI_SUCCESS;
2069 if (status == NULL || count == NULL) {
2070 retval = MPI_ERR_ARG;
2071 } else if (datatype == MPI_DATATYPE_NULL) {
2072 retval = MPI_ERR_TYPE;
2074 size = smpi_datatype_size(datatype);
2077 } else if (status->count % size != 0) {
2078 retval = MPI_UNDEFINED;
2080 *count = smpi_mpi_get_count(status, datatype);
2087 int PMPI_Type_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_type) {
2091 if (old_type == MPI_DATATYPE_NULL) {
2092 retval = MPI_ERR_TYPE;
2093 } else if (count<0){
2094 retval = MPI_ERR_COUNT;
2096 retval = smpi_datatype_contiguous(count, old_type, new_type, 0);
2102 int PMPI_Type_commit(MPI_Datatype* datatype) {
2106 if (datatype == MPI_DATATYPE_NULL) {
2107 retval = MPI_ERR_TYPE;
2109 smpi_datatype_commit(datatype);
2110 retval = MPI_SUCCESS;
2117 int PMPI_Type_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
2121 if (old_type == MPI_DATATYPE_NULL) {
2122 retval = MPI_ERR_TYPE;
2123 } else if (count<0 || blocklen<0){
2124 retval = MPI_ERR_COUNT;
2126 retval = smpi_datatype_vector(count, blocklen, stride, old_type, new_type);
2132 int PMPI_Type_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
2136 if (old_type == MPI_DATATYPE_NULL) {
2137 retval = MPI_ERR_TYPE;
2138 } else if (count<0 || blocklen<0){
2139 retval = MPI_ERR_COUNT;
2141 retval = smpi_datatype_hvector(count, blocklen, stride, old_type, new_type);
2147 int PMPI_Type_create_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
2148 return MPI_Type_hvector(count, blocklen, stride, old_type, new_type);
2151 int PMPI_Type_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
2155 if (old_type == MPI_DATATYPE_NULL) {
2156 retval = MPI_ERR_TYPE;
2157 } else if (count<0){
2158 retval = MPI_ERR_COUNT;
2160 retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
2166 int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
2170 if (old_type == MPI_DATATYPE_NULL) {
2171 retval = MPI_ERR_TYPE;
2172 } else if (count<0){
2173 retval = MPI_ERR_COUNT;
2175 int* blocklens=(int*)xbt_malloc(blocklength*count);
2176 for (i=0; i<count;i++)blocklens[i]=blocklength;
2177 retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
2178 xbt_free(blocklens);
2185 int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
2189 if (old_type == MPI_DATATYPE_NULL) {
2190 retval = MPI_ERR_TYPE;
2191 } else if (count<0){
2192 retval = MPI_ERR_COUNT;
2194 retval = smpi_datatype_hindexed(count, blocklens, indices, old_type, new_type);
2200 int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
2204 if (old_type == MPI_DATATYPE_NULL) {
2205 retval = MPI_ERR_TYPE;
2206 } else if (count<0){
2207 retval = MPI_ERR_COUNT;
2209 int* blocklens=(int*)xbt_malloc(blocklength*count);
2210 for (i=0; i<count;i++)blocklens[i]=blocklength;
2211 retval = smpi_datatype_hindexed(count, blocklens, indices, old_type, new_type);
2212 xbt_free(blocklens);
2219 int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
2224 retval = MPI_ERR_COUNT;
2226 retval = smpi_datatype_struct(count, blocklens, indices, old_types, new_type);
2232 int PMPI_Type_create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
2233 return PMPI_Type_struct(count, blocklens, indices, old_types, new_type);
2237 int PMPI_Error_class(int errorcode, int* errorclass) {
2238 // assume smpi uses only standard mpi error codes
2239 *errorclass=errorcode;
2244 int PMPI_Initialized(int* flag) {
2245 *flag=(smpi_process_data()!=NULL);
2249 /* The following calls are not yet implemented and will fail at runtime. */
2250 /* Once implemented, please move them above this notice. */
2252 #define NOT_YET_IMPLEMENTED {\
2253 XBT_WARN("Not yet implemented : %s. Please contact the Simgrid team if support is needed", __FUNCTION__);\
2254 return MPI_SUCCESS;\
2258 int PMPI_Type_dup(MPI_Datatype datatype, MPI_Datatype *newtype){
2262 int PMPI_Type_set_name(MPI_Datatype datatype, char * name)
2267 int PMPI_Type_get_name(MPI_Datatype datatype, char * name, int* len)
2272 int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
2276 int PMPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int* coords) {
2280 int PMPI_Cart_create(MPI_Comm comm_old, int ndims, int* dims, int* periods, int reorder, MPI_Comm* comm_cart) {
2284 int PMPI_Cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords) {
2288 int PMPI_Cart_map(MPI_Comm comm_old, int ndims, int* dims, int* periods, int* newrank) {
2292 int PMPI_Cart_rank(MPI_Comm comm, int* coords, int* rank) {
2296 int PMPI_Cart_shift(MPI_Comm comm, int direction, int displ, int* source, int* dest) {
2300 int PMPI_Cart_sub(MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new) {
2304 int PMPI_Cartdim_get(MPI_Comm comm, int* ndims) {
2308 int PMPI_Graph_create(MPI_Comm comm_old, int nnodes, int* index, int* edges, int reorder, MPI_Comm* comm_graph) {
2312 int PMPI_Graph_get(MPI_Comm comm, int maxindex, int maxedges, int* index, int* edges) {
2316 int PMPI_Graph_map(MPI_Comm comm_old, int nnodes, int* index, int* edges, int* newrank) {
2320 int PMPI_Graph_neighbors(MPI_Comm comm, int rank, int maxneighbors, int* neighbors) {
2324 int PMPI_Graph_neighbors_count(MPI_Comm comm, int rank, int* nneighbors) {
2328 int PMPI_Graphdims_get(MPI_Comm comm, int* nnodes, int* nedges) {
2332 int PMPI_Topo_test(MPI_Comm comm, int* top_type) {
2336 int PMPI_Errhandler_create(MPI_Handler_function* function, MPI_Errhandler* errhandler) {
2340 int PMPI_Errhandler_free(MPI_Errhandler* errhandler) {
2344 int PMPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler* errhandler) {
2348 int PMPI_Error_string(int errorcode, char* string, int* resultlen) {
2352 int PMPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler) {
2356 int PMPI_Comm_set_errhandler(MPI_Comm comm, MPI_Errhandler errhandler) {
2360 int PMPI_Cancel(MPI_Request* request) {
2364 int PMPI_Buffer_attach(void* buffer, int size) {
2368 int PMPI_Buffer_detach(void* buffer, int* size) {
2372 int PMPI_Comm_test_inter(MPI_Comm comm, int* flag) {
2376 int PMPI_Comm_get_attr (MPI_Comm comm, int comm_keyval, void *attribute_val, int *flag)
2381 int PMPI_Comm_set_attr (MPI_Comm comm, int comm_keyval, void *attribute_val)
2386 int PMPI_Comm_delete_attr (MPI_Comm comm, int comm_keyval)
2391 int PMPI_Comm_create_keyval(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval, void* extra_state)
2396 int PMPI_Comm_free_keyval(int* keyval) {
2400 int PMPI_Pcontrol(const int level )
2405 int PMPI_Unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
2409 int PMPI_Type_get_attr (MPI_Datatype type, int type_keyval, void *attribute_val, int* flag)
2414 int PMPI_Type_set_attr (MPI_Datatype type, int type_keyval, void *attribute_val)
2419 int PMPI_Type_delete_attr (MPI_Datatype type, int comm_keyval)
2424 int PMPI_Type_create_keyval(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state)
2429 int PMPI_Type_free_keyval(int* keyval) {
2433 int PMPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out) {
2437 int PMPI_Intercomm_merge(MPI_Comm comm, int high, MPI_Comm* comm_out) {
2441 int PMPI_Bsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
2445 int PMPI_Bsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
2449 int PMPI_Ibsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
2453 int PMPI_Comm_remote_group(MPI_Comm comm, MPI_Group* group) {
2457 int PMPI_Comm_remote_size(MPI_Comm comm, int* size) {
2461 int PMPI_Attr_delete(MPI_Comm comm, int keyval) {
2465 int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) {
2469 int PMPI_Attr_put(MPI_Comm comm, int keyval, void* attr_value) {
2473 int PMPI_Rsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
2477 int PMPI_Rsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
2481 int PMPI_Irsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
2485 int PMPI_Keyval_create(MPI_Copy_function* copy_fn, MPI_Delete_function* delete_fn, int* keyval, void* extra_state) {
2489 int PMPI_Keyval_free(int* keyval) {
2493 int PMPI_Test_cancelled(MPI_Status* status, int* flag) {
2497 int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
2501 int PMPI_Pack_external_size(char *datarep, int incount, MPI_Datatype datatype, MPI_Aint *size){
2505 int PMPI_Pack_external(char *datarep, void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, MPI_Aint outcount, MPI_Aint *position){
2509 int PMPI_Unpack_external( char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position, void *outbuf, int outcount, MPI_Datatype datatype){
2513 int PMPI_Get_elements(MPI_Status* status, MPI_Datatype datatype, int* elements) {
2517 int PMPI_Dims_create(int nnodes, int ndims, int* dims) {
2521 int PMPI_Win_fence( int assert, MPI_Win win){
2525 int PMPI_Win_free( MPI_Win* win){
2529 int PMPI_Win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win){
2533 int PMPI_Info_create( MPI_Info *info){
2537 int PMPI_Info_set( MPI_Info info, char *key, char *value){
2541 int PMPI_Info_free( MPI_Info *info){
2545 int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
2546 MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win){
2550 int PMPI_Type_get_envelope( MPI_Datatype datatype, int *num_integers,
2551 int *num_addresses, int *num_datatypes, int *combiner){
2555 int PMPI_Type_get_contents(MPI_Datatype datatype, int max_integers, int max_addresses,
2556 int max_datatypes, int* array_of_integers, MPI_Aint* array_of_addresses,
2557 MPI_Datatype* array_of_datatypes){
2561 int PMPI_Type_create_darray(int size, int rank, int ndims, int* array_of_gsizes,
2562 int* array_of_distribs, int* array_of_dargs, int* array_of_psizes,
2563 int order, MPI_Datatype oldtype, MPI_Datatype *newtype) {
2567 int PMPI_Type_create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype){
2571 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){
2575 int PMPI_Type_match_size(int typeclass,int size,MPI_Datatype *datatype){
2579 int PMPI_Alltoallw( void *sendbuf, int *sendcnts, int *sdispls, MPI_Datatype *sendtypes,
2580 void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype *recvtypes,
2585 int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
2586 MPI_Op op, MPI_Comm comm){
2590 int PMPI_Comm_set_name(MPI_Comm comm, char* name){
2594 int PMPI_Comm_dup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm * newcomm){
2598 int PMPI_Comm_split_type(MPI_Comm comm, int split_type, int key, MPI_Info info, MPI_Comm *newcomm){
2602 int PMPI_Comm_set_info (MPI_Comm comm, MPI_Info info){
2606 int PMPI_Comm_get_info (MPI_Comm comm, MPI_Info* info){
2610 int PMPI_Info_get(MPI_Info info,char *key,int valuelen, char *value, int *flag){
2614 int PMPI_Comm_create_errhandler( MPI_Comm_errhandler_fn *function, MPI_Errhandler *errhandler){
2618 int PMPI_Add_error_class( int *errorclass){
2622 int PMPI_Add_error_code( int errorclass, int *errorcode){
2626 int PMPI_Add_error_string( int errorcode, char *string){
2630 int PMPI_Comm_call_errhandler(MPI_Comm comm,int errorcode){
2634 int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo){
2638 int PMPI_Info_delete(MPI_Info info, char *key){
2642 int PMPI_Info_get_nkeys( MPI_Info info, int *nkeys){
2646 int PMPI_Info_get_nthkey( MPI_Info info, int n, char *key){
2650 int PMPI_Info_get_valuelen( MPI_Info info, char *key, int *valuelen, int *flag){
2654 int PMPI_Request_get_status( MPI_Request request, int *flag, MPI_Status *status){
2658 int MPI_Request_get_status( MPI_Request request, int *flag, MPI_Status *status){
2662 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){
2666 int PMPI_Grequest_complete( MPI_Request request){
2670 int PMPI_Status_set_cancelled(MPI_Status *status,int flag){
2674 int PMPI_Status_set_elements( MPI_Status *status, MPI_Datatype datatype, int count){
2678 int PMPI_Comm_connect( char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm){
2682 int PMPI_Publish_name( char *service_name, MPI_Info info, char *port_name){
2686 int PMPI_Unpublish_name( char *service_name, MPI_Info info, char *port_name){
2690 int PMPI_Lookup_name( char *service_name, MPI_Info info, char *port_name){
2694 int PMPI_Comm_join( int fd, MPI_Comm *intercomm){
2698 int PMPI_Open_port( MPI_Info info, char *port_name){
2702 int PMPI_Close_port(char *port_name){
2706 int PMPI_Comm_accept( char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm){
2710 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){
2714 int PMPI_Comm_spawn_multiple( int count, char **array_of_commands, char*** array_of_argv,
2715 int* array_of_maxprocs, MPI_Info* array_of_info, int root,
2716 MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes){
2720 int PMPI_Comm_get_parent( MPI_Comm *parent){