1
1

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>
Этот коммит содержится в:
Gilles Gouaillardet 2017-01-11 09:19:27 +09:00
родитель 9d6e0482a6
Коммит d0629f18c2
4 изменённых файлов: 32 добавлений и 18 удалений

Просмотреть файл

@ -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 Los Alamos National Security, LLC. All rights * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
@ -74,6 +74,10 @@ int ompi_coll_libnbc_iallgather(const void* sendbuf, int sendcount, MPI_Datatype
return res; return res;
} }
} }
if (1 == p) {
*request = &ompi_request_empty;
return OMPI_SUCCESS;
}
#ifdef NBC_CACHE_SCHEDULE #ifdef NBC_CACHE_SCHEDULE
/* search schedule in communicator specific tree */ /* search schedule in communicator specific tree */

Просмотреть файл

@ -7,7 +7,7 @@
* rights reserved. * rights reserved.
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved. * 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.
* *
* Author(s): Torsten Hoefler <htor@cs.indiana.edu> * 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; 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); res = NBC_Init_handle (comm, &handle, libnbc_module);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
return 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; 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 */ /* algorithm selection */
if(p < 4 || size*count < 65536 || !ompi_op_is_commute(op) || inplace) { if(p < 4 || size*count < 65536 || !ompi_op_is_commute(op) || inplace) {
alg = NBC_ARED_BINOMIAL; alg = NBC_ARED_BINOMIAL;

Просмотреть файл

@ -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-2015 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 Los Alamos National Security, LLC. All rights * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
@ -58,6 +58,11 @@ int ompi_coll_libnbc_ibcast(void *buffer, int count, MPI_Datatype datatype, int
rank = ompi_comm_rank (comm); rank = ompi_comm_rank (comm);
p = ompi_comm_size (comm); p = ompi_comm_size (comm);
if (1 == p) {
*request = &ompi_request_empty;
return OMPI_SUCCESS;
}
res = ompi_datatype_type_size(datatype, &size); res = ompi_datatype_type_size(datatype, &size);
if (MPI_SUCCESS != res) { if (MPI_SUCCESS != res) {
NBC_Error("MPI Error in ompi_datatype_type_size() (%i)", res); NBC_Error("MPI Error in ompi_datatype_type_size() (%i)", res);

Просмотреть файл

@ -7,7 +7,7 @@
* rights reserved. * rights reserved.
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved. * 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.
* *
* Author(s): Torsten Hoefler <htor@cs.indiana.edu> * 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 */ /* only one node -> copy data */
if ((p == 1) && !inplace) { if (p == 1) {
if (!inplace) {
res = NBC_Copy (sendbuf, count, datatype, recvbuf, count, datatype, comm); res = NBC_Copy (sendbuf, count, datatype, recvbuf, count, datatype, comm);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
return res; return res;
} }
}
*request = &ompi_request_empty; *request = &ompi_request_empty;
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }