Skip to content

Commit 6714f6a

Browse files
committed
coll/libnbc: fix MPI_Ialltoallv with MPI_IN_PLACE and without MPI param check
1 parent 98f6269 commit 6714f6a

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

ompi/mca/coll/libnbc/nbc_ialltoallv.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ int ompi_coll_libnbc_ialltoallv(const void* sendbuf, const int *sendcounts, cons
5454
rank = ompi_comm_rank (comm);
5555
p = ompi_comm_size (comm);
5656

57-
res = ompi_datatype_type_extent (sendtype, &sndext);
58-
if (MPI_SUCCESS != res) {
59-
NBC_Error("MPI Error in ompi_datatype_type_extent() (%i)", res);
60-
return res;
61-
}
62-
6357
res = ompi_datatype_type_extent (recvtype, &rcvext);
6458
if (MPI_SUCCESS != res) {
6559
NBC_Error("MPI Error in ompi_datatype_type_extent() (%i)", res);
@@ -87,13 +81,20 @@ int ompi_coll_libnbc_ialltoallv(const void* sendbuf, const int *sendcounts, cons
8781
}
8882
sendcounts = recvcounts;
8983
sdispls = rdispls;
90-
} else if (sendcounts[rank] != 0) {
91-
rbuf = (char *) recvbuf + rdispls[rank] * rcvext;
92-
sbuf = (char *) sendbuf + sdispls[rank] * sndext;
93-
res = NBC_Copy (sbuf, sendcounts[rank], sendtype, rbuf, recvcounts[rank], recvtype, comm);
94-
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
84+
} else {
85+
res = ompi_datatype_type_extent (sendtype, &sndext);
86+
if (MPI_SUCCESS != res) {
87+
NBC_Error("MPI Error in ompi_datatype_type_extent() (%i)", res);
9588
return res;
9689
}
90+
if (sendcounts[rank] != 0) {
91+
rbuf = (char *) recvbuf + rdispls[rank] * rcvext;
92+
sbuf = (char *) sendbuf + sdispls[rank] * sndext;
93+
res = NBC_Copy (sbuf, sendcounts[rank], sendtype, rbuf, recvcounts[rank], recvtype, comm);
94+
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
95+
return res;
96+
}
97+
}
9798
}
9899

99100
schedule = OBJ_NEW(NBC_Schedule);

0 commit comments

Comments
 (0)