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