From 8e5690bf5c138366211552ddc2162c57df1afe2f Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Tue, 20 Feb 2018 09:52:25 +0900 Subject: [PATCH] coll/libnbc: Correct persistent request handling Signed-off-by: KAWASHIMA Takahiro --- ompi/mca/coll/libnbc/coll_libnbc.h | 7 ++- ompi/mca/coll/libnbc/coll_libnbc_component.c | 14 +++--- ompi/mca/coll/libnbc/nbc.c | 48 ++++++++++++++----- ompi/mca/coll/libnbc/nbc_iallgather.c | 36 +++++--------- ompi/mca/coll/libnbc/nbc_iallgatherv.c | 33 +++++-------- ompi/mca/coll/libnbc/nbc_iallreduce.c | 38 ++++++--------- ompi/mca/coll/libnbc/nbc_ialltoall.c | 33 +++++-------- ompi/mca/coll/libnbc/nbc_ialltoallv.c | 34 ++++--------- ompi/mca/coll/libnbc/nbc_ialltoallw.c | 36 +++++--------- ompi/mca/coll/libnbc/nbc_ibarrier.c | 31 ++++-------- ompi/mca/coll/libnbc/nbc_ibcast.c | 38 ++++++--------- ompi/mca/coll/libnbc/nbc_iexscan.c | 18 +++---- ompi/mca/coll/libnbc/nbc_igather.c | 33 +++++-------- ompi/mca/coll/libnbc/nbc_igatherv.c | 33 +++++-------- .../mca/coll/libnbc/nbc_ineighbor_allgather.c | 19 ++++---- .../coll/libnbc/nbc_ineighbor_allgatherv.c | 18 +++---- ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c | 19 ++++---- .../mca/coll/libnbc/nbc_ineighbor_alltoallv.c | 18 +++---- .../mca/coll/libnbc/nbc_ineighbor_alltoallw.c | 18 +++---- ompi/mca/coll/libnbc/nbc_internal.h | 18 ++++++- ompi/mca/coll/libnbc/nbc_ireduce.c | 38 ++++++--------- ompi/mca/coll/libnbc/nbc_ireduce_scatter.c | 38 ++++++--------- .../coll/libnbc/nbc_ireduce_scatter_block.c | 37 ++++++-------- ompi/mca/coll/libnbc/nbc_iscan.c | 18 +++---- ompi/mca/coll/libnbc/nbc_iscatter.c | 35 +++++--------- ompi/mca/coll/libnbc/nbc_iscatterv.c | 35 +++++--------- 26 files changed, 296 insertions(+), 447 deletions(-) diff --git a/ompi/mca/coll/libnbc/coll_libnbc.h b/ompi/mca/coll/libnbc/coll_libnbc.h index 5e8a7df5a2..6680b17b57 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc.h +++ b/ompi/mca/coll/libnbc/coll_libnbc.h @@ -16,6 +16,7 @@ * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -131,15 +132,13 @@ OBJ_CLASS_DECLARATION(ompi_coll_libnbc_request_t); typedef ompi_coll_libnbc_request_t NBC_Handle; -#define OMPI_COLL_LIBNBC_REQUEST_ALLOC(comm, req) \ +#define OMPI_COLL_LIBNBC_REQUEST_ALLOC(comm, persistent, req) \ do { \ opal_free_list_item_t *item; \ item = opal_free_list_wait (&mca_coll_libnbc_component.requests); \ req = (ompi_coll_libnbc_request_t*) item; \ - OMPI_REQUEST_INIT(&req->super, false); \ + OMPI_REQUEST_INIT(&req->super, persistent); \ req->super.req_mpi_object.comm = comm; \ - req->super.req_complete = false; \ - req->super.req_state = OMPI_REQUEST_INACTIVE; \ } while (0) #define OMPI_COLL_LIBNBC_REQUEST_RETURN(req) \ diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index 8e01deb9ae..7782e5cfdc 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -18,7 +18,7 @@ * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2017 Ian Bradley Morgan and Anthony Skjellum. All * rights reserved. - + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -336,6 +336,10 @@ ompi_coll_libnbc_progress(void) else { request->super.req_status.MPI_ERROR = res; } + if(request->super.req_persistent) { + /* reset for the next communication */ + request->row_offset = 0; + } if(!request->super.req_persistent || !REQUEST_COMPLETE(&request->super)) { ompi_request_complete(&request->super, true); } @@ -397,11 +401,8 @@ request_free(struct ompi_request_t **ompi_req) return MPI_ERR_REQUEST; } - if (!request->super.req_persistent) { - OMPI_COLL_LIBNBC_REQUEST_RETURN(request); - - *ompi_req = MPI_REQUEST_NULL; - } + OMPI_COLL_LIBNBC_REQUEST_RETURN(request); + *ompi_req = MPI_REQUEST_NULL; return OMPI_SUCCESS; } @@ -412,6 +413,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_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 fca82a94f5..1e91518a63 100644 --- a/ompi/mca/coll/libnbc/nbc.c +++ b/ompi/mca/coll/libnbc/nbc.c @@ -19,7 +19,10 @@ * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2017 Ian Bradley Morgan and Anthony Skjellum. All * rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. + * $COPYRIGHT$ * + * Additional copyrights may follow */ #include "nbc_internal.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -649,12 +652,14 @@ int NBC_Start(NBC_Handle *handle) { if ((ompi_request_t *)handle == &ompi_request_empty) { return OMPI_SUCCESS; } + /* kick off first round */ + handle->super.req_state = OMPI_REQUEST_ACTIVE; res = NBC_Start_round(handle); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - handle->super.req_state = OMPI_REQUEST_ACTIVE; + 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); @@ -662,12 +667,37 @@ int NBC_Start(NBC_Handle *handle) { return OMPI_SUCCESS; } -int NBC_Schedule_request(NBC_Schedule *schedule, ompi_communicator_t *comm, ompi_coll_libnbc_module_t *module, ompi_request_t **request, void *tmpbuf) { - int tmp_tag; +int NBC_Schedule_request(NBC_Schedule *schedule, ompi_communicator_t *comm, + ompi_coll_libnbc_module_t *module, bool persistent, + ompi_request_t **request, void *tmpbuf) { + int ret, tmp_tag; bool need_register = false; ompi_coll_libnbc_request_t *handle; - OMPI_COLL_LIBNBC_REQUEST_ALLOC(comm, handle); + /* no operation (e.g. one process barrier)? */ + if (((int *)schedule->data)[0] == 0 && schedule->data[sizeof(int)] == 0) { + ret = nbc_get_noop_request(persistent, request); + if (OMPI_SUCCESS != ret) { + return OMPI_ERR_OUT_OF_RESOURCE; + } + + /* update the module->tag here because other processes may have operations + * and they may update the module->tag */ + OPAL_THREAD_LOCK(&module->mutex); + tmp_tag = module->tag--; + if (tmp_tag == MCA_COLL_BASE_TAG_NONBLOCKING_END) { + tmp_tag = module->tag = MCA_COLL_BASE_TAG_NONBLOCKING_BASE; + NBC_DEBUG(2,"resetting tags ...\n"); + } + OPAL_THREAD_UNLOCK(&module->mutex); + + OBJ_RELEASE(schedule); + free(tmpbuf); + + return OMPI_SUCCESS; + } + + OMPI_COLL_LIBNBC_REQUEST_ALLOC(comm, persistent, handle); if (NULL == handle) return OMPI_ERR_OUT_OF_RESOURCE; handle->tmpbuf = NULL; @@ -731,15 +761,6 @@ void NBC_SchedCache_args_delete(void *entry) { } #endif -int NBC_Persist(NBC_Handle *handle) { - - handle->super.req_complete = REQUEST_PENDING; - handle->super.req_start = ompi_coll_libnbc_start; - handle->super.req_persistent = true; - - return OMPI_SUCCESS; -} - static int NBC_Start_internal(NBC_Handle *handle) { /* kick off first round */ @@ -788,6 +809,7 @@ int ompi_coll_libnbc_start(size_t count, ompi_request_t ** request) { 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; res = NBC_Start_internal(handle); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { diff --git a/ompi/mca/coll/libnbc/nbc_iallgather.c b/ompi/mca/coll/libnbc/nbc_iallgather.c index befb13ae21..999f12d316 100644 --- a/ompi/mca/coll/libnbc/nbc_iallgather.c +++ b/ompi/mca/coll/libnbc/nbc_iallgather.c @@ -10,6 +10,7 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,7 @@ int NBC_Allgather_args_compare(NBC_Allgather_args *a, NBC_Allgather_args *b, voi * each node receives from it's left (modulo p) neighbor */ static int nbc_iallgather(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res; MPI_Aint rcvext; @@ -78,8 +79,7 @@ static int nbc_iallgather(const void* sendbuf, int sendcount, MPI_Datatype sendt } } if (1 == p) { - *request = &ompi_request_empty; - return OMPI_SUCCESS; + return nbc_get_noop_request(persistent, request); } #ifdef NBC_CACHE_SCHEDULE @@ -154,7 +154,7 @@ static int nbc_iallgather(const void* sendbuf, int sendcount, MPI_Datatype sendt } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -168,7 +168,7 @@ int ompi_coll_libnbc_iallgather(const void* sendbuf, int sendcount, MPI_Datatype struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_iallgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -185,7 +185,7 @@ int ompi_coll_libnbc_iallgather(const void* sendbuf, int sendcount, MPI_Datatype static int nbc_iallgather_inter(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, rsize; MPI_Aint rcvext; @@ -231,7 +231,7 @@ static int nbc_iallgather_inter(const void* sendbuf, int sendcount, MPI_Datatype return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -244,7 +244,7 @@ int ompi_coll_libnbc_iallgather_inter(const void* sendbuf, int sendcount, MPI_Da MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_iallgather_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -262,35 +262,23 @@ int ompi_coll_libnbc_iallgather_inter(const void* sendbuf, int sendcount, MPI_Da int ompi_coll_libnbc_allgather_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iallgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, request, module); + int res = nbc_iallgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } int ompi_coll_libnbc_allgather_inter_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iallgather_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, request, module); + int res = nbc_iallgather_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_iallgatherv.c b/ompi/mca/coll/libnbc/nbc_iallgatherv.c index a3ee348319..42f7bc4a18 100644 --- a/ompi/mca/coll/libnbc/nbc_iallgatherv.c +++ b/ompi/mca/coll/libnbc/nbc_iallgatherv.c @@ -14,6 +14,7 @@ * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,7 +36,7 @@ * each node receives from node (rank-2)%p recvcounts[(rank+2)%p] elements */ static int nbc_iallgatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res, speer, rpeer; MPI_Aint rcvext; @@ -99,7 +100,7 @@ static int nbc_iallgatherv(const void* sendbuf, int sendcount, MPI_Datatype send return res; } - res = NBC_Schedule_request (schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request (schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -112,7 +113,7 @@ int ompi_coll_libnbc_iallgatherv(const void* sendbuf, int sendcount, MPI_Datatyp MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_iallgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -129,7 +130,7 @@ int ompi_coll_libnbc_iallgatherv(const void* sendbuf, int sendcount, MPI_Datatyp static int nbc_iallgatherv_inter(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, rsize; MPI_Aint rcvext; @@ -178,7 +179,7 @@ static int nbc_iallgatherv_inter(const void* sendbuf, int sendcount, MPI_Datatyp return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -191,7 +192,7 @@ int ompi_coll_libnbc_iallgatherv_inter(const void* sendbuf, int sendcount, MPI_D MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_iallgatherv_inter(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -209,35 +210,23 @@ int ompi_coll_libnbc_iallgatherv_inter(const void* sendbuf, int sendcount, MPI_D int ompi_coll_libnbc_allgatherv_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iallgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm, request, module); + int res = nbc_iallgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } int ompi_coll_libnbc_allgatherv_inter_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iallgatherv_inter(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm, request, module); + int res = nbc_iallgatherv_inter(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_iallreduce.c b/ompi/mca/coll/libnbc/nbc_iallreduce.c index db62b32f55..1f4fe5d71e 100644 --- a/ompi/mca/coll/libnbc/nbc_iallreduce.c +++ b/ompi/mca/coll/libnbc/nbc_iallreduce.c @@ -10,6 +10,7 @@ * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -54,7 +55,7 @@ int NBC_Allreduce_args_compare(NBC_Allreduce_args *a, NBC_Allreduce_args *b, voi static int nbc_iallreduce(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res; ptrdiff_t ext, lb; @@ -94,8 +95,7 @@ static int nbc_iallreduce(const void* sendbuf, void* recvbuf, int count, MPI_Dat return res; } } - *request = &ompi_request_empty; - return OMPI_SUCCESS; + return nbc_get_noop_request(persistent, request); } span = opal_datatype_span(&datatype->super, count, &gap); @@ -180,7 +180,7 @@ static int nbc_iallreduce(const void* sendbuf, void* recvbuf, int count, MPI_Dat } #endif - res = NBC_Schedule_request (schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request (schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -193,7 +193,8 @@ static int nbc_iallreduce(const void* sendbuf, void* recvbuf, int count, MPI_Dat int ompi_coll_libnbc_iallreduce(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iallreduce(sendbuf, recvbuf, count, datatype, op, comm, request, module); + int res = nbc_iallreduce(sendbuf, recvbuf, count, datatype, op, + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -210,7 +211,7 @@ int ompi_coll_libnbc_iallreduce(const void* sendbuf, void* recvbuf, int count, M static int nbc_iallreduce_inter(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, res, rsize; size_t size; @@ -262,7 +263,7 @@ static int nbc_iallreduce_inter(const void* sendbuf, void* recvbuf, int count, M return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -275,7 +276,8 @@ static int nbc_iallreduce_inter(const void* sendbuf, void* recvbuf, int count, M int ompi_coll_libnbc_iallreduce_inter(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iallreduce_inter(sendbuf, recvbuf, count, datatype, op, comm, request, module); + int res = nbc_iallreduce_inter(sendbuf, recvbuf, count, datatype, op, + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -729,36 +731,24 @@ static inline int allred_sched_linear(int rank, int rsize, const void *sendbuf, int ompi_coll_libnbc_allreduce_init(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iallreduce(sendbuf, recvbuf, count, datatype, op, comm, request, module); + int res = nbc_iallreduce(sendbuf, recvbuf, count, datatype, op, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } int ompi_coll_libnbc_allreduce_inter_init(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iallreduce_inter(sendbuf, recvbuf, count, datatype, op, comm, request, module); + int res = nbc_iallreduce_inter(sendbuf, recvbuf, count, datatype, op, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_ialltoall.c b/ompi/mca/coll/libnbc/nbc_ialltoall.c index d473a8f26c..120bf223ee 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoall.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoall.c @@ -11,6 +11,7 @@ * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -55,7 +56,7 @@ int NBC_Alltoall_args_compare(NBC_Alltoall_args *a, NBC_Alltoall_args *b, void * /* simple linear MPI_Ialltoall the (simple) algorithm just sends to all nodes */ static int nbc_ialltoall(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res, datasize; size_t a2asize, sndsize; @@ -264,7 +265,7 @@ static int nbc_ialltoall(const void* sendbuf, int sendcount, MPI_Datatype sendty } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -278,7 +279,7 @@ int ompi_coll_libnbc_ialltoall(const void* sendbuf, int sendcount, MPI_Datatype MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_ialltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -295,7 +296,7 @@ int ompi_coll_libnbc_ialltoall(const void* sendbuf, int sendcount, MPI_Datatype static int nbc_ialltoall_inter (const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, rsize; MPI_Aint sndext, rcvext; @@ -349,7 +350,7 @@ static int nbc_ialltoall_inter (const void* sendbuf, int sendcount, MPI_Datatype return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -362,7 +363,7 @@ int ompi_coll_libnbc_ialltoall_inter (const void* sendbuf, int sendcount, MPI_Da MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_ialltoall_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -586,35 +587,23 @@ static inline int a2a_sched_inplace(int rank, int p, NBC_Schedule* schedule, voi int ompi_coll_libnbc_alltoall_init (const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ialltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, request, module); + int res = nbc_ialltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } int ompi_coll_libnbc_alltoall_inter_init (const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ialltoall_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, request, module); + int res = nbc_ialltoall_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_ialltoallv.c b/ompi/mca/coll/libnbc/nbc_ialltoallv.c index f7703be2c2..a27a8a9982 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoallv.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoallv.c @@ -10,6 +10,7 @@ * Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,7 +44,7 @@ static inline int a2av_sched_inplace(int rank, int p, NBC_Schedule *schedule, static int nbc_ialltoallv(const void* sendbuf, const int *sendcounts, const int *sdispls, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *rdispls, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res; MPI_Aint sndext, rcvext; @@ -74,8 +75,7 @@ static int nbc_ialltoallv(const void* sendbuf, const int *sendcounts, const int } span = opal_datatype_span(&recvtype->super, count, &gap); if (OPAL_UNLIKELY(0 == span)) { - *request = &ompi_request_empty; - return MPI_SUCCESS; + return nbc_get_noop_request(persistent, request); } tmpbuf = malloc(span); if (OPAL_UNLIKELY(NULL == tmpbuf)) { @@ -127,7 +127,7 @@ static int nbc_ialltoallv(const void* sendbuf, const int *sendcounts, const int return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -143,7 +143,7 @@ int ompi_coll_libnbc_ialltoallv(const void* sendbuf, const int *sendcounts, cons struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_ialltoallv(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -162,7 +162,7 @@ int ompi_coll_libnbc_ialltoallv(const void* sendbuf, const int *sendcounts, cons static int nbc_ialltoallv_inter (const void* sendbuf, const int *sendcounts, const int *sdispls, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *rdispls, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, rsize; MPI_Aint sndext, rcvext; @@ -216,7 +216,7 @@ static int nbc_ialltoallv_inter (const void* sendbuf, const int *sendcounts, con return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -231,7 +231,7 @@ int ompi_coll_libnbc_ialltoallv_inter (const void* sendbuf, const int *sendcount struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_ialltoallv_inter(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -390,18 +390,11 @@ int ompi_coll_libnbc_alltoallv_init(const void* sendbuf, const int *sendcounts, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_ialltoallv(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, - comm, request, module); + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } @@ -410,17 +403,10 @@ int ompi_coll_libnbc_alltoallv_inter_init(const void* sendbuf, const int *sendco MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_ialltoallv_inter(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, - comm, request, module); + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_ialltoallw.c b/ompi/mca/coll/libnbc/nbc_ialltoallw.c index bb85a9a9a1..6ce70e9495 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoallw.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoallw.c @@ -10,6 +10,7 @@ * Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,7 +44,7 @@ static inline int a2aw_sched_inplace(int rank, int p, NBC_Schedule *schedule, static int nbc_ialltoallw(const void* sendbuf, const int *sendcounts, const int *sdispls, struct ompi_datatype_t * const *sendtypes, void* recvbuf, const int *recvcounts, const int *rdispls, struct ompi_datatype_t * const *recvtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res; NBC_Schedule *schedule; @@ -67,8 +68,7 @@ static int nbc_ialltoallw(const void* sendbuf, const int *sendcounts, const int } } if (OPAL_UNLIKELY(0 == span)) { - *request = &ompi_request_empty; - return OMPI_SUCCESS; + return nbc_get_noop_request(persistent, request); } tmpbuf = malloc(span); if (OPAL_UNLIKELY(NULL == tmpbuf)) { @@ -113,7 +113,7 @@ static int nbc_ialltoallw(const void* sendbuf, const int *sendcounts, const int return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -129,7 +129,7 @@ int ompi_coll_libnbc_ialltoallw(const void* sendbuf, const int *sendcounts, cons struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_ialltoallw(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -148,7 +148,7 @@ int ompi_coll_libnbc_ialltoallw(const void* sendbuf, const int *sendcounts, cons static int nbc_ialltoallw_inter (const void* sendbuf, const int *sendcounts, const int *sdispls, struct ompi_datatype_t * const *sendtypes, void* recvbuf, const int *recvcounts, const int *rdispls, struct ompi_datatype_t * const *recvtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, rsize; NBC_Schedule *schedule; @@ -189,7 +189,7 @@ static int nbc_ialltoallw_inter (const void* sendbuf, const int *sendcounts, con return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -204,7 +204,7 @@ int ompi_coll_libnbc_ialltoallw_inter(const void* sendbuf, const int *sendcounts struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_ialltoallw_inter(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -363,18 +363,12 @@ int ompi_coll_libnbc_alltoallw_init(const void* sendbuf, const int *sendcounts, struct ompi_datatype_t * const *sendtypes, void* recvbuf, const int *recvcounts, const int *rdispls, struct ompi_datatype_t * const *recvtypes, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ialltoallw(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm, request, module); + int res = nbc_ialltoallw(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } @@ -382,17 +376,11 @@ int ompi_coll_libnbc_alltoallw_inter_init(const void* sendbuf, const int *sendco struct ompi_datatype_t * const *sendtypes, void* recvbuf, const int *recvcounts, const int *rdispls, struct ompi_datatype_t * const *recvtypes, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ialltoallw_inter(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm, request, module); + int res = nbc_ialltoallw_inter(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_ibarrier.c b/ompi/mca/coll/libnbc/nbc_ibarrier.c index c146c1140c..b3291b0ba5 100644 --- a/ompi/mca/coll/libnbc/nbc_ibarrier.c +++ b/ompi/mca/coll/libnbc/nbc_ibarrier.c @@ -11,6 +11,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Mellanox Technologies. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -22,7 +23,7 @@ /* Dissemination implementation of MPI_Ibarrier */ static int nbc_ibarrier(struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, maxround, res, recvpeer, sendpeer; NBC_Schedule *schedule; @@ -89,7 +90,7 @@ static int nbc_ibarrier(struct ompi_communicator_t *comm, ompi_request_t ** requ OBJ_RETAIN(schedule); #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -100,7 +101,7 @@ static int nbc_ibarrier(struct ompi_communicator_t *comm, ompi_request_t ** requ int ompi_coll_libnbc_ibarrier(struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ibarrier(comm, request, module); + int res = nbc_ibarrier(comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -116,7 +117,7 @@ int ompi_coll_libnbc_ibarrier(struct ompi_communicator_t *comm, ompi_request_t * } static int nbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, res, rsize; NBC_Schedule *schedule; @@ -177,7 +178,7 @@ static int nbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_request_t * return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -187,7 +188,7 @@ static int nbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_request_t * int ompi_coll_libnbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ibarrier_inter(comm, request, module); + int res = nbc_ibarrier_inter(comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -204,34 +205,20 @@ int ompi_coll_libnbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_reque int ompi_coll_libnbc_barrier_init(struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ibarrier(comm, request, module); + int res = nbc_ibarrier(comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } int ompi_coll_libnbc_barrier_inter_init(struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ibarrier_inter(comm, request, module); + int res = nbc_ibarrier_inter(comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_ibcast.c b/ompi/mca/coll/libnbc/nbc_ibcast.c index df3f6e3407..f8795192c3 100644 --- a/ompi/mca/coll/libnbc/nbc_ibcast.c +++ b/ompi/mca/coll/libnbc/nbc_ibcast.c @@ -10,6 +10,7 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -46,7 +47,7 @@ int NBC_Bcast_args_compare(NBC_Bcast_args *a, NBC_Bcast_args *b, void *param) { static int nbc_ibcast(void *buffer, int count, MPI_Datatype datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res, segsize; size_t size; @@ -61,8 +62,7 @@ static int nbc_ibcast(void *buffer, int count, MPI_Datatype datatype, int root, p = ompi_comm_size (comm); if (1 == p) { - *request = &ompi_request_empty; - return OMPI_SUCCESS; + return nbc_get_noop_request(persistent, request); } res = ompi_datatype_type_size(datatype, &size); @@ -162,7 +162,7 @@ static int nbc_ibcast(void *buffer, int count, MPI_Datatype datatype, int root, } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -175,7 +175,8 @@ int ompi_coll_libnbc_ibcast(void *buffer, int count, MPI_Datatype datatype, int struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ibcast(buffer, count, datatype, root, comm, request, module); + int res = nbc_ibcast(buffer, count, datatype, root, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -343,7 +344,7 @@ static inline int bcast_sched_chain(int rank, int p, int root, NBC_Schedule *sch static int nbc_ibcast_inter(void *buffer, int count, MPI_Datatype datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res; NBC_Schedule *schedule; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; @@ -384,7 +385,7 @@ static int nbc_ibcast_inter(void *buffer, int count, MPI_Datatype datatype, int return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -396,7 +397,8 @@ static int nbc_ibcast_inter(void *buffer, int count, MPI_Datatype datatype, int int ompi_coll_libnbc_ibcast_inter(void *buffer, int count, MPI_Datatype datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ibcast_inter(buffer, count, datatype, root, comm, request, module); + int res = nbc_ibcast_inter(buffer, count, datatype, root, + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -414,35 +416,23 @@ int ompi_coll_libnbc_ibcast_inter(void *buffer, int count, MPI_Datatype datatype int ompi_coll_libnbc_bcast_init(void *buffer, int count, MPI_Datatype datatype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ibcast(buffer, count, datatype, root, comm, request, module); + int res = nbc_ibcast(buffer, count, datatype, root, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } int ompi_coll_libnbc_bcast_inter_init(void *buffer, int count, MPI_Datatype datatype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ibcast_inter(buffer, count, datatype, root, comm, request, module); + int res = nbc_ibcast_inter(buffer, count, datatype, root, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_iexscan.c b/ompi/mca/coll/libnbc/nbc_iexscan.c index fd23346e50..6313f8a161 100644 --- a/ompi/mca/coll/libnbc/nbc_iexscan.c +++ b/ompi/mca/coll/libnbc/nbc_iexscan.c @@ -10,6 +10,7 @@ * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -47,7 +48,7 @@ int NBC_Scan_args_compare(NBC_Scan_args *a, NBC_Scan_args *b, void *param) { */ static int nbc_iexscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res; ptrdiff_t gap, span; NBC_Schedule *schedule; @@ -182,7 +183,7 @@ static int nbc_iexscan(const void* sendbuf, void* recvbuf, int count, MPI_Dataty } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -195,7 +196,8 @@ static int nbc_iexscan(const void* sendbuf, void* recvbuf, int count, MPI_Dataty int ompi_coll_libnbc_iexscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iexscan(sendbuf, recvbuf, count, datatype, op, comm, request, module); + int res = nbc_iexscan(sendbuf, recvbuf, count, datatype, op, + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -213,17 +215,11 @@ int ompi_coll_libnbc_iexscan(const void* sendbuf, void* recvbuf, int count, MPI_ int ompi_coll_libnbc_exscan_init(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iexscan(sendbuf, recvbuf, count, datatype, op, comm, request, module); + int res = nbc_iexscan(sendbuf, recvbuf, count, datatype, op, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_igather.c b/ompi/mca/coll/libnbc/nbc_igather.c index 108f14ecee..13802e0b8b 100644 --- a/ompi/mca/coll/libnbc/nbc_igather.c +++ b/ompi/mca/coll/libnbc/nbc_igather.c @@ -13,6 +13,7 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -46,7 +47,7 @@ int NBC_Gather_args_compare(NBC_Gather_args *a, NBC_Gather_args *b, void *param) static int nbc_igather(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res; MPI_Aint rcvext = 0; NBC_Schedule *schedule; @@ -160,7 +161,7 @@ static int nbc_igather(const void* sendbuf, int sendcount, MPI_Datatype sendtype } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -174,7 +175,7 @@ int ompi_coll_libnbc_igather(const void* sendbuf, int sendcount, MPI_Datatype se struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_igather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -192,7 +193,7 @@ int ompi_coll_libnbc_igather(const void* sendbuf, int sendcount, MPI_Datatype se static int nbc_igather_inter (const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, rsize; MPI_Aint rcvext = 0; NBC_Schedule *schedule; @@ -240,7 +241,7 @@ static int nbc_igather_inter (const void* sendbuf, int sendcount, MPI_Datatype s return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -254,7 +255,7 @@ int ompi_coll_libnbc_igather_inter(const void* sendbuf, int sendcount, MPI_Datat struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_igather_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -273,18 +274,12 @@ int ompi_coll_libnbc_gather_init(const void* sendbuf, int sendcount, MPI_Datatyp int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_igather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, request, module); + int res = nbc_igather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } @@ -292,17 +287,11 @@ int ompi_coll_libnbc_gather_inter_init(const void* sendbuf, int sendcount, MPI_D int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_igather_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, request, module); + int res = nbc_igather_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_igatherv.c b/ompi/mca/coll/libnbc/nbc_igatherv.c index eb908cf3b3..bc3880ab9f 100644 --- a/ompi/mca/coll/libnbc/nbc_igatherv.c +++ b/ompi/mca/coll/libnbc/nbc_igatherv.c @@ -14,6 +14,7 @@ * reserved. * Copyright (c) 2015 Mellanox Technologies. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,7 +32,7 @@ static int nbc_igatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res; MPI_Aint rcvext = 0; NBC_Schedule *schedule; @@ -95,7 +96,7 @@ static int nbc_igatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtyp return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -109,7 +110,7 @@ int ompi_coll_libnbc_igatherv(const void* sendbuf, int sendcount, MPI_Datatype s int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_igatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -127,7 +128,7 @@ int ompi_coll_libnbc_igatherv(const void* sendbuf, int sendcount, MPI_Datatype s static int nbc_igatherv_inter (const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, rsize; MPI_Aint rcvext; NBC_Schedule *schedule; @@ -175,7 +176,7 @@ static int nbc_igatherv_inter (const void* sendbuf, int sendcount, MPI_Datatype return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -189,7 +190,7 @@ int ompi_coll_libnbc_igatherv_inter(const void* sendbuf, int sendcount, MPI_Data int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { int res = nbc_igatherv_inter(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, - comm, request, module); + comm, request, module, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } @@ -208,18 +209,12 @@ int ompi_coll_libnbc_gatherv_init(const void* sendbuf, int sendcount, MPI_Dataty void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_igatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm, request, module); + int res = nbc_igatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } @@ -227,17 +222,11 @@ int ompi_coll_libnbc_gatherv_inter_init(const void* sendbuf, int sendcount, MPI_ void* recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_igatherv_inter(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm, request, module); + int res = nbc_igatherv_inter(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c b/ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c index cf6db001c9..1875229d21 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c @@ -10,6 +10,7 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,8 @@ int NBC_Ineighbor_allgather_args_compare(NBC_Ineighbor_allgather_args *a, NBC_In static int nbc_ineighbor_allgather(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, int rcount, MPI_Datatype rtype, struct ompi_communicator_t *comm, - ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { + ompi_request_t ** request, + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, indegree, outdegree, *srcs, *dsts; MPI_Aint rcvext; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; @@ -152,7 +154,7 @@ static int nbc_ineighbor_allgather(const void *sbuf, int scount, MPI_Datatype st } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -164,7 +166,8 @@ static int nbc_ineighbor_allgather(const void *sbuf, int scount, MPI_Datatype st int ompi_coll_libnbc_ineighbor_allgather(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, int rcount, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ineighbor_allgather(sbuf, scount, stype, rbuf, rcount, rtype, comm, request, module); + int res = nbc_ineighbor_allgather(sbuf, scount, stype, rbuf, rcount, rtype, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -333,17 +336,11 @@ static inline int bcast_sched_chain(int rank, int p, int root, NBC_Schedule *sch int ompi_coll_libnbc_neighbor_allgather_init(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, int rcount, MPI_Datatype rtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ineighbor_allgather(sbuf, scount, stype, rbuf, rcount, rtype, comm, request, module); + int res = nbc_ineighbor_allgather(sbuf, scount, stype, rbuf, rcount, rtype, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c b/ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c index 1d9817e038..f974d4522a 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c @@ -10,6 +10,7 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -46,7 +47,7 @@ int NBC_Ineighbor_allgatherv_args_compare(NBC_Ineighbor_allgatherv_args *a, NBC_ static int nbc_ineighbor_allgatherv(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, const int *rcounts, const int *displs, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, indegree, outdegree, *srcs, *dsts; MPI_Aint rcvext; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; @@ -154,7 +155,7 @@ static int nbc_ineighbor_allgatherv(const void *sbuf, int scount, MPI_Datatype s } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -167,7 +168,8 @@ int ompi_coll_libnbc_ineighbor_allgatherv(const void *sbuf, int scount, MPI_Data const int *rcounts, const int *displs, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ineighbor_allgatherv(sbuf, scount, stype, rbuf, rcounts, displs, rtype, comm, request, module); + int res = nbc_ineighbor_allgatherv(sbuf, scount, stype, rbuf, rcounts, displs, rtype, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -185,17 +187,11 @@ int ompi_coll_libnbc_neighbor_allgatherv_init(const void *sbuf, int scount, MPI_ const int *rcounts, const int *displs, MPI_Datatype rtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ineighbor_allgatherv(sbuf, scount, stype, rbuf, rcounts, displs, rtype, comm, request, module); + int res = nbc_ineighbor_allgatherv(sbuf, scount, stype, rbuf, rcounts, displs, rtype, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c index 4a8962fa33..7172233982 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c @@ -10,6 +10,7 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,8 @@ int NBC_Ineighbor_alltoall_args_compare(NBC_Ineighbor_alltoall_args *a, NBC_Inei static int nbc_ineighbor_alltoall(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, int rcount, MPI_Datatype rtype, struct ompi_communicator_t *comm, - ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { + ompi_request_t ** request, + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, indegree, outdegree, *srcs, *dsts; MPI_Aint sndext, rcvext; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; @@ -156,7 +158,7 @@ static int nbc_ineighbor_alltoall(const void *sbuf, int scount, MPI_Datatype sty } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -168,7 +170,8 @@ static int nbc_ineighbor_alltoall(const void *sbuf, int scount, MPI_Datatype sty int ompi_coll_libnbc_ineighbor_alltoall(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, int rcount, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ineighbor_alltoall(sbuf, scount, stype, rbuf, rcount, rtype, comm, request, module); + int res = nbc_ineighbor_alltoall(sbuf, scount, stype, rbuf, rcount, rtype, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -185,17 +188,11 @@ int ompi_coll_libnbc_ineighbor_alltoall(const void *sbuf, int scount, MPI_Dataty int ompi_coll_libnbc_neighbor_alltoall_init(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, int rcount, MPI_Datatype rtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ineighbor_alltoall(sbuf, scount, stype, rbuf, rcount, rtype, comm, request, module); + int res = nbc_ineighbor_alltoall(sbuf, scount, stype, rbuf, rcount, rtype, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c index d2b6dc21aa..1dbb43779b 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c @@ -10,6 +10,7 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -46,7 +47,7 @@ int NBC_Ineighbor_alltoallv_args_compare(NBC_Ineighbor_alltoallv_args *a, NBC_In static int nbc_ineighbor_alltoallv(const void *sbuf, const int *scounts, const int *sdispls, MPI_Datatype stype, void *rbuf, const int *rcounts, const int *rdispls, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, indegree, outdegree, *srcs, *dsts; MPI_Aint sndext, rcvext; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; @@ -161,7 +162,7 @@ static int nbc_ineighbor_alltoallv(const void *sbuf, const int *scounts, const i } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -174,7 +175,8 @@ int ompi_coll_libnbc_ineighbor_alltoallv(const void *sbuf, const int *scounts, c void *rbuf, const int *rcounts, const int *rdispls, MPI_Datatype rtype, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ineighbor_alltoallv(sbuf, scounts, sdispls, stype, rbuf, rcounts, rdispls, rtype, comm, request, module); + int res = nbc_ineighbor_alltoallv(sbuf, scounts, sdispls, stype, rbuf, rcounts, rdispls, rtype, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -192,17 +194,11 @@ int ompi_coll_libnbc_neighbor_alltoallv_init(const void *sbuf, const int *scount void *rbuf, const int *rcounts, const int *rdispls, MPI_Datatype rtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ineighbor_alltoallv(sbuf, scounts, sdispls, stype, rbuf, rcounts, rdispls, rtype, comm, request, module); + int res = nbc_ineighbor_alltoallv(sbuf, scounts, sdispls, stype, rbuf, rcounts, rdispls, rtype, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c index 67cf5bc785..b8ea53652f 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c @@ -10,6 +10,7 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,7 @@ int NBC_Ineighbor_alltoallw_args_compare(NBC_Ineighbor_alltoallw_args *a, NBC_In static int nbc_ineighbor_alltoallw(const void *sbuf, const int *scounts, const MPI_Aint *sdisps, struct ompi_datatype_t * const *stypes, void *rbuf, const int *rcounts, const MPI_Aint *rdisps, struct ompi_datatype_t * const *rtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, indegree, outdegree, *srcs, *dsts; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; NBC_Schedule *schedule; @@ -146,7 +147,7 @@ static int nbc_ineighbor_alltoallw(const void *sbuf, const int *scounts, const M } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -159,7 +160,8 @@ int ompi_coll_libnbc_ineighbor_alltoallw(const void *sbuf, const int *scounts, c void *rbuf, const int *rcounts, const MPI_Aint *rdisps, struct ompi_datatype_t * const *rtypes, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ineighbor_alltoallw(sbuf, scounts, sdisps, stypes, rbuf, rcounts, rdisps, rtypes, comm, request, module); + int res = nbc_ineighbor_alltoallw(sbuf, scounts, sdisps, stypes, rbuf, rcounts, rdisps, rtypes, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -177,17 +179,11 @@ int ompi_coll_libnbc_neighbor_alltoallw_init(const void *sbuf, const int *scount void *rbuf, const int *rcounts, const MPI_Aint *rdisps, struct ompi_datatype_t * const *rtypes, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ineighbor_alltoallw(sbuf, scounts, sdisps, stypes, rbuf, rcounts, rdisps, rtypes, comm, request, module); + int res = nbc_ineighbor_alltoallw(sbuf, scounts, sdisps, stypes, rbuf, rcounts, rdisps, rtypes, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_internal.h b/ompi/mca/coll/libnbc/nbc_internal.h index 5eac0f7d34..dc085f0293 100644 --- a/ompi/mca/coll/libnbc/nbc_internal.h +++ b/ompi/mca/coll/libnbc/nbc_internal.h @@ -14,7 +14,10 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. + * $COPYRIGHT$ * + * Additional copyrights may follow */ #ifndef __NBC_INTERNAL_H__ #define __NBC_INTERNAL_H__ @@ -260,8 +263,9 @@ void NBC_SchedCache_args_delete_key_dummy(void *k); int NBC_Start(NBC_Handle *handle); -int NBC_Persist(NBC_Handle *handle); -int NBC_Schedule_request(NBC_Schedule *schedule, ompi_communicator_t *comm, ompi_coll_libnbc_module_t *module, ompi_request_t **request, void *tmpbuf); +int NBC_Schedule_request(NBC_Schedule *schedule, ompi_communicator_t *comm, + ompi_coll_libnbc_module_t *module, bool persistent, + ompi_request_t **request, void *tmpbuf); void NBC_Return_handle(ompi_coll_libnbc_request_t *request); static inline int NBC_Type_intrinsic(MPI_Datatype type); int NBC_Create_fortran_handle(int *fhandle, NBC_Handle **handle); @@ -365,6 +369,16 @@ static inline void nbc_schedule_inc_round (NBC_Schedule *schedule) { memcpy (lastround, &last_round_num, sizeof (last_round_num)); } +/* returns a no-operation request (e.g. for one process barrier) */ +static inline int nbc_get_noop_request(bool persistent, ompi_request_t **request) { + if (persistent) { + return ompi_request_persistent_noop_create(request); + } else { + *request = &ompi_request_empty; + return OMPI_SUCCESS; + } +} + /* NBC_PRINT_ROUND prints a round in a schedule. A round has the format: * [num]{[type][type-args]} types: [int]{[enum][args-type]} * e.g. [2][SEND][SEND-ARGS][RECV][RECV-ARGS] */ diff --git a/ompi/mca/coll/libnbc/nbc_ireduce.c b/ompi/mca/coll/libnbc/nbc_ireduce.c index f4a161ac21..7f74a37125 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce.c @@ -10,6 +10,7 @@ * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -54,7 +55,7 @@ int NBC_Reduce_args_compare(NBC_Reduce_args *a, NBC_Reduce_args *b, void *param) /* the non-blocking reduce */ static int nbc_ireduce(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res, segsize; size_t size; MPI_Aint ext; @@ -91,8 +92,7 @@ static int nbc_ireduce(const void* sendbuf, void* recvbuf, int count, MPI_Dataty return res; } } - *request = &ompi_request_empty; - return OMPI_SUCCESS; + return nbc_get_noop_request(persistent, request); } span = opal_datatype_span(&datatype->super, count, &gap); @@ -193,7 +193,7 @@ static int nbc_ireduce(const void* sendbuf, void* recvbuf, int count, MPI_Dataty } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -206,7 +206,8 @@ static int nbc_ireduce(const void* sendbuf, void* recvbuf, int count, MPI_Dataty int ompi_coll_libnbc_ireduce(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ireduce(sendbuf, recvbuf, count, datatype, op, root, comm, request, module); + int res = nbc_ireduce(sendbuf, recvbuf, count, datatype, op, root, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -222,7 +223,7 @@ int ompi_coll_libnbc_ireduce(const void* sendbuf, void* recvbuf, int count, MPI_ static int nbc_ireduce_inter(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, res, rsize; NBC_Schedule *schedule; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; @@ -258,7 +259,7 @@ static int nbc_ireduce_inter(const void* sendbuf, void* recvbuf, int count, MPI_ return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -271,7 +272,8 @@ static int nbc_ireduce_inter(const void* sendbuf, void* recvbuf, int count, MPI_ int ompi_coll_libnbc_ireduce_inter(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ireduce_inter(sendbuf, recvbuf, count, datatype, op, root, comm, request, module); + int res = nbc_ireduce_inter(sendbuf, recvbuf, count, datatype, op, root, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -554,35 +556,23 @@ static inline int red_sched_linear (int rank, int rsize, int root, const void *s int ompi_coll_libnbc_reduce_init(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ireduce(sendbuf, recvbuf, count, datatype, op, root, comm, request, module); + int res = nbc_ireduce(sendbuf, recvbuf, count, datatype, op, root, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } int ompi_coll_libnbc_reduce_inter_init(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ireduce_inter(sendbuf, recvbuf, count, datatype, op, root, comm, request, module); + int res = nbc_ireduce_inter(sendbuf, recvbuf, count, datatype, op, root, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c b/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c index 589beda2e0..b9025c2493 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c @@ -13,6 +13,7 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,7 +44,7 @@ static int nbc_ireduce_scatter(const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int peer, rank, maxr, p, res, count; MPI_Aint ext; ptrdiff_t gap, span, span_align; @@ -78,8 +79,7 @@ static int nbc_ireduce_scatter(const void* sendbuf, void* recvbuf, const int *re } } - *request = &ompi_request_empty; - return OMPI_SUCCESS; + return nbc_get_noop_request(persistent, request); } maxr = (int) ceil ((log((double) p) / LOG2)); @@ -193,7 +193,7 @@ static int nbc_ireduce_scatter(const void* sendbuf, void* recvbuf, const int *re return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -206,7 +206,8 @@ static int nbc_ireduce_scatter(const void* sendbuf, void* recvbuf, const int *re int ompi_coll_libnbc_ireduce_scatter (const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ireduce_scatter(sendbuf, recvbuf, recvcounts, datatype, op, comm, request, module); + int res = nbc_ireduce_scatter(sendbuf, recvbuf, recvcounts, datatype, op, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -221,7 +222,7 @@ int ompi_coll_libnbc_ireduce_scatter (const void* sendbuf, void* recvbuf, const } static int nbc_ireduce_scatter_inter (const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, res, count, lsize, rsize; MPI_Aint ext; ptrdiff_t gap, span, span_align; @@ -334,7 +335,7 @@ static int nbc_ireduce_scatter_inter (const void* sendbuf, void* recvbuf, const return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -347,7 +348,8 @@ static int nbc_ireduce_scatter_inter (const void* sendbuf, void* recvbuf, const int ompi_coll_libnbc_ireduce_scatter_inter (const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ireduce_scatter_inter(sendbuf, recvbuf, recvcounts, datatype, op, comm, request, module); + int res = nbc_ireduce_scatter_inter(sendbuf, recvbuf, recvcounts, datatype, op, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -364,35 +366,23 @@ int ompi_coll_libnbc_ireduce_scatter_inter (const void* sendbuf, void* recvbuf, int ompi_coll_libnbc_reduce_scatter_init(const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ireduce_scatter(sendbuf, recvbuf, recvcounts, datatype, op, comm, request, module); + int res = nbc_ireduce_scatter(sendbuf, recvbuf, recvcounts, datatype, op, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } int ompi_coll_libnbc_reduce_scatter_inter_init(const void* sendbuf, void* recvbuf, const int *recvcounts, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ireduce_scatter_inter(sendbuf, recvbuf, recvcounts, datatype, op, comm, request, module); + int res = nbc_ireduce_scatter_inter(sendbuf, recvbuf, recvcounts, datatype, op, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c b/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c index 1702123ab8..cde6bd914e 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c @@ -11,6 +11,7 @@ * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,7 +42,7 @@ static int nbc_ireduce_scatter_block(const void* sendbuf, void* recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int peer, rank, maxr, p, res, count; MPI_Aint ext; ptrdiff_t gap, span; @@ -195,7 +196,7 @@ static int nbc_ireduce_scatter_block(const void* sendbuf, void* recvbuf, int rec return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -208,7 +209,8 @@ static int nbc_ireduce_scatter_block(const void* sendbuf, void* recvbuf, int rec int ompi_coll_libnbc_ireduce_scatter_block(const void* sendbuf, void* recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ireduce_scatter_block(sendbuf, recvbuf, recvcount, datatype, op, comm, request, module); + int res = nbc_ireduce_scatter_block(sendbuf, recvbuf, recvcount, datatype, op, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -223,8 +225,8 @@ int ompi_coll_libnbc_ireduce_scatter_block(const void* sendbuf, void* recvbuf, i } static int nbc_ireduce_scatter_block_inter(const void *sendbuf, void *recvbuf, int rcount, struct ompi_datatype_t *dtype, - struct ompi_op_t *op, struct ompi_communicator_t *comm, - ompi_request_t **request, struct mca_coll_base_module_2_2_0_t *module) { + struct ompi_op_t *op, struct ompi_communicator_t *comm, ompi_request_t **request, + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, res, count, lsize, rsize; MPI_Aint ext; ptrdiff_t gap, span, span_align; @@ -333,7 +335,7 @@ static int nbc_ireduce_scatter_block_inter(const void *sendbuf, void *recvbuf, i return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -346,7 +348,8 @@ static int nbc_ireduce_scatter_block_inter(const void *sendbuf, void *recvbuf, i int ompi_coll_libnbc_ireduce_scatter_block_inter(const void* sendbuf, void* recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ireduce_scatter_block_inter(sendbuf, recvbuf, recvcount, datatype, op, comm, request, module); + int res = nbc_ireduce_scatter_block_inter(sendbuf, recvbuf, recvcount, datatype, op, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -363,35 +366,23 @@ int ompi_coll_libnbc_ireduce_scatter_block_inter(const void* sendbuf, void* recv int ompi_coll_libnbc_reduce_scatter_block_init(const void* sendbuf, void* recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ireduce_scatter_block(sendbuf, recvbuf, recvcount, datatype, op, comm, request, module); + int res = nbc_ireduce_scatter_block(sendbuf, recvbuf, recvcount, datatype, op, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } int ompi_coll_libnbc_reduce_scatter_block_inter_init(const void* sendbuf, void* recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_ireduce_scatter_block_inter(sendbuf, recvbuf, recvcount, datatype, op, comm, request, module); + int res = nbc_ireduce_scatter_block_inter(sendbuf, recvbuf, recvcount, datatype, op, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_iscan.c b/ompi/mca/coll/libnbc/nbc_iscan.c index 144a338a51..a2fdd9aac6 100644 --- a/ompi/mca/coll/libnbc/nbc_iscan.c +++ b/ompi/mca/coll/libnbc/nbc_iscan.c @@ -10,6 +10,7 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -47,7 +48,7 @@ int NBC_Scan_args_compare(NBC_Scan_args *a, NBC_Scan_args *b, void *param) { */ static int nbc_iscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res; ptrdiff_t gap, span; NBC_Schedule *schedule; @@ -159,7 +160,7 @@ static int nbc_iscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); @@ -172,7 +173,8 @@ static int nbc_iscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype int ompi_coll_libnbc_iscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iscan(sendbuf, recvbuf, count, datatype, op, comm, request, module); + int res = nbc_iscan(sendbuf, recvbuf, count, datatype, op, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -189,17 +191,11 @@ int ompi_coll_libnbc_iscan(const void* sendbuf, void* recvbuf, int count, MPI_Da int ompi_coll_libnbc_scan_init(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iscan(sendbuf, recvbuf, count, datatype, op, comm, request, module); + int res = nbc_iscan(sendbuf, recvbuf, count, datatype, op, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_iscatter.c b/ompi/mca/coll/libnbc/nbc_iscatter.c index 895860008c..dda22a3827 100644 --- a/ompi/mca/coll/libnbc/nbc_iscatter.c +++ b/ompi/mca/coll/libnbc/nbc_iscatter.c @@ -13,6 +13,7 @@ * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -47,7 +48,7 @@ int NBC_Scatter_args_compare(NBC_Scatter_args *a, NBC_Scatter_args *b, void *par static int nbc_iscatter (const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res; MPI_Aint sndext = 0; NBC_Schedule *schedule; @@ -157,7 +158,7 @@ static int nbc_iscatter (const void* sendbuf, int sendcount, MPI_Datatype sendty } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -170,7 +171,8 @@ int ompi_coll_libnbc_iscatter (const void* sendbuf, int sendcount, MPI_Datatype void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iscatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, request, module); + int res = nbc_iscatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -187,7 +189,7 @@ int ompi_coll_libnbc_iscatter (const void* sendbuf, int sendcount, MPI_Datatype static int nbc_iscatter_inter (const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, rsize; MPI_Aint sndext; NBC_Schedule *schedule; @@ -235,7 +237,7 @@ static int nbc_iscatter_inter (const void* sendbuf, int sendcount, MPI_Datatype return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -248,7 +250,8 @@ int ompi_coll_libnbc_iscatter_inter (const void* sendbuf, int sendcount, MPI_Dat void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iscatter_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, request, module); + int res = nbc_iscatter_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -266,18 +269,12 @@ int ompi_coll_libnbc_scatter_init(const void* sendbuf, int sendcount, MPI_Dataty void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iscatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, request, module); + int res = nbc_iscatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } @@ -285,17 +282,11 @@ int ompi_coll_libnbc_scatter_inter_init(const void* sendbuf, int sendcount, MPI_ void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iscatter_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, request, module); + int res = nbc_iscatter_inter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_iscatterv.c b/ompi/mca/coll/libnbc/nbc_iscatterv.c index cf6ccfed0c..08faacb18e 100644 --- a/ompi/mca/coll/libnbc/nbc_iscatterv.c +++ b/ompi/mca/coll/libnbc/nbc_iscatterv.c @@ -13,6 +13,7 @@ * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,7 +31,7 @@ static int nbc_iscatterv(const void* sendbuf, const int *sendcounts, const int *displs, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int rank, p, res; MPI_Aint sndext; NBC_Schedule *schedule; @@ -92,7 +93,7 @@ static int nbc_iscatterv(const void* sendbuf, const int *sendcounts, const int * return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -105,7 +106,8 @@ int ompi_coll_libnbc_iscatterv(const void* sendbuf, const int *sendcounts, const void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iscatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm, request, module); + int res = nbc_iscatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -122,7 +124,7 @@ int ompi_coll_libnbc_iscatterv(const void* sendbuf, const int *sendcounts, const static int nbc_iscatterv_inter (const void* sendbuf, const int *sendcounts, const int *displs, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_2_0_t *module) { + struct mca_coll_base_module_2_2_0_t *module, bool persistent) { int res, rsize; MPI_Aint sndext; NBC_Schedule *schedule; @@ -169,7 +171,7 @@ static int nbc_iscatterv_inter (const void* sendbuf, const int *sendcounts, cons return res; } - res = NBC_Schedule_request(schedule, comm, libnbc_module, request, NULL); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, NULL); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; @@ -182,7 +184,8 @@ int ompi_coll_libnbc_iscatterv_inter(const void* sendbuf, const int *sendcounts, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iscatterv_inter(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm, request, module); + int res = nbc_iscatterv_inter(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, + comm, request, module, false); if (OPAL_LIKELY(OMPI_SUCCESS != res)) { return res; } @@ -200,18 +203,12 @@ int ompi_coll_libnbc_scatterv_init(const void* sendbuf, const int *sendcounts, c void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iscatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm, request, module); + int res = nbc_iscatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; } @@ -219,17 +216,11 @@ int ompi_coll_libnbc_scatterv_inter_init(const void* sendbuf, const int *sendcou void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_2_0_t *module) { - int res = nbc_iscatterv_inter(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm, request, module); + int res = nbc_iscatterv_inter(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, + comm, request, module, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } - res = NBC_Persist(*(ompi_coll_libnbc_request_t **)request); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); - *request = &ompi_request_null.request; - return res; - } - return OMPI_SUCCESS; }