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