Skip to content

Commit 725277b

Browse files
committed
Don't allocate space for the requests if the
underlying topology has no neighbors. This commit fixes issue #2402. Signed-off-by: George Bosilca <[email protected]>
1 parent aaf95c0 commit 725277b

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

ompi/mca/coll/basic/coll_basic_neighbor_allgather.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ mca_coll_basic_neighbor_allgather_cart(const void *sbuf, int scount,
4848
ptrdiff_t lb, extent;
4949
int rc = MPI_SUCCESS, dim, nreqs;
5050

51+
if( 0 == cart->ndims ) return OMPI_SUCCESS;
52+
5153
ompi_datatype_get_extent(rdtype, &lb, &extent);
5254

5355
reqs = preqs = coll_base_comm_get_reqs( module->base_data, 4 * cart->ndims );
@@ -129,6 +131,7 @@ mca_coll_basic_neighbor_allgather_graph(const void *sbuf, int scount,
129131
int rc = MPI_SUCCESS, neighbor;
130132

131133
mca_topo_base_graph_neighbors_count (comm, rank, &degree);
134+
if( 0 == degree) return OMPI_SUCCESS;
132135

133136
edges = graph->edges;
134137
if (rank > 0) {
@@ -181,6 +184,7 @@ mca_coll_basic_neighbor_allgather_dist_graph(const void *sbuf, int scount,
181184

182185
indegree = dist_graph->indegree;
183186
outdegree = dist_graph->outdegree;
187+
if( 0 == (indegree + outdegree) ) return OMPI_SUCCESS;
184188

185189
inedges = dist_graph->in;
186190
outedges = dist_graph->out;

ompi/mca/coll/basic/coll_basic_neighbor_allgatherv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ mca_coll_basic_neighbor_allgatherv_cart(const void *sbuf, int scount, struct omp
4747
ptrdiff_t lb, extent;
4848
int rc = MPI_SUCCESS, dim, i, nreqs;
4949

50+
if( 0 == cart->ndims ) return OMPI_SUCCESS;
51+
5052
ompi_datatype_get_extent(rdtype, &lb, &extent);
5153

5254
reqs = preqs = coll_base_comm_get_reqs( module->base_data, 4 * cart->ndims);
@@ -116,6 +118,7 @@ mca_coll_basic_neighbor_allgatherv_graph(const void *sbuf, int scount, struct om
116118
ptrdiff_t lb, extent;
117119

118120
mca_topo_base_graph_neighbors_count (comm, rank, &degree);
121+
if( 0 == degree ) return OMPI_SUCCESS;
119122

120123
edges = graph->edges;
121124
if (rank > 0) {
@@ -166,6 +169,7 @@ mca_coll_basic_neighbor_allgatherv_dist_graph(const void *sbuf, int scount, stru
166169

167170
indegree = dist_graph->indegree;
168171
outdegree = dist_graph->outdegree;
172+
if( 0 == (indegree + outdegree) ) return OMPI_SUCCESS;
169173

170174
inedges = dist_graph->in;
171175
outedges = dist_graph->out;

ompi/mca/coll/basic/coll_basic_neighbor_alltoall.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_
4646
ptrdiff_t lb, rdextent, sdextent;
4747
int rc = MPI_SUCCESS, dim, nreqs;
4848

49+
if( 0 == cart->ndims ) return OMPI_SUCCESS;
50+
4951
ompi_datatype_get_extent(rdtype, &lb, &rdextent);
5052
ompi_datatype_get_extent(sdtype, &lb, &sdextent);
5153
reqs = preqs = coll_base_comm_get_reqs( module->base_data, 4 * cart->ndims);
@@ -146,6 +148,7 @@ mca_coll_basic_neighbor_alltoall_graph(const void *sbuf, int scount, struct ompi
146148
const int *edges;
147149

148150
mca_topo_base_graph_neighbors_count (comm, rank, &degree);
151+
if( 0 == degree ) return OMPI_SUCCESS;
149152

150153
edges = graph->edges;
151154
if (rank > 0) {
@@ -205,6 +208,7 @@ mca_coll_basic_neighbor_alltoall_dist_graph(const void *sbuf, int scount,struct
205208

206209
indegree = dist_graph->indegree;
207210
outdegree = dist_graph->outdegree;
211+
if( 0 == (indegree + outdegree) ) return OMPI_SUCCESS;
208212

209213
inedges = dist_graph->in;
210214
outedges = dist_graph->out;

ompi/mca/coll/basic/coll_basic_neighbor_alltoallv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ mca_coll_basic_neighbor_alltoallv_cart(const void *sbuf, const int scounts[], co
4747
ptrdiff_t lb, rdextent, sdextent;
4848
ompi_request_t **reqs, **preqs;
4949

50+
if( 0 == cart->ndims ) return OMPI_SUCCESS;
51+
5052
ompi_datatype_get_extent(rdtype, &lb, &rdextent);
5153
ompi_datatype_get_extent(sdtype, &lb, &sdextent);
5254
reqs = preqs = coll_base_comm_get_reqs( module->base_data, 4 * cart->ndims );
@@ -133,6 +135,7 @@ mca_coll_basic_neighbor_alltoallv_graph(const void *sbuf, const int scounts[], c
133135
const int *edges;
134136

135137
mca_topo_base_graph_neighbors_count (comm, rank, &degree);
138+
if( 0 == degree ) return OMPI_SUCCESS;
136139

137140
edges = graph->edges;
138141
if (rank > 0) {
@@ -191,6 +194,7 @@ mca_coll_basic_neighbor_alltoallv_dist_graph(const void *sbuf, const int scounts
191194

192195
indegree = dist_graph->indegree;
193196
outdegree = dist_graph->outdegree;
197+
if( 0 == (indegree + outdegree) ) return OMPI_SUCCESS;
194198

195199
inedges = dist_graph->in;
196200
outedges = dist_graph->out;

0 commit comments

Comments
 (0)