mpich/6374.patch
Ben Boeckel 45ea873359 Backport PR#6374 to fix MPI_allgatherv fastpath error
(cherry picked from commit 2400e5803f7ea3ef5fa4034ac90f2c6361f1257d)
2023-02-21 13:34:56 +01:00

39 lines
1.8 KiB
Diff

From 2b8c5c7dc4974fc471b446e6cc939936aa14fd8f Mon Sep 17 00:00:00 2001
From: Hui Zhou <hzhou321@anl.gov>
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;