1 /* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include "smpi_coll_private.h"
9 #include "smpi_mpi_dt_private.h"
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi,
12 "Logging specific to SMPI (mpi)");
14 /* MPI User level calls */
16 int MPI_Init(int *argc, char ***argv)
18 smpi_process_init(argc, argv);
20 TRACE_smpi_init(smpi_process_index());
22 smpi_bench_begin(-1, NULL);
26 int MPI_Finalize(void)
28 smpi_bench_end(-1, NULL);
30 TRACE_smpi_finalize(smpi_process_index());
32 smpi_process_destroy();
36 int MPI_Init_thread(int *argc, char ***argv, int required, int *provided)
38 if (provided != NULL) {
39 *provided = MPI_THREAD_MULTIPLE;
41 return MPI_Init(argc, argv);
44 int MPI_Query_thread(int *provided)
48 smpi_bench_end(-1, NULL);
49 if (provided == NULL) {
52 *provided = MPI_THREAD_MULTIPLE;
55 smpi_bench_begin(-1, NULL);
59 int MPI_Is_thread_main(int *flag)
63 smpi_bench_end(-1, NULL);
67 *flag = smpi_process_index() == 0;
70 smpi_bench_begin(-1, NULL);
74 int MPI_Abort(MPI_Comm comm, int errorcode)
76 smpi_bench_end(-1, NULL);
77 smpi_process_destroy();
78 // FIXME: should kill all processes in comm instead
79 SIMIX_process_kill(SIMIX_process_self());
83 double MPI_Wtime(void)
87 smpi_bench_end(-1, NULL);
88 time = SIMIX_get_clock();
89 smpi_bench_begin(-1, NULL);
93 int MPI_Address(void *location, MPI_Aint * address)
97 smpi_bench_end(-1, NULL);
101 *address = (MPI_Aint) location;
103 smpi_bench_begin(-1, NULL);
107 int MPI_Type_free(MPI_Datatype * datatype)
111 smpi_bench_end(-1, NULL);
113 retval = MPI_ERR_ARG;
115 // FIXME: always fail for now
116 retval = MPI_ERR_TYPE;
118 smpi_bench_begin(-1, NULL);
122 int MPI_Type_size(MPI_Datatype datatype, int *size)
126 smpi_bench_end(-1, NULL);
127 if (datatype == MPI_DATATYPE_NULL) {
128 retval = MPI_ERR_TYPE;
129 } else if (size == NULL) {
130 retval = MPI_ERR_ARG;
132 *size = (int) smpi_datatype_size(datatype);
133 retval = MPI_SUCCESS;
135 smpi_bench_begin(-1, NULL);
139 int MPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint * lb,
144 smpi_bench_end(-1, NULL);
145 if (datatype == MPI_DATATYPE_NULL) {
146 retval = MPI_ERR_TYPE;
147 } else if (lb == NULL || extent == NULL) {
148 retval = MPI_ERR_ARG;
150 retval = smpi_datatype_extent(datatype, lb, extent);
152 smpi_bench_begin(-1, NULL);
156 int MPI_Type_extent(MPI_Datatype datatype, MPI_Aint * extent)
161 smpi_bench_end(-1, NULL);
162 if (datatype == MPI_DATATYPE_NULL) {
163 retval = MPI_ERR_TYPE;
164 } else if (extent == NULL) {
165 retval = MPI_ERR_ARG;
167 retval = smpi_datatype_extent(datatype, &dummy, extent);
169 smpi_bench_begin(-1, NULL);
173 int MPI_Type_lb(MPI_Datatype datatype, MPI_Aint * disp)
177 smpi_bench_end(-1, NULL);
178 if (datatype == MPI_DATATYPE_NULL) {
179 retval = MPI_ERR_TYPE;
180 } else if (disp == NULL) {
181 retval = MPI_ERR_ARG;
183 *disp = smpi_datatype_lb(datatype);
184 retval = MPI_SUCCESS;
186 smpi_bench_begin(-1, NULL);
190 int MPI_Type_ub(MPI_Datatype datatype, MPI_Aint * disp)
194 smpi_bench_end(-1, NULL);
195 if (datatype == MPI_DATATYPE_NULL) {
196 retval = MPI_ERR_TYPE;
197 } else if (disp == NULL) {
198 retval = MPI_ERR_ARG;
200 *disp = smpi_datatype_ub(datatype);
201 retval = MPI_SUCCESS;
203 smpi_bench_begin(-1, NULL);
207 int MPI_Op_create(MPI_User_function * function, int commute, MPI_Op * op)
211 smpi_bench_end(-1, NULL);
212 if (function == NULL || op == NULL) {
213 retval = MPI_ERR_ARG;
215 *op = smpi_op_new(function, commute);
216 retval = MPI_SUCCESS;
218 smpi_bench_begin(-1, NULL);
222 int MPI_Op_free(MPI_Op * op)
226 smpi_bench_end(-1, NULL);
228 retval = MPI_ERR_ARG;
229 } else if (*op == MPI_OP_NULL) {
232 smpi_op_destroy(*op);
234 retval = MPI_SUCCESS;
236 smpi_bench_begin(-1, NULL);
240 int MPI_Group_free(MPI_Group * group)
244 smpi_bench_end(-1, NULL);
246 retval = MPI_ERR_ARG;
248 smpi_group_destroy(*group);
249 *group = MPI_GROUP_NULL;
250 retval = MPI_SUCCESS;
252 smpi_bench_begin(-1, NULL);
256 int MPI_Group_size(MPI_Group group, int *size)
260 smpi_bench_end(-1, NULL);
261 if (group == MPI_GROUP_NULL) {
262 retval = MPI_ERR_GROUP;
263 } else if (size == NULL) {
264 retval = MPI_ERR_ARG;
266 *size = smpi_group_size(group);
267 retval = MPI_SUCCESS;
269 smpi_bench_begin(-1, NULL);
273 int MPI_Group_rank(MPI_Group group, int *rank)
277 smpi_bench_end(-1, NULL);
278 if (group == MPI_GROUP_NULL) {
279 retval = MPI_ERR_GROUP;
280 } else if (rank == NULL) {
281 retval = MPI_ERR_ARG;
283 *rank = smpi_group_rank(group, smpi_process_index());
284 retval = MPI_SUCCESS;
286 smpi_bench_begin(-1, NULL);
290 int MPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
291 MPI_Group group2, int *ranks2)
293 int retval, i, index;
295 smpi_bench_end(-1, NULL);
296 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
297 retval = MPI_ERR_GROUP;
299 for (i = 0; i < n; i++) {
300 index = smpi_group_index(group1, ranks1[i]);
301 ranks2[i] = smpi_group_rank(group2, index);
303 retval = MPI_SUCCESS;
305 smpi_bench_begin(-1, NULL);
309 int MPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result)
313 smpi_bench_end(-1, NULL);
314 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
315 retval = MPI_ERR_GROUP;
316 } else if (result == NULL) {
317 retval = MPI_ERR_ARG;
319 *result = smpi_group_compare(group1, group2);
320 retval = MPI_SUCCESS;
322 smpi_bench_begin(-1, NULL);
326 int MPI_Group_union(MPI_Group group1, MPI_Group group2,
327 MPI_Group * newgroup)
329 int retval, i, proc1, proc2, size, size2;
331 smpi_bench_end(-1, NULL);
332 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
333 retval = MPI_ERR_GROUP;
334 } else if (newgroup == NULL) {
335 retval = MPI_ERR_ARG;
337 size = smpi_group_size(group1);
338 size2 = smpi_group_size(group2);
339 for (i = 0; i < size2; i++) {
340 proc2 = smpi_group_index(group2, i);
341 proc1 = smpi_group_rank(group1, proc2);
342 if (proc1 == MPI_UNDEFINED) {
347 *newgroup = MPI_GROUP_EMPTY;
349 *newgroup = smpi_group_new(size);
350 size2 = smpi_group_size(group1);
351 for (i = 0; i < size2; i++) {
352 proc1 = smpi_group_index(group1, i);
353 smpi_group_set_mapping(*newgroup, proc1, i);
355 for (i = size2; i < size; i++) {
356 proc2 = smpi_group_index(group2, i - size2);
357 smpi_group_set_mapping(*newgroup, proc2, i);
360 smpi_group_use(*newgroup);
361 retval = MPI_SUCCESS;
363 smpi_bench_begin(-1, NULL);
367 int MPI_Group_intersection(MPI_Group group1, MPI_Group group2,
368 MPI_Group * newgroup)
370 int retval, i, proc1, proc2, size, size2;
372 smpi_bench_end(-1, NULL);
373 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
374 retval = MPI_ERR_GROUP;
375 } else if (newgroup == NULL) {
376 retval = MPI_ERR_ARG;
378 size = smpi_group_size(group1);
379 size2 = smpi_group_size(group2);
380 for (i = 0; i < size2; i++) {
381 proc2 = smpi_group_index(group2, i);
382 proc1 = smpi_group_rank(group1, proc2);
383 if (proc1 == MPI_UNDEFINED) {
388 *newgroup = MPI_GROUP_EMPTY;
390 *newgroup = smpi_group_new(size);
391 size2 = smpi_group_size(group1);
392 for (i = 0; i < size2; i++) {
393 proc1 = smpi_group_index(group1, i);
394 proc2 = smpi_group_rank(group2, proc1);
395 if (proc2 != MPI_UNDEFINED) {
396 smpi_group_set_mapping(*newgroup, proc1, i);
400 smpi_group_use(*newgroup);
401 retval = MPI_SUCCESS;
403 smpi_bench_begin(-1, NULL);
407 int MPI_Group_difference(MPI_Group group1, MPI_Group group2,
408 MPI_Group * newgroup)
410 int retval, i, proc1, proc2, size, size2;
412 smpi_bench_end(-1, NULL);
413 if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
414 retval = MPI_ERR_GROUP;
415 } else if (newgroup == NULL) {
416 retval = MPI_ERR_ARG;
418 size = size2 = smpi_group_size(group1);
419 for (i = 0; i < size2; i++) {
420 proc1 = smpi_group_index(group1, i);
421 proc2 = smpi_group_rank(group2, proc1);
422 if (proc2 != MPI_UNDEFINED) {
427 *newgroup = MPI_GROUP_EMPTY;
429 *newgroup = smpi_group_new(size);
430 for (i = 0; i < size2; i++) {
431 proc1 = smpi_group_index(group1, i);
432 proc2 = smpi_group_rank(group2, proc1);
433 if (proc2 == MPI_UNDEFINED) {
434 smpi_group_set_mapping(*newgroup, proc1, i);
438 smpi_group_use(*newgroup);
439 retval = MPI_SUCCESS;
441 smpi_bench_begin(-1, NULL);
445 int MPI_Group_incl(MPI_Group group, int n, int *ranks,
446 MPI_Group * newgroup)
448 int retval, i, index;
450 smpi_bench_end(-1, NULL);
451 if (group == MPI_GROUP_NULL) {
452 retval = MPI_ERR_GROUP;
453 } else if (newgroup == NULL) {
454 retval = MPI_ERR_ARG;
457 *newgroup = MPI_GROUP_EMPTY;
458 } else if (n == smpi_group_size(group)) {
461 *newgroup = smpi_group_new(n);
462 for (i = 0; i < n; i++) {
463 index = smpi_group_index(group, ranks[i]);
464 smpi_group_set_mapping(*newgroup, index, i);
467 smpi_group_use(*newgroup);
468 retval = MPI_SUCCESS;
470 smpi_bench_begin(-1, NULL);
474 int MPI_Group_excl(MPI_Group group, int n, int *ranks,
475 MPI_Group * newgroup)
477 int retval, i, size, rank, index;
479 smpi_bench_end(-1, NULL);
480 if (group == MPI_GROUP_NULL) {
481 retval = MPI_ERR_GROUP;
482 } else if (newgroup == NULL) {
483 retval = MPI_ERR_ARG;
487 } else if (n == smpi_group_size(group)) {
488 *newgroup = MPI_GROUP_EMPTY;
490 size = smpi_group_size(group) - n;
491 *newgroup = smpi_group_new(size);
493 while (rank < size) {
494 for (i = 0; i < n; i++) {
495 if (ranks[i] == rank) {
500 index = smpi_group_index(group, rank);
501 smpi_group_set_mapping(*newgroup, index, rank);
506 smpi_group_use(*newgroup);
507 retval = MPI_SUCCESS;
509 smpi_bench_begin(-1, NULL);
513 int MPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
514 MPI_Group * newgroup)
516 int retval, i, j, rank, size, index;
518 smpi_bench_end(-1, NULL);
519 if (group == MPI_GROUP_NULL) {
520 retval = MPI_ERR_GROUP;
521 } else if (newgroup == NULL) {
522 retval = MPI_ERR_ARG;
525 *newgroup = MPI_GROUP_EMPTY;
528 for (i = 0; i < n; i++) {
529 for (rank = ranges[i][0]; /* First */
530 rank >= 0 && rank <= ranges[i][1]; /* Last */
531 rank += ranges[i][2] /* Stride */ ) {
535 if (size == smpi_group_size(group)) {
538 *newgroup = smpi_group_new(size);
540 for (i = 0; i < n; i++) {
541 for (rank = ranges[i][0]; /* First */
542 rank >= 0 && rank <= ranges[i][1]; /* Last */
543 rank += ranges[i][2] /* Stride */ ) {
544 index = smpi_group_index(group, rank);
545 smpi_group_set_mapping(*newgroup, index, j);
551 smpi_group_use(*newgroup);
552 retval = MPI_SUCCESS;
554 smpi_bench_begin(-1, NULL);
558 int MPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
559 MPI_Group * newgroup)
561 int retval, i, newrank, rank, size, index, add;
563 smpi_bench_end(-1, NULL);
564 if (group == MPI_GROUP_NULL) {
565 retval = MPI_ERR_GROUP;
566 } else if (newgroup == NULL) {
567 retval = MPI_ERR_ARG;
572 size = smpi_group_size(group);
573 for (i = 0; i < n; i++) {
574 for (rank = ranges[i][0]; /* First */
575 rank >= 0 && rank <= ranges[i][1]; /* Last */
576 rank += ranges[i][2] /* Stride */ ) {
581 *newgroup = MPI_GROUP_EMPTY;
583 *newgroup = smpi_group_new(size);
585 while (newrank < size) {
586 for (i = 0; i < n; i++) {
588 for (rank = ranges[i][0]; /* First */
589 rank >= 0 && rank <= ranges[i][1]; /* Last */
590 rank += ranges[i][2] /* Stride */ ) {
591 if (rank == newrank) {
597 index = smpi_group_index(group, newrank);
598 smpi_group_set_mapping(*newgroup, index, newrank);
604 smpi_group_use(*newgroup);
605 retval = MPI_SUCCESS;
607 smpi_bench_begin(-1, NULL);
611 int MPI_Comm_rank(MPI_Comm comm, int *rank)
615 smpi_bench_end(-1, NULL);
616 if (comm == MPI_COMM_NULL) {
617 retval = MPI_ERR_COMM;
619 *rank = smpi_comm_rank(comm);
620 retval = MPI_SUCCESS;
622 smpi_bench_begin(-1, NULL);
626 int MPI_Comm_size(MPI_Comm comm, int *size)
630 smpi_bench_end(-1, NULL);
631 if (comm == MPI_COMM_NULL) {
632 retval = MPI_ERR_COMM;
633 } else if (size == NULL) {
634 retval = MPI_ERR_ARG;
636 *size = smpi_comm_size(comm);
637 retval = MPI_SUCCESS;
639 smpi_bench_begin(-1, NULL);
643 int MPI_Comm_group(MPI_Comm comm, MPI_Group * group)
647 smpi_bench_end(-1, NULL);
648 if (comm == MPI_COMM_NULL) {
649 retval = MPI_ERR_COMM;
650 } else if (group == NULL) {
651 retval = MPI_ERR_ARG;
653 *group = smpi_comm_group(comm);
654 retval = MPI_SUCCESS;
656 smpi_bench_begin(-1, NULL);
660 int MPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result)
664 smpi_bench_end(-1, NULL);
665 if (comm1 == MPI_COMM_NULL || comm2 == MPI_COMM_NULL) {
666 retval = MPI_ERR_COMM;
667 } else if (result == NULL) {
668 retval = MPI_ERR_ARG;
670 if (comm1 == comm2) { /* Same communicators means same groups */
674 smpi_group_compare(smpi_comm_group(comm1),
675 smpi_comm_group(comm2));
676 if (*result == MPI_IDENT) {
677 *result = MPI_CONGRUENT;
680 retval = MPI_SUCCESS;
682 smpi_bench_begin(-1, NULL);
686 int MPI_Comm_dup(MPI_Comm comm, MPI_Comm * newcomm)
690 smpi_bench_end(-1, NULL);
691 if (comm == MPI_COMM_NULL) {
692 retval = MPI_ERR_COMM;
693 } else if (newcomm == NULL) {
694 retval = MPI_ERR_ARG;
696 *newcomm = smpi_comm_new(smpi_comm_group(comm));
697 retval = MPI_SUCCESS;
699 smpi_bench_begin(-1, NULL);
703 int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm)
707 smpi_bench_end(-1, NULL);
708 if (comm == MPI_COMM_NULL) {
709 retval = MPI_ERR_COMM;
710 } else if (group == MPI_GROUP_NULL) {
711 retval = MPI_ERR_GROUP;
712 } else if (newcomm == NULL) {
713 retval = MPI_ERR_ARG;
715 *newcomm = smpi_comm_new(group);
716 retval = MPI_SUCCESS;
718 smpi_bench_begin(-1, NULL);
722 int MPI_Comm_free(MPI_Comm * comm)
726 smpi_bench_end(-1, NULL);
728 retval = MPI_ERR_ARG;
729 } else if (*comm == MPI_COMM_NULL) {
730 retval = MPI_ERR_COMM;
732 smpi_comm_destroy(*comm);
733 *comm = MPI_COMM_NULL;
734 retval = MPI_SUCCESS;
736 smpi_bench_begin(-1, NULL);
740 int MPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst,
741 int tag, MPI_Comm comm, MPI_Request * request)
744 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
746 smpi_bench_end(rank, "Send_init");
747 if (request == NULL) {
748 retval = MPI_ERR_ARG;
749 } else if (comm == MPI_COMM_NULL) {
750 retval = MPI_ERR_COMM;
752 *request = smpi_mpi_send_init(buf, count, datatype, dst, tag, comm);
753 retval = MPI_SUCCESS;
755 smpi_bench_begin(rank, "Send_init");
759 int MPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src,
760 int tag, MPI_Comm comm, MPI_Request * request)
763 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
765 smpi_bench_end(rank, "Recv_init");
766 if (request == NULL) {
767 retval = MPI_ERR_ARG;
768 } else if (comm == MPI_COMM_NULL) {
769 retval = MPI_ERR_COMM;
771 *request = smpi_mpi_recv_init(buf, count, datatype, src, tag, comm);
772 retval = MPI_SUCCESS;
774 smpi_bench_begin(rank, "Recv_init");
778 int MPI_Start(MPI_Request * request)
781 MPI_Comm comm = (*request)->comm;
782 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
784 smpi_bench_end(rank, "Start");
785 if (request == NULL) {
786 retval = MPI_ERR_ARG;
788 smpi_mpi_start(*request);
789 retval = MPI_SUCCESS;
791 smpi_bench_begin(rank, "Start");
795 int MPI_Startall(int count, MPI_Request * requests)
798 MPI_Comm comm = count > 0
799 && requests ? requests[0]->comm : MPI_COMM_NULL;
800 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
802 smpi_bench_end(rank, "Startall");
803 if (requests == NULL) {
804 retval = MPI_ERR_ARG;
806 smpi_mpi_startall(count, requests);
807 retval = MPI_SUCCESS;
809 smpi_bench_begin(rank, "Startall");
813 int MPI_Request_free(MPI_Request * request)
816 MPI_Comm comm = (*request)->comm;
817 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
819 smpi_bench_end(rank, "Request_free");
820 if (request == NULL) {
821 retval = MPI_ERR_ARG;
823 smpi_mpi_request_free(request);
824 retval = MPI_SUCCESS;
826 smpi_bench_begin(rank, "Request_free");
830 int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
831 int tag, MPI_Comm comm, MPI_Request * request)
834 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
836 smpi_bench_end(rank, "Irecv");
838 int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
839 TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
841 if (request == NULL) {
842 retval = MPI_ERR_ARG;
843 } else if (comm == MPI_COMM_NULL) {
844 retval = MPI_ERR_COMM;
846 *request = smpi_mpi_irecv(buf, count, datatype, src, tag, comm);
847 retval = MPI_SUCCESS;
850 TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
851 (*request)->recv = 1;
853 smpi_bench_begin(rank, "Irecv");
857 int MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst,
858 int tag, MPI_Comm comm, MPI_Request * request)
861 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
863 smpi_bench_end(rank, "Isend");
865 int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
866 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
867 TRACE_smpi_send(rank, rank, dst_traced);
869 if (request == NULL) {
870 retval = MPI_ERR_ARG;
871 } else if (comm == MPI_COMM_NULL) {
872 retval = MPI_ERR_COMM;
874 *request = smpi_mpi_isend(buf, count, datatype, dst, tag, comm);
875 retval = MPI_SUCCESS;
878 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
879 (*request)->send = 1;
881 smpi_bench_begin(rank, "Isend");
885 int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag,
886 MPI_Comm comm, MPI_Status * status)
889 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
891 smpi_bench_end(rank, "Recv");
893 int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
894 TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
896 if (comm == MPI_COMM_NULL) {
897 retval = MPI_ERR_COMM;
899 smpi_mpi_recv(buf, count, datatype, src, tag, comm, status);
900 retval = MPI_SUCCESS;
903 TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
904 TRACE_smpi_recv(rank, src_traced, rank);
906 smpi_bench_begin(rank, "Recv");
910 int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
914 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
916 smpi_bench_end(rank, "Send");
918 int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
919 TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
920 TRACE_smpi_send(rank, rank, dst_traced);
922 if (comm == MPI_COMM_NULL) {
923 retval = MPI_ERR_COMM;
925 smpi_mpi_send(buf, count, datatype, dst, tag, comm);
926 retval = MPI_SUCCESS;
929 TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
931 smpi_bench_begin(rank, "Send");
935 int MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
936 int dst, int sendtag, void *recvbuf, int recvcount,
937 MPI_Datatype recvtype, int src, int recvtag,
938 MPI_Comm comm, MPI_Status * status)
941 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
943 smpi_bench_end(rank, "Sendrecv");
945 int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
946 int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
947 TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
948 TRACE_smpi_send(rank, rank, dst_traced);
949 TRACE_smpi_send(rank, src_traced, rank);
951 if (comm == MPI_COMM_NULL) {
952 retval = MPI_ERR_COMM;
953 } else if (sendtype == MPI_DATATYPE_NULL
954 || recvtype == MPI_DATATYPE_NULL) {
955 retval = MPI_ERR_TYPE;
957 smpi_mpi_sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf,
958 recvcount, recvtype, src, recvtag, comm, status);
959 retval = MPI_SUCCESS;
962 TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
963 TRACE_smpi_recv(rank, rank, dst_traced);
964 TRACE_smpi_recv(rank, src_traced, rank);
966 smpi_bench_begin(rank, "Sendrecv");
970 int MPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
971 int dst, int sendtag, int src, int recvtag,
972 MPI_Comm comm, MPI_Status * status)
974 //TODO: suboptimal implementation
978 size = smpi_datatype_size(datatype) * count;
979 recvbuf = xbt_new(char, size);
981 MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count,
982 datatype, src, recvtag, comm, status);
983 memcpy(buf, recvbuf, size * sizeof(char));
988 int MPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
991 int rank = request && (*request)->comm != MPI_COMM_NULL
992 ? smpi_comm_rank((*request)->comm)
995 smpi_bench_end(rank, "Test");
996 if (request == NULL || flag == NULL) {
997 retval = MPI_ERR_ARG;
998 } else if (*request == MPI_REQUEST_NULL) {
999 retval = MPI_ERR_REQUEST;
1001 *flag = smpi_mpi_test(request, status);
1002 retval = MPI_SUCCESS;
1004 smpi_bench_begin(rank, "Test");
1008 int MPI_Testany(int count, MPI_Request requests[], int *index, int *flag,
1009 MPI_Status * status)
1013 smpi_bench_end(-1, NULL); //FIXME
1014 if (index == NULL || flag == NULL) {
1015 retval = MPI_ERR_ARG;
1017 *flag = smpi_mpi_testany(count, requests, index, status);
1018 retval = MPI_SUCCESS;
1020 smpi_bench_begin(-1, NULL);
1024 int MPI_Wait(MPI_Request * request, MPI_Status * status)
1027 int rank = request && (*request)->comm != MPI_COMM_NULL
1028 ? smpi_comm_rank((*request)->comm)
1031 smpi_bench_end(rank, "Wait");
1033 MPI_Group group = smpi_comm_group((*request)->comm);
1034 int src_traced = smpi_group_rank(group, (*request)->src);
1035 int dst_traced = smpi_group_rank(group, (*request)->dst);
1036 int is_wait_for_receive = (*request)->recv;
1037 TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
1039 if (request == NULL) {
1040 retval = MPI_ERR_ARG;
1041 } else if (*request == MPI_REQUEST_NULL) {
1042 retval = MPI_ERR_REQUEST;
1044 smpi_mpi_wait(request, status);
1045 retval = MPI_SUCCESS;
1048 TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
1049 if (is_wait_for_receive) {
1050 TRACE_smpi_recv(rank, src_traced, dst_traced);
1053 smpi_bench_begin(rank, "Wait");
1057 int MPI_Waitany(int count, MPI_Request requests[], int *index,
1058 MPI_Status * status)
1062 smpi_bench_end(-1, NULL); //FIXME
1064 //save requests information for tracing
1066 xbt_dynar_t srcs = xbt_dynar_new(sizeof(int), xbt_free);
1067 xbt_dynar_t dsts = xbt_dynar_new(sizeof(int), xbt_free);
1068 xbt_dynar_t recvs = xbt_dynar_new(sizeof(int), xbt_free);
1069 for (i = 0; i < count; i++) {
1070 MPI_Request req = requests[i]; //already received requests are no longer valid
1072 int *asrc = xbt_new(int, 1);
1073 int *adst = xbt_new(int, 1);
1074 int *arecv = xbt_new(int, 1);
1078 xbt_dynar_insert_at(srcs, i, asrc);
1079 xbt_dynar_insert_at(dsts, i, adst);
1080 xbt_dynar_insert_at(recvs, i, arecv);
1082 int *t = xbt_new(int, 1);
1083 xbt_dynar_insert_at(srcs, i, t);
1084 xbt_dynar_insert_at(dsts, i, t);
1085 xbt_dynar_insert_at(recvs, i, t);
1088 int rank_traced = smpi_comm_rank(MPI_COMM_WORLD);
1089 TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
1091 if (index == NULL) {
1092 retval = MPI_ERR_ARG;
1094 *index = smpi_mpi_waitany(count, requests, status);
1095 retval = MPI_SUCCESS;
1098 int src_traced, dst_traced, is_wait_for_receive;
1099 xbt_dynar_get_cpy(srcs, *index, &src_traced);
1100 xbt_dynar_get_cpy(dsts, *index, &dst_traced);
1101 xbt_dynar_get_cpy(recvs, *index, &is_wait_for_receive);
1102 if (is_wait_for_receive) {
1103 TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
1105 TRACE_smpi_ptp_out(rank_traced, src_traced, dst_traced, __FUNCTION__);
1106 //clean-up of dynars
1111 smpi_bench_begin(-1, NULL);
1115 int MPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
1118 smpi_bench_end(-1, NULL); //FIXME
1120 //save information from requests
1122 xbt_dynar_t srcs = xbt_dynar_new(sizeof(int), xbt_free);
1123 xbt_dynar_t dsts = xbt_dynar_new(sizeof(int), xbt_free);
1124 xbt_dynar_t recvs = xbt_dynar_new(sizeof(int), xbt_free);
1125 for (i = 0; i < count; i++) {
1126 MPI_Request req = requests[i]; //all req should be valid in Waitall
1127 int *asrc = xbt_new(int, 1);
1128 int *adst = xbt_new(int, 1);
1129 int *arecv = xbt_new(int, 1);
1133 xbt_dynar_insert_at(srcs, i, asrc);
1134 xbt_dynar_insert_at(dsts, i, adst);
1135 xbt_dynar_insert_at(recvs, i, arecv);
1137 int rank_traced = smpi_comm_rank (MPI_COMM_WORLD);
1138 TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
1140 smpi_mpi_waitall(count, requests, status);
1142 for (i = 0; i < count; i++) {
1143 int src_traced, dst_traced, is_wait_for_receive;
1144 xbt_dynar_get_cpy(srcs, i, &src_traced);
1145 xbt_dynar_get_cpy(dsts, i, &dst_traced);
1146 xbt_dynar_get_cpy(recvs, i, &is_wait_for_receive);
1147 if (is_wait_for_receive) {
1148 TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
1151 TRACE_smpi_ptp_out(rank_traced, -1, -1, __FUNCTION__);
1152 //clean-up of dynars
1157 smpi_bench_begin(-1, NULL);
1161 int MPI_Waitsome(int incount, MPI_Request requests[], int *outcount,
1162 int *indices, MPI_Status status[])
1166 smpi_bench_end(-1, NULL); //FIXME
1167 if (outcount == NULL || indices == NULL) {
1168 retval = MPI_ERR_ARG;
1170 *outcount = smpi_mpi_waitsome(incount, requests, indices, status);
1171 retval = MPI_SUCCESS;
1173 smpi_bench_begin(-1, NULL);
1177 int MPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root,
1181 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1183 smpi_bench_end(rank, "Bcast");
1185 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1186 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1188 if (comm == MPI_COMM_NULL) {
1189 retval = MPI_ERR_COMM;
1191 smpi_mpi_bcast(buf, count, datatype, root, comm);
1192 retval = MPI_SUCCESS;
1195 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1197 smpi_bench_begin(rank, "Bcast");
1201 int MPI_Barrier(MPI_Comm comm)
1204 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1206 smpi_bench_end(rank, "Barrier");
1208 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1210 if (comm == MPI_COMM_NULL) {
1211 retval = MPI_ERR_COMM;
1213 smpi_mpi_barrier(comm);
1214 retval = MPI_SUCCESS;
1217 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1219 smpi_bench_begin(rank, "Barrier");
1223 int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1224 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1225 int root, MPI_Comm comm)
1228 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1230 smpi_bench_end(rank, "Gather");
1232 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1233 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1235 if (comm == MPI_COMM_NULL) {
1236 retval = MPI_ERR_COMM;
1237 } else if (sendtype == MPI_DATATYPE_NULL
1238 || recvtype == MPI_DATATYPE_NULL) {
1239 retval = MPI_ERR_TYPE;
1241 smpi_mpi_gather(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1242 recvtype, root, comm);
1243 retval = MPI_SUCCESS;
1246 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1248 smpi_bench_begin(rank, "Gather");
1252 int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1253 void *recvbuf, int *recvcounts, int *displs,
1254 MPI_Datatype recvtype, int root, MPI_Comm comm)
1257 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1259 smpi_bench_end(rank, "Gatherv");
1261 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1262 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1264 if (comm == MPI_COMM_NULL) {
1265 retval = MPI_ERR_COMM;
1266 } else if (sendtype == MPI_DATATYPE_NULL
1267 || recvtype == MPI_DATATYPE_NULL) {
1268 retval = MPI_ERR_TYPE;
1269 } else if (recvcounts == NULL || displs == NULL) {
1270 retval = MPI_ERR_ARG;
1272 smpi_mpi_gatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
1273 displs, recvtype, root, comm);
1274 retval = MPI_SUCCESS;
1277 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1279 smpi_bench_begin(rank, "Gatherv");
1283 int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1284 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1288 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1290 smpi_bench_end(rank, "Allgather");
1292 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1294 if (comm == MPI_COMM_NULL) {
1295 retval = MPI_ERR_COMM;
1296 } else if (sendtype == MPI_DATATYPE_NULL
1297 || recvtype == MPI_DATATYPE_NULL) {
1298 retval = MPI_ERR_TYPE;
1300 smpi_mpi_allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1302 retval = MPI_SUCCESS;
1305 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1307 smpi_bench_begin(rank, "Allgather");
1311 int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1312 void *recvbuf, int *recvcounts, int *displs,
1313 MPI_Datatype recvtype, MPI_Comm comm)
1316 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1318 smpi_bench_end(rank, "Allgatherv");
1320 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1322 if (comm == MPI_COMM_NULL) {
1323 retval = MPI_ERR_COMM;
1324 } else if (sendtype == MPI_DATATYPE_NULL
1325 || recvtype == MPI_DATATYPE_NULL) {
1326 retval = MPI_ERR_TYPE;
1327 } else if (recvcounts == NULL || displs == NULL) {
1328 retval = MPI_ERR_ARG;
1330 smpi_mpi_allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
1331 displs, recvtype, comm);
1332 retval = MPI_SUCCESS;
1335 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1337 smpi_bench_begin(rank, "Allgatherv");
1341 int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1342 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1343 int root, MPI_Comm comm)
1346 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1348 smpi_bench_end(rank, "Scatter");
1350 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1351 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1353 if (comm == MPI_COMM_NULL) {
1354 retval = MPI_ERR_COMM;
1355 } else if (sendtype == MPI_DATATYPE_NULL
1356 || recvtype == MPI_DATATYPE_NULL) {
1357 retval = MPI_ERR_TYPE;
1359 smpi_mpi_scatter(sendbuf, sendcount, sendtype, recvbuf, recvcount,
1360 recvtype, root, comm);
1361 retval = MPI_SUCCESS;
1364 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1366 smpi_bench_begin(rank, "Scatter");
1370 int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
1371 MPI_Datatype sendtype, void *recvbuf, int recvcount,
1372 MPI_Datatype recvtype, int root, MPI_Comm comm)
1375 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1377 smpi_bench_end(rank, "Scatterv");
1379 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1380 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1382 if (comm == MPI_COMM_NULL) {
1383 retval = MPI_ERR_COMM;
1384 } else if (sendtype == MPI_DATATYPE_NULL
1385 || recvtype == MPI_DATATYPE_NULL) {
1386 retval = MPI_ERR_TYPE;
1387 } else if (sendcounts == NULL || displs == NULL) {
1388 retval = MPI_ERR_ARG;
1390 smpi_mpi_scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf,
1391 recvcount, recvtype, root, comm);
1392 retval = MPI_SUCCESS;
1395 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1397 smpi_bench_begin(rank, "Scatterv");
1401 int MPI_Reduce(void *sendbuf, void *recvbuf, int count,
1402 MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
1405 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1407 smpi_bench_end(rank, "Reduce");
1409 int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
1410 TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
1412 if (comm == MPI_COMM_NULL) {
1413 retval = MPI_ERR_COMM;
1414 } else if (datatype == MPI_DATATYPE_NULL || op == MPI_OP_NULL) {
1415 retval = MPI_ERR_ARG;
1417 smpi_mpi_reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
1418 retval = MPI_SUCCESS;
1421 TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
1423 smpi_bench_begin(rank, "Reduce");
1427 int MPI_Allreduce(void *sendbuf, void *recvbuf, int count,
1428 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1431 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1433 smpi_bench_end(rank, "Allreduce");
1435 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1437 if (comm == MPI_COMM_NULL) {
1438 retval = MPI_ERR_COMM;
1439 } else if (datatype == MPI_DATATYPE_NULL) {
1440 retval = MPI_ERR_TYPE;
1441 } else if (op == MPI_OP_NULL) {
1442 retval = MPI_ERR_OP;
1444 smpi_mpi_allreduce(sendbuf, recvbuf, count, datatype, op, comm);
1445 retval = MPI_SUCCESS;
1448 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1450 smpi_bench_begin(rank, "Allreduce");
1454 int MPI_Scan(void *sendbuf, void *recvbuf, int count,
1455 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1458 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1460 smpi_bench_end(rank, "Scan");
1462 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1464 if (comm == MPI_COMM_NULL) {
1465 retval = MPI_ERR_COMM;
1466 } else if (datatype == MPI_DATATYPE_NULL) {
1467 retval = MPI_ERR_TYPE;
1468 } else if (op == MPI_OP_NULL) {
1469 retval = MPI_ERR_OP;
1471 smpi_mpi_scan(sendbuf, recvbuf, count, datatype, op, comm);
1472 retval = MPI_SUCCESS;
1475 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1477 smpi_bench_begin(rank, "Scan");
1481 int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
1482 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
1484 int retval, i, size, count;
1486 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1488 smpi_bench_end(rank, "Reduce_scatter");
1490 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1492 if (comm == MPI_COMM_NULL) {
1493 retval = MPI_ERR_COMM;
1494 } else if (datatype == MPI_DATATYPE_NULL) {
1495 retval = MPI_ERR_TYPE;
1496 } else if (op == MPI_OP_NULL) {
1497 retval = MPI_ERR_OP;
1498 } else if (recvcounts == NULL) {
1499 retval = MPI_ERR_ARG;
1501 /* arbitrarily choose root as rank 0 */
1502 /* TODO: faster direct implementation ? */
1503 size = smpi_comm_size(comm);
1505 displs = xbt_new(int, size);
1506 for (i = 0; i < size; i++) {
1507 count += recvcounts[i];
1510 smpi_mpi_reduce(sendbuf, recvbuf, count, datatype, op, 0, comm);
1511 smpi_mpi_scatterv(recvbuf, recvcounts, displs, datatype, recvbuf,
1512 recvcounts[rank], datatype, 0, comm);
1514 retval = MPI_SUCCESS;
1517 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1519 smpi_bench_begin(rank, "Reduce_scatter");
1523 int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
1524 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1527 int retval, size, sendsize;
1528 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1530 smpi_bench_end(rank, "Alltoall");
1532 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1534 if (comm == MPI_COMM_NULL) {
1535 retval = MPI_ERR_COMM;
1536 } else if (sendtype == MPI_DATATYPE_NULL
1537 || recvtype == MPI_DATATYPE_NULL) {
1538 retval = MPI_ERR_TYPE;
1540 size = smpi_comm_size(comm);
1541 sendsize = smpi_datatype_size(sendtype) * sendcount;
1542 if (sendsize < 200 && size > 12) {
1544 smpi_coll_tuned_alltoall_bruck(sendbuf, sendcount, sendtype,
1545 recvbuf, recvcount, recvtype,
1547 } else if (sendsize < 3000) {
1549 smpi_coll_tuned_alltoall_basic_linear(sendbuf, sendcount,
1551 recvcount, recvtype, comm);
1554 smpi_coll_tuned_alltoall_pairwise(sendbuf, sendcount, sendtype,
1555 recvbuf, recvcount, recvtype,
1560 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1562 smpi_bench_begin(rank, "Alltoall");
1566 int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
1567 MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
1568 int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm)
1571 int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
1573 smpi_bench_end(rank, "Alltoallv");
1575 TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
1577 if (comm == MPI_COMM_NULL) {
1578 retval = MPI_ERR_COMM;
1579 } else if (sendtype == MPI_DATATYPE_NULL
1580 || recvtype == MPI_DATATYPE_NULL) {
1581 retval = MPI_ERR_TYPE;
1582 } else if (sendcounts == NULL || senddisps == NULL || recvcounts == NULL
1583 || recvdisps == NULL) {
1584 retval = MPI_ERR_ARG;
1587 smpi_coll_basic_alltoallv(sendbuf, sendcounts, senddisps, sendtype,
1588 recvbuf, recvcounts, recvdisps, recvtype,
1592 TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
1594 smpi_bench_begin(rank, "Alltoallv");
1599 int MPI_Get_processor_name(char *name, int *resultlen)
1601 int retval = MPI_SUCCESS;
1603 smpi_bench_end(-1, NULL);
1604 strncpy(name, SIMIX_host_get_name(SIMIX_host_self()),
1605 MPI_MAX_PROCESSOR_NAME - 1);
1608 MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
1610 smpi_bench_begin(-1, NULL);
1614 int MPI_Get_count(MPI_Status * status, MPI_Datatype datatype, int *count)
1616 int retval = MPI_SUCCESS;
1619 smpi_bench_end(-1, NULL);
1620 if (status == NULL || count == NULL) {
1621 retval = MPI_ERR_ARG;
1622 } else if (datatype == MPI_DATATYPE_NULL) {
1623 retval = MPI_ERR_TYPE;
1625 size = smpi_datatype_size(datatype);
1628 } else if (status->count % size != 0) {
1629 retval = MPI_UNDEFINED;
1631 *count = smpi_mpi_get_count(status, datatype);
1634 smpi_bench_begin(-1, NULL);