coll/base: optimize handling of zero-byte datatypes in mca_coll_base_alltoallv_intra_basic_inplace()
Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
родитель
7cbea77238
Коммит
d1c5955b73
@ -44,14 +44,13 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
|
||||
{
|
||||
int i, j, size, rank, err=MPI_SUCCESS;
|
||||
char *allocated_buffer, *tmp_buffer;
|
||||
size_t max_size, rdtype_size;
|
||||
size_t max_size;
|
||||
ptrdiff_t ext, gap = 0;
|
||||
|
||||
/* Initialize. */
|
||||
|
||||
size = ompi_comm_size(comm);
|
||||
rank = ompi_comm_rank(comm);
|
||||
ompi_datatype_type_size(rdtype, &rdtype_size);
|
||||
|
||||
/* If only one process, we're done. */
|
||||
if (1 == size) {
|
||||
@ -68,6 +67,10 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
|
||||
}
|
||||
/* The gap will always be the same as we are working on the same datatype */
|
||||
|
||||
if (OPAL_UNLIKELY(0 == max_size)) {
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
|
||||
/* Allocate a temporary buffer */
|
||||
allocated_buffer = calloc (max_size, 1);
|
||||
if (NULL == allocated_buffer) {
|
||||
@ -79,7 +82,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
|
||||
/* in-place alltoallv slow algorithm (but works) */
|
||||
for (i = 0 ; i < size ; ++i) {
|
||||
for (j = i+1 ; j < size ; ++j) {
|
||||
if (i == rank && 0 != rcounts[j] && 0 != rdtype_size) {
|
||||
if (i == rank && 0 != rcounts[j]) {
|
||||
/* Copy the data into the temporary buffer */
|
||||
err = ompi_datatype_copy_content_same_ddt (rdtype, rcounts[j],
|
||||
tmp_buffer, (char *) rbuf + rdisps[j] * ext);
|
||||
@ -92,7 +95,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
|
||||
j, MCA_COLL_BASE_TAG_ALLTOALLV,
|
||||
comm, MPI_STATUS_IGNORE);
|
||||
if (MPI_SUCCESS != err) { goto error_hndl; }
|
||||
} else if (j == rank && 0 != rcounts[i] && 0 != rdtype_size) {
|
||||
} else if (j == rank && 0 != rcounts[i]) {
|
||||
/* Copy the data into the temporary buffer */
|
||||
err = ompi_datatype_copy_content_same_ddt (rdtype, rcounts[i],
|
||||
tmp_buffer, (char *) rbuf + rdisps[i] * ext);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user