From 2b8c5c7dc4974fc471b446e6cc939936aa14fd8f Mon Sep 17 00:00:00 2001 From: Hui Zhou Date: Sat, 21 Jan 2023 10:35:32 -0600 Subject: [PATCH] coll: fix allgatherv early return case The localcopy omitted considering displs. --- src/binding/c/coll_api.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/binding/c/coll_api.txt b/src/binding/c/coll_api.txt index 55be70d093e..d288272e2f3 100644 --- a/src/binding/c/coll_api.txt +++ b/src/binding/c/coll_api.txt @@ -57,7 +57,10 @@ MPI_Allgatherv: { -- early_return -- if (comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM && MPIR_Comm_size(comm_ptr) == 1) { if (sendbuf != MPI_IN_PLACE) { - MPIR_Localcopy(sendbuf, sendcount, sendtype, recvbuf, recvcounts[0], recvtype); + MPI_Aint recvtype_extent; + MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); + MPIR_Localcopy(sendbuf, sendcount, sendtype, + (char *) recvbuf + displs[0] * recvtype_extent, recvcounts[0], recvtype); } goto fn_exit; } @@ -188,7 +191,10 @@ MPI_Iallgatherv: { -- early_return -- if (comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM && MPIR_Comm_size(comm_ptr) == 1) { if (sendbuf != MPI_IN_PLACE) { - MPIR_Localcopy(sendbuf, sendcount, sendtype, recvbuf, recvcounts[0], recvtype); + MPI_Aint recvtype_extent; + MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); + MPIR_Localcopy(sendbuf, sendcount, sendtype, + (char *) recvbuf + displs[0] * recvtype_extent, recvcounts[0], recvtype); } MPIR_Request *request_ptr = MPIR_Request_create_complete(MPIR_REQUEST_KIND__COLL); *request = request_ptr->handle;