This source file includes following definitions.
- MPI_Ialltoallv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 #include "ompi_config.h"
26 #include <stdio.h>
27
28 #include "ompi/mpi/c/bindings.h"
29 #include "ompi/runtime/params.h"
30 #include "ompi/communicator/communicator.h"
31 #include "ompi/errhandler/errhandler.h"
32 #include "ompi/datatype/ompi_datatype.h"
33 #include "ompi/memchecker.h"
34 #include "ompi/runtime/ompi_spc.h"
35
36 #if OMPI_BUILD_MPI_PROFILING
37 #if OPAL_HAVE_WEAK_SYMBOLS
38 #pragma weak MPI_Ialltoallv = PMPI_Ialltoallv
39 #endif
40 #define MPI_Ialltoallv PMPI_Ialltoallv
41 #endif
42
43 static const char FUNC_NAME[] = "MPI_Ialltoallv";
44
45
46 int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispls[],
47 MPI_Datatype sendtype, void *recvbuf, const int recvcounts[],
48 const int rdispls[], MPI_Datatype recvtype, MPI_Comm comm,
49 MPI_Request *request)
50 {
51 int i, size, err;
52
53 SPC_RECORD(OMPI_SPC_IALLTOALLV, 1);
54
55 MEMCHECKER(
56 ptrdiff_t recv_ext;
57 ptrdiff_t send_ext;
58
59 memchecker_comm(comm);
60
61 if (MPI_IN_PLACE != sendbuf) {
62 memchecker_datatype(sendtype);
63 ompi_datatype_type_extent(sendtype, &send_ext);
64 }
65
66 memchecker_datatype(recvtype);
67 ompi_datatype_type_extent(recvtype, &recv_ext);
68
69 size = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm);
70 for ( i = 0; i < size; i++ ) {
71 if (MPI_IN_PLACE != sendbuf) {
72
73 memchecker_call(&opal_memchecker_base_isdefined,
74 (char *)(sendbuf)+sdispls[i]*send_ext,
75 sendcounts[i], sendtype);
76 }
77
78 memchecker_call(&opal_memchecker_base_isaddressable,
79 (char *)(recvbuf)+rdispls[i]*recv_ext,
80 recvcounts[i], recvtype);
81 }
82 );
83
84 if (MPI_PARAM_CHECK) {
85
86
87
88 err = MPI_SUCCESS;
89 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
90 if (ompi_comm_invalid(comm)) {
91 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
92 FUNC_NAME);
93 }
94
95 if (MPI_IN_PLACE == sendbuf) {
96 sendcounts = recvcounts;
97 sdispls = rdispls;
98 sendtype = recvtype;
99 }
100
101 if ((NULL == sendcounts) || (NULL == sdispls) ||
102 (NULL == recvcounts) || (NULL == rdispls) ||
103 (MPI_IN_PLACE == sendbuf && OMPI_COMM_IS_INTER(comm)) ||
104 MPI_IN_PLACE == recvbuf) {
105 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
106 }
107
108 size = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm);
109 for (i = 0; i < size; ++i) {
110 OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcounts[i]);
111 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
112 OMPI_CHECK_DATATYPE_FOR_RECV(err, recvtype, recvcounts[i]);
113 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
114 }
115
116 if (MPI_IN_PLACE != sendbuf && !OMPI_COMM_IS_INTER(comm)) {
117 int me = ompi_comm_rank(comm);
118 size_t sendtype_size, recvtype_size;
119 ompi_datatype_type_size(sendtype, &sendtype_size);
120 ompi_datatype_type_size(recvtype, &recvtype_size);
121 if ((sendtype_size*sendcounts[me]) != (recvtype_size*recvcounts[me])) {
122 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TRUNCATE, FUNC_NAME);
123 }
124 }
125 }
126
127 OPAL_CR_ENTER_LIBRARY();
128
129
130 err = comm->c_coll->coll_ialltoallv(sendbuf, sendcounts, sdispls,
131 sendtype, recvbuf, recvcounts, rdispls,
132 recvtype, comm, request, comm->c_coll->coll_ialltoallv_module);
133 OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
134 }
135