diff --git a/ompi/mca/coll/libnbc/coll_libnbc.h b/ompi/mca/coll/libnbc/coll_libnbc.h index 88f59d424d..dba87225bb 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc.h +++ b/ompi/mca/coll/libnbc/coll_libnbc.h @@ -410,8 +410,6 @@ int ompi_coll_libnbc_neighbor_alltoallw_init(const void *sbuf, const int *scount struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module); -int ompi_coll_libnbc_start(size_t count, ompi_request_t ** request); - END_C_DECLS diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index 7782e5cfdc..226507c564 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -29,6 +29,7 @@ #include "ompi_config.h" #include "coll_libnbc.h" +#include "nbc_internal.h" #include "mpi.h" #include "ompi/mca/coll/coll.h" @@ -384,6 +385,44 @@ OBJ_CLASS_INSTANCE(ompi_coll_libnbc_module_t, libnbc_module_destruct); +static int +request_start(size_t count, ompi_request_t ** requests) +{ + int i, res; + + NBC_DEBUG(5, " ** request_start **\n"); + + for (i = 0; i < count; i++) { + NBC_Handle *handle = (NBC_Handle *) requests[i]; + NBC_Schedule *schedule = handle->schedule; + + NBC_DEBUG(5, "--------------------------------\n"); + NBC_DEBUG(5, "schedule %p size %u\n", &schedule, sizeof(schedule)); + NBC_DEBUG(5, "handle %p size %u\n", &handle, sizeof(handle)); + NBC_DEBUG(5, "data %p size %u\n", &schedule->data, sizeof(schedule->data)); + NBC_DEBUG(5, "req_array %p size %u\n", &handle->req_array, sizeof(handle->req_array)); + NBC_DEBUG(5, "row_offset=%u address=%p size=%u\n", handle->row_offset, &handle->row_offset, sizeof(handle->row_offset)); + NBC_DEBUG(5, "req_count=%u address=%p size=%u\n", handle->req_count, &handle->req_count, sizeof(handle->req_count)); + NBC_DEBUG(5, "tmpbuf address=%p size=%u\n", handle->tmpbuf, sizeof(handle->tmpbuf)); + NBC_DEBUG(5, "--------------------------------\n"); + + handle->super.req_complete = REQUEST_PENDING; + handle->nbc_complete = false; + + res = NBC_Start(handle); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { + NBC_DEBUG(5, " ** bad result from NBC_Start **\n"); + return res; + } + } + + NBC_DEBUG(5, " ** LEAVING request_start **\n"); + + return OMPI_SUCCESS; + +} + + static int request_cancel(struct ompi_request_t *request, int complete) { @@ -413,7 +452,7 @@ request_construct(ompi_coll_libnbc_request_t *request) { request->super.req_type = OMPI_REQUEST_COLL; request->super.req_status._cancelled = 0; - request->super.req_start = ompi_coll_libnbc_start; + request->super.req_start = request_start; request->super.req_free = request_free; request->super.req_cancel = request_cancel; } diff --git a/ompi/mca/coll/libnbc/nbc.c b/ompi/mca/coll/libnbc/nbc.c index 1d5f90ce77..e183c6bdf9 100644 --- a/ompi/mca/coll/libnbc/nbc.c +++ b/ompi/mca/coll/libnbc/nbc.c @@ -761,67 +761,3 @@ void NBC_SchedCache_args_delete(void *entry) { free(entry); } #endif - -static int NBC_Start_internal(NBC_Handle *handle) { - - /* kick off first round */ - int res = NBC_Start_round(handle); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - return res; - } - - /* - * FIXME - The request may already be complete/inactive now - * if so, it should not be added to the active list - * Must add param to provide the status of request, - * because the user could have already freed it and - * it could already be in use by another operation! - */ - - OPAL_THREAD_LOCK(&mca_coll_libnbc_component.lock); - opal_list_append(&mca_coll_libnbc_component.active_requests, &(handle->super.super.super)); - OPAL_THREAD_UNLOCK(&mca_coll_libnbc_component.lock); - - return OMPI_SUCCESS; - -} - -int ompi_coll_libnbc_start(size_t count, ompi_request_t ** request) { - - NBC_DEBUG(5, " ** ompi_coll_libnbc_start **\n"); - - /* FIXME */ - assert (1 == count); - - NBC_Handle *handle; - NBC_Schedule *schedule; - - int res; - - handle = (NBC_Handle *) *request; - - NBC_DEBUG(5, "--------------------------------\n"); - NBC_DEBUG(5, "schedule %p size %u\n", &schedule, sizeof(schedule)); - NBC_DEBUG(5, "handle %p size %u\n", &handle, sizeof(handle)); - NBC_DEBUG(5, "data %p size %u\n", &schedule->data, sizeof(schedule->data)); - NBC_DEBUG(5, "req_array %p size %u\n", &handle->req_array, sizeof(handle->req_array)); - NBC_DEBUG(5, "row_offset=%u address=%p size=%u\n", handle->row_offset, &handle->row_offset, sizeof(handle->row_offset)); - NBC_DEBUG(5, "req_count=%u address=%p size=%u\n", handle->req_count, &handle->req_count, sizeof(handle->req_count)); - NBC_DEBUG(5, "tmpbuf address=%p size=%u\n", handle->tmpbuf, sizeof(handle->tmpbuf)); - NBC_DEBUG(5, "--------------------------------\n"); - - handle->super.req_complete = REQUEST_PENDING; - handle->super.req_state = OMPI_REQUEST_ACTIVE; - handle->nbc_complete = false; - res = NBC_Start_internal(handle); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_DEBUG(5, " ** bad result from NBC_Start_internal **\n"); - NBC_Return_handle (handle); - return res; - } - - NBC_DEBUG(5, " ** LEAVING ompi_coll_libnbc_start **\n"); - - return OMPI_SUCCESS; - -}