Merge pull request #2953 from ggouaillardet/topic/libnbc_ialltoallvw_zero
coll/libnbc: fix and optimize zero size ialltoall{v,w}
Этот коммит содержится в:
Коммит
9ea743960a
@ -5,7 +5,7 @@
|
|||||||
* Corporation. All rights reserved.
|
* Corporation. All rights reserved.
|
||||||
* Copyright (c) 2006 The Technical University of Chemnitz. All
|
* Copyright (c) 2006 The Technical University of Chemnitz. All
|
||||||
* rights reserved.
|
* rights reserved.
|
||||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
* Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
@ -74,6 +74,11 @@ int ompi_coll_libnbc_ialltoallv(const void* sendbuf, const int *sendcounts, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
span = opal_datatype_span(&recvtype->super, count, &gap);
|
span = opal_datatype_span(&recvtype->super, count, &gap);
|
||||||
|
if (OPAL_UNLIKELY(0 == span)) {
|
||||||
|
*request = &ompi_request_empty;
|
||||||
|
NBC_Return_handle (handle);
|
||||||
|
return MPI_SUCCESS;
|
||||||
|
}
|
||||||
handle->tmpbuf = malloc(span);
|
handle->tmpbuf = malloc(span);
|
||||||
if (OPAL_UNLIKELY(NULL == handle->tmpbuf)) {
|
if (OPAL_UNLIKELY(NULL == handle->tmpbuf)) {
|
||||||
NBC_Return_handle (handle);
|
NBC_Return_handle (handle);
|
||||||
@ -85,6 +90,7 @@ int ompi_coll_libnbc_ialltoallv(const void* sendbuf, const int *sendcounts, cons
|
|||||||
res = ompi_datatype_type_extent (sendtype, &sndext);
|
res = ompi_datatype_type_extent (sendtype, &sndext);
|
||||||
if (MPI_SUCCESS != res) {
|
if (MPI_SUCCESS != res) {
|
||||||
NBC_Error("MPI Error in ompi_datatype_type_extent() (%i)", res);
|
NBC_Error("MPI Error in ompi_datatype_type_extent() (%i)", res);
|
||||||
|
NBC_Return_handle (handle);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (sendcounts[rank] != 0) {
|
if (sendcounts[rank] != 0) {
|
||||||
@ -338,6 +344,7 @@ static inline int a2av_sched_inplace(int rank, int p, NBC_Schedule *schedule,
|
|||||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
if (0 != counts[peer]) {
|
||||||
res = NBC_Sched_send ((void *)(-gap), true , counts[peer], type, peer, schedule, false);
|
res = NBC_Sched_send ((void *)(-gap), true , counts[peer], type, peer, schedule, false);
|
||||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||||
return res;
|
return res;
|
||||||
@ -347,6 +354,7 @@ static inline int a2av_sched_inplace(int rank, int p, NBC_Schedule *schedule,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Corporation. All rights reserved.
|
* Corporation. All rights reserved.
|
||||||
* Copyright (c) 2006 The Technical University of Chemnitz. All
|
* Copyright (c) 2006 The Technical University of Chemnitz. All
|
||||||
* rights reserved.
|
* rights reserved.
|
||||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
* Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
@ -67,6 +67,11 @@ int ompi_coll_libnbc_ialltoallw(const void* sendbuf, const int *sendcounts, cons
|
|||||||
span = lspan;
|
span = lspan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (OPAL_UNLIKELY(0 == span)) {
|
||||||
|
*request = &ompi_request_empty;
|
||||||
|
NBC_Return_handle (handle);
|
||||||
|
return OMPI_SUCCESS;
|
||||||
|
}
|
||||||
handle->tmpbuf = malloc(span);
|
handle->tmpbuf = malloc(span);
|
||||||
if (OPAL_UNLIKELY(NULL == handle->tmpbuf)) {
|
if (OPAL_UNLIKELY(NULL == handle->tmpbuf)) {
|
||||||
NBC_Return_handle (handle);
|
NBC_Return_handle (handle);
|
||||||
@ -80,6 +85,7 @@ int ompi_coll_libnbc_ialltoallw(const void* sendbuf, const int *sendcounts, cons
|
|||||||
sbuf = (char *) sendbuf + sdispls[rank];
|
sbuf = (char *) sendbuf + sdispls[rank];
|
||||||
res = NBC_Copy(sbuf, sendcounts[rank], sendtypes[rank], rbuf, recvcounts[rank], recvtypes[rank], comm);
|
res = NBC_Copy(sbuf, sendcounts[rank], sendtypes[rank], rbuf, recvcounts[rank], recvtypes[rank], comm);
|
||||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||||
|
NBC_Return_handle (handle);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,12 +199,14 @@ static inline int a2aw_sched_linear(int rank, int p, NBC_Schedule *schedule,
|
|||||||
int res;
|
int res;
|
||||||
|
|
||||||
for (int i = 0; i < p; i++) {
|
for (int i = 0; i < p; i++) {
|
||||||
|
ptrdiff_t gap, span;
|
||||||
if (i == rank) {
|
if (i == rank) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* post send */
|
/* post send */
|
||||||
if (sendcounts[i] != 0) {
|
span = opal_datatype_span(&sendtypes[i]->super, sendcounts[i], &gap);
|
||||||
|
if (OPAL_LIKELY(0 < span)) {
|
||||||
char *sbuf = (char *) sendbuf + sdispls[i];
|
char *sbuf = (char *) sendbuf + sdispls[i];
|
||||||
res = NBC_Sched_send (sbuf, false, sendcounts[i], sendtypes[i], i, schedule, false);
|
res = NBC_Sched_send (sbuf, false, sendcounts[i], sendtypes[i], i, schedule, false);
|
||||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||||
@ -206,7 +214,8 @@ static inline int a2aw_sched_linear(int rank, int p, NBC_Schedule *schedule,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* post receive */
|
/* post receive */
|
||||||
if (recvcounts[i] != 0) {
|
span = opal_datatype_span(&recvtypes[i]->super, recvcounts[i], &gap);
|
||||||
|
if (OPAL_LIKELY(0 < span)) {
|
||||||
char *rbuf = (char *) recvbuf + rdispls[i];
|
char *rbuf = (char *) recvbuf + rdispls[i];
|
||||||
res = NBC_Sched_recv (rbuf, false, recvcounts[i], recvtypes[i], i, schedule, false);
|
res = NBC_Sched_recv (rbuf, false, recvcounts[i], recvtypes[i], i, schedule, false);
|
||||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
* reserved.
|
* reserved.
|
||||||
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
||||||
|
* Copyright (c) 2017 Research Organization for Information Science
|
||||||
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -344,6 +346,9 @@ opal_datatype_span( const opal_datatype_t* pData, int64_t count,
|
|||||||
{
|
{
|
||||||
OPAL_PTRDIFF_TYPE extent = (pData->ub - pData->lb);
|
OPAL_PTRDIFF_TYPE extent = (pData->ub - pData->lb);
|
||||||
OPAL_PTRDIFF_TYPE true_extent = (pData->true_ub - pData->true_lb);
|
OPAL_PTRDIFF_TYPE true_extent = (pData->true_ub - pData->true_lb);
|
||||||
|
if (OPAL_UNLIKELY(0 == pData->size) || (0 == count)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
*gap = pData->true_lb;
|
*gap = pData->true_lb;
|
||||||
return true_extent + (count - 1) * extent;
|
return true_extent + (count - 1) * extent;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user