Skip to content

Commit 6a5fe29

Browse files
author
rhc54
authored
Merge pull request #2276 from ggouaillardet/topic/v1.10/nbc_ialltoallv
v1.10: coll/libnbc: fix MPI_Ialltoallv with MPI_IN_PLACE and without MPI par…
2 parents ae23727 + 67a6378 commit 6a5fe29

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ompi/mca/coll/libnbc/nbc_ialltoallv.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ int ompi_coll_libnbc_ialltoallv(void* sendbuf, int *sendcounts, int *sdispls,
5656
if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; }
5757
res= MPI_Comm_size(comm, &p);
5858
if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_size() (%i)\n", res); return res; }
59-
res = MPI_Type_extent(sendtype, &sndext);
60-
if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Type_extent() (%i)\n", res); return res; }
6159
res = MPI_Type_extent(recvtype, &rcvext);
6260
if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Type_extent() (%i)\n", res); return res; }
6361

@@ -82,11 +80,15 @@ int ompi_coll_libnbc_ialltoallv(void* sendbuf, int *sendcounts, int *sdispls,
8280
if (OPAL_UNLIKELY(NULL == handle->tmpbuf)) { printf("Error in malloc()\n"); return NBC_OOR; }
8381
sendcounts = recvcounts;
8482
sdispls = rdispls;
85-
} else if (sendcounts[rank] != 0) {
86-
rbuf = (char *) recvbuf + rdispls[rank] * rcvext;
87-
sbuf = (char *) sendbuf + sdispls[rank] * sndext;
88-
res = NBC_Copy (sbuf, sendcounts[rank], sendtype, rbuf, recvcounts[rank], recvtype, comm);
89-
if (NBC_OK != res) { printf("Error in NBC_Copy() (%i)\n", res); return res; }
83+
} else {
84+
res = MPI_Type_extent(sendtype, &sndext);
85+
if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Type_extent() (%i)\n", res); return res; }
86+
if (sendcounts[rank] != 0) {
87+
rbuf = (char *) recvbuf + rdispls[rank] * rcvext;
88+
sbuf = (char *) sendbuf + sdispls[rank] * sndext;
89+
res = NBC_Copy (sbuf, sendcounts[rank], sendtype, rbuf, recvcounts[rank], recvtype, comm);
90+
if (NBC_OK != res) { printf("Error in NBC_Copy() (%i)\n", res); return res; }
91+
}
9092
}
9193

9294
if (inplace) {

0 commit comments

Comments
 (0)