Backport PR#6374 to fix MPI_allgatherv fastpath error

(cherry picked from commit 2400e5803f7ea3ef5fa4034ac90f2c6361f1257d)
This commit is contained in:
Ben Boeckel 2023-02-13 10:28:35 -05:00 committed by Zbigniew Jędrzejewski-Szmek
parent 181eaa9b44
commit 45ea873359
2 changed files with 40 additions and 0 deletions

38
6374.patch Normal file
View File

@ -0,0 +1,38 @@
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;

View File

@ -15,6 +15,8 @@ Patch: 0002-pkgconf-also-drop-rpath-flags-from-pkgconf-file.patch
Patch: 0003-Drop-build-flags-e.g.-specs.-and-lto-from-mpi-wrappe.patch
Patch: 0004-Make-mpich.module-useful.patch
# TODO: submit ^ upstream
# https://github.com/pmodels/mpich/pull/6374
Patch: 6374.patch
Patch: mpich-configure-max_align_t.patch
Patch: mpich-aclocal_cc-implicit-int.patch