Skip to content

Commit f11203a

Browse files
committed
fixes per George's review
Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
1 parent a578e45 commit f11203a

File tree

3 files changed

+28
-184
lines changed

3 files changed

+28
-184
lines changed

ompi/mca/coll/base/coll_base_util.c

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "ompi/communicator/communicator.h"
2727
#include "ompi/mca/coll/base/coll_tags.h"
2828
#include "ompi/mca/coll/base/coll_base_functions.h"
29+
#include "ompi/mca/topo/base/base.h"
2930
#include "ompi/mca/pml/pml.h"
3031
#include "coll_base_util.h"
3132

@@ -149,6 +150,14 @@ int ompi_coll_base_retain_op( ompi_request_t *req, ompi_op_t *op,
149150
retain = true;
150151
}
151152
if (OPAL_UNLIKELY(retain)) {
153+
/* We need to consider two cases :
154+
* - non blocking collectives:
155+
* the objects can be released when MPI_Wait() completes
156+
* and we use the req_complete_cb callback
157+
* - persistent non blocking collectives:
158+
* the objects can only be released when the request is freed
159+
* (e.g. MPI_Request_free() completes) and we use req_free callback
160+
*/
152161
if (req->req_persistent) {
153162
request->cb.req_free = req->req_free;
154163
req->req_free = free_objs_callback;
@@ -192,11 +201,18 @@ int ompi_coll_base_retain_datatypes( ompi_request_t *req, ompi_datatype_t *stype
192201

193202
static void release_vecs_callback(ompi_coll_base_nbc_request_t *request) {
194203
ompi_communicator_t *comm = request->super.req_mpi_object.comm;
195-
int count = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm);
196-
for (int i=0; i<count; i++) {
204+
int scount, rcount;
205+
if (OMPI_COMM_IS_TOPO(comm)) {
206+
(void)mca_topo_base_neighbor_count (comm, &rcount, &scount);
207+
} else {
208+
scount = rcount = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm);
209+
}
210+
for (int i=0; i<scount; i++) {
197211
if (NULL != request->data.vecs.stypes && NULL != request->data.vecs.stypes[i]) {
198212
OMPI_DATATYPE_RELEASE(request->data.vecs.stypes[i]);
199213
}
214+
}
215+
for (int i=0; i<rcount; i++) {
200216
if (NULL != request->data.vecs.rtypes && NULL != request->data.vecs.rtypes[i]) {
201217
OMPI_DATATYPE_RELEASE(request->data.vecs.rtypes[i]);
202218
}
@@ -229,13 +245,20 @@ int ompi_coll_base_retain_datatypes_w( ompi_request_t *req,
229245
ompi_coll_base_nbc_request_t *request = (ompi_coll_base_nbc_request_t *)req;
230246
bool retain = false;
231247
ompi_communicator_t *comm = request->super.req_mpi_object.comm;
232-
int count = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm);
248+
int scount, rcount;
249+
if (OMPI_COMM_IS_TOPO(comm)) {
250+
(void)mca_topo_base_neighbor_count (comm, &rcount, &scount);
251+
} else {
252+
scount = rcount = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm);
253+
}
233254

234-
for (int i=0; i<count; i++) {
255+
for (int i=0; i<scount; i++) {
235256
if (NULL != stypes && NULL != stypes[i] && !ompi_datatype_is_predefined(stypes[i])) {
236257
OBJ_RETAIN(stypes[i]);
237258
retain = true;
238259
}
260+
}
261+
for (int i=0; i<rcount; i++) {
239262
if (NULL != rtypes && NULL != rtypes[i] && !ompi_datatype_is_predefined(rtypes[i])) {
240263
OBJ_RETAIN(rtypes[i]);
241264
retain = true;

ompi/mca/coll/libnbc/nbc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ int NBC_Start(NBC_Handle *handle) {
663663
}
664664

665665
OPAL_THREAD_LOCK(&mca_coll_libnbc_component.lock);
666-
opal_list_append(&mca_coll_libnbc_component.active_requests, &(handle->super.super.super.super));
666+
opal_list_append(&mca_coll_libnbc_component.active_requests, (opal_list_item_t *)handle);
667667
OPAL_THREAD_UNLOCK(&mca_coll_libnbc_component.lock);
668668

669669
return OMPI_SUCCESS;

ompi/mca/coll/retain.diff

Lines changed: 0 additions & 179 deletions
This file was deleted.

0 commit comments

Comments
 (0)