coll/libnbc: optimize size one communicators
simply "return" with ompi_request_empty if the communicator size is 1 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
родитель
9d6e0482a6
Коммит
d0629f18c2
@ -5,7 +5,7 @@
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2006 The Technical University of Chemnitz. All
|
||||
* 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.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
@ -74,6 +74,10 @@ int ompi_coll_libnbc_iallgather(const void* sendbuf, int sendcount, MPI_Datatype
|
||||
return res;
|
||||
}
|
||||
}
|
||||
if (1 == p) {
|
||||
*request = &ompi_request_empty;
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef NBC_CACHE_SCHEDULE
|
||||
/* search schedule in communicator specific tree */
|
||||
|
@ -7,7 +7,7 @@
|
||||
* rights reserved.
|
||||
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All 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.
|
||||
*
|
||||
* Author(s): Torsten Hoefler <htor@cs.indiana.edu>
|
||||
@ -82,6 +82,19 @@ int ompi_coll_libnbc_iallreduce(const void* sendbuf, void* recvbuf, int count, M
|
||||
return res;
|
||||
}
|
||||
|
||||
if (1 == p) {
|
||||
if (!inplace) {
|
||||
/* for a single node - copy data to receivebuf */
|
||||
res = NBC_Copy(sendbuf, count, datatype, recvbuf, count, datatype, comm);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
NBC_Return_handle (handle);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
*request = &ompi_request_empty;
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
res = NBC_Init_handle (comm, &handle, libnbc_module);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
return res;
|
||||
@ -94,15 +107,6 @@ int ompi_coll_libnbc_iallreduce(const void* sendbuf, void* recvbuf, int count, M
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
if ((p == 1) && !inplace) {
|
||||
/* for a single node - copy data to receivebuf */
|
||||
res = NBC_Copy(sendbuf, count, datatype, recvbuf, count, datatype, comm);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
NBC_Return_handle (handle);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
/* algorithm selection */
|
||||
if(p < 4 || size*count < 65536 || !ompi_op_is_commute(op) || inplace) {
|
||||
alg = NBC_ARED_BINOMIAL;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2006 The Technical University of Chemnitz. All
|
||||
* rights reserved.
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
@ -58,6 +58,11 @@ int ompi_coll_libnbc_ibcast(void *buffer, int count, MPI_Datatype datatype, int
|
||||
rank = ompi_comm_rank (comm);
|
||||
p = ompi_comm_size (comm);
|
||||
|
||||
if (1 == p) {
|
||||
*request = &ompi_request_empty;
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
res = ompi_datatype_type_size(datatype, &size);
|
||||
if (MPI_SUCCESS != res) {
|
||||
NBC_Error("MPI Error in ompi_datatype_type_size() (%i)", res);
|
||||
|
@ -7,7 +7,7 @@
|
||||
* rights reserved.
|
||||
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All 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.
|
||||
*
|
||||
* Author(s): Torsten Hoefler <htor@cs.indiana.edu>
|
||||
@ -80,12 +80,13 @@ int ompi_coll_libnbc_ireduce(const void* sendbuf, void* recvbuf, int count, MPI_
|
||||
}
|
||||
|
||||
/* only one node -> copy data */
|
||||
if ((p == 1) && !inplace) {
|
||||
res = NBC_Copy (sendbuf, count, datatype, recvbuf, count, datatype, comm);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
return res;
|
||||
if (p == 1) {
|
||||
if (!inplace) {
|
||||
res = NBC_Copy (sendbuf, count, datatype, recvbuf, count, datatype, comm);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
*request = &ompi_request_empty;
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user