This source file includes following definitions.
- MPI_Ineighbor_alltoallw
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_alltoallw = PMPI_Ineighbor_alltoallw
42 #endif
43 #define MPI_Ineighbor_alltoallw PMPI_Ineighbor_alltoallw
44 #endif
45
46 static const char FUNC_NAME[] = "MPI_Ineighbor_alltoallw";
47
48
49 int MPI_Ineighbor_alltoallw(const void *sendbuf, const int sendcounts[], const MPI_Aint sdispls[],
50 const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[],
51 const MPI_Aint rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm,
52 MPI_Request *request)
53 {
54 int i, err;
55 int indegree, outdegree;
56
57 SPC_RECORD(OMPI_SPC_INEIGHBOR_ALLTOALLW, 1);
58
59 MEMCHECKER(
60 ptrdiff_t recv_ext;
61 ptrdiff_t send_ext;
62
63 memchecker_comm(comm);
64
65 err = mca_topo_base_neighbor_count (comm, &indegree, &outdegree);
66 if (MPI_SUCCESS == err) {
67 if (MPI_IN_PLACE != sendbuf) {
68 for ( i = 0; i < outdegree; i++ ) {
69 memchecker_datatype(sendtypes[i]);
70
71 ompi_datatype_type_extent(sendtypes[i], &send_ext);
72
73 memchecker_call(&opal_memchecker_base_isdefined,
74 (char *)(sendbuf)+sdispls[i]*send_ext,
75 sendcounts[i], sendtypes[i]);
76 }
77 }
78 for ( i = 0; i < indegree; i++ ) {
79 memchecker_datatype(recvtypes[i]);
80
81 ompi_datatype_type_extent(recvtypes[i], &recv_ext);
82
83 memchecker_call(&opal_memchecker_base_isaddressable,
84 (char *)(recvbuf)+sdispls[i]*recv_ext,
85 recvcounts[i], recvtypes[i]);
86 }
87 }
88 );
89
90 if (MPI_PARAM_CHECK) {
91
92
93
94 err = MPI_SUCCESS;
95 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
96 if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
97 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
98 FUNC_NAME);
99 } else if (! OMPI_COMM_IS_TOPO(comm)) {
100 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY,
101 FUNC_NAME);
102 }
103
104 if ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes) ||
105 (NULL == recvcounts) || (NULL == rdispls) || (NULL == recvtypes) ||
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, sendtypes[i], 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, recvtypes[i], 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_alltoallw(sendbuf, sendcounts, sdispls, sendtypes,
148 recvbuf, recvcounts, rdispls, recvtypes, comm, request,
149 comm->c_coll->coll_ineighbor_alltoallw_module);
150 OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
151 }
152