This source file includes following definitions.
- MPI_Ineighbor_alltoallv
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
26 #include "ompi_config.h"
27 #include <stdio.h>
28
29 #include "ompi/mpi/c/bindings.h"
30 #include "ompi/runtime/params.h"
31 #include "ompi/communicator/communicator.h"
32 #include "ompi/errhandler/errhandler.h"
33 #include "ompi/datatype/ompi_datatype.h"
34 #include "ompi/memchecker.h"
35 #include "ompi/mca/topo/topo.h"
36 #include "ompi/mca/topo/base/base.h"
37 #include "ompi/runtime/ompi_spc.h"
38
39 #if OMPI_BUILD_MPI_PROFILING
40 #if OPAL_HAVE_WEAK_SYMBOLS
41 #pragma weak MPI_Ineighbor_alltoallv = PMPI_Ineighbor_alltoallv
42 #endif
43 #define MPI_Ineighbor_alltoallv PMPI_Ineighbor_alltoallv
44 #endif
45
46 static const char FUNC_NAME[] = "MPI_Ineighbor_alltoallv";
47
48
49 int MPI_Ineighbor_alltoallv(const void *sendbuf, const int sendcounts[], const int sdispls[],
50 MPI_Datatype sendtype, void *recvbuf, const int recvcounts[],
51 const int rdispls[], MPI_Datatype recvtype, MPI_Comm comm,
52 MPI_Request *request)
53 {
54 int i, err;
55 int indegree, outdegree;
56
57 SPC_RECORD(OMPI_SPC_INEIGHBOR_ALLTOALLV, 1);
58
59 MEMCHECKER(
60 ptrdiff_t recv_ext;
61 ptrdiff_t send_ext;
62
63 memchecker_comm(comm);
64
65 if (MPI_IN_PLACE != sendbuf) {
66 memchecker_datatype(sendtype);
67 ompi_datatype_type_extent(recvtype, &recv_ext);
68 }
69
70 memchecker_datatype(recvtype);
71 ompi_datatype_type_extent(sendtype, &send_ext);
72
73 err = mca_topo_base_neighbor_count (comm, &indegree, &outdegree);
74 if (MPI_SUCCESS == err) {
75 if (MPI_IN_PLACE != sendbuf) {
76 for ( i = 0; i < outdegree; i++ ) {
77
78 memchecker_call(&opal_memchecker_base_isdefined,
79 (char *)(sendbuf)+sdispls[i]*send_ext,
80 sendcounts[i], sendtype);
81 }
82 }
83 for ( i = 0; i < indegree; i++ ) {
84
85 memchecker_call(&opal_memchecker_base_isaddressable,
86 (char *)(recvbuf)+rdispls[i]*recv_ext,
87 recvcounts[i], recvtype);
88 }
89 }
90 );
91
92 if (MPI_PARAM_CHECK) {
93
94
95
96 err = MPI_SUCCESS;
97 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
98 if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
99 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
100 FUNC_NAME);
101 } else if (! OMPI_COMM_IS_TOPO(comm)) {
102 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY,
103 FUNC_NAME);
104 } else if ((NULL == sendcounts) || (NULL == sdispls) ||
105 (NULL == recvcounts) || (NULL == rdispls) ||
106 MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
107 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
108 }
109
110 err = mca_topo_base_neighbor_count (comm, &indegree, &outdegree);
111 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
112 for (i = 0; i < outdegree; ++i) {
113 OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcounts[i]);
114 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
115 }
116 for (i = 0; i < indegree; ++i) {
117 OMPI_CHECK_DATATYPE_FOR_RECV(err, recvtype, recvcounts[i]);
118 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
119 }
120
121 if( OMPI_COMM_IS_CART(comm) ) {
122 const mca_topo_base_comm_cart_2_2_0_t *cart = comm->c_topo->mtc.cart;
123 if( 0 > cart->ndims ) {
124 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
125 }
126 }
127 else if( OMPI_COMM_IS_GRAPH(comm) ) {
128 int degree;
129 mca_topo_base_graph_neighbors_count(comm, ompi_comm_rank(comm), °ree);
130 if( 0 > degree ) {
131 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
132 }
133 }
134 else if( OMPI_COMM_IS_DIST_GRAPH(comm) ) {
135 const mca_topo_base_comm_dist_graph_2_2_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
136 indegree = dist_graph->indegree;
137 outdegree = dist_graph->outdegree;
138 if( indegree < 0 || outdegree < 0 ) {
139 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
140 }
141 }
142 }
143
144 OPAL_CR_ENTER_LIBRARY();
145
146
147 err = comm->c_coll->coll_ineighbor_alltoallv(sendbuf, sendcounts, sdispls,
148 sendtype, recvbuf, recvcounts, rdispls,
149 recvtype, comm, request, comm->c_coll->coll_ineighbor_alltoallv_module);
150 OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
151 }
152