From bb6990e01d650f029cb6eb68f20236f773572c99 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 28 Oct 2025 11:23:44 -0600 Subject: [PATCH 1/3] fix problems with handling empty status Testing with mpi4py for MPI 4.1 compliance uncovered a long existing problem in the way Open MPI handles (incorrectly) returning an empty status when that is specified by the MPI standard. With this fix, mpi4py passes if we declare MPI 4.1 compliance except for the big count tests. Signed-off-by: Howard Pritchard --- ompi/mpi/c/request_get_status_all.c.in | 4 ++-- ompi/mpi/c/request_get_status_any.c.in | 6 +++--- ompi/mpi/c/testany.c.in | 4 ++-- ompi/mpi/c/wait.c.in | 5 +++-- ompi/mpi/c/waitany.c.in | 4 ++-- ompi/request/request.c | 11 +++++++++-- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/ompi/mpi/c/request_get_status_all.c.in b/ompi/mpi/c/request_get_status_all.c.in index dbbe17b6a14..8225aaef999 100644 --- a/ompi/mpi/c/request_get_status_all.c.in +++ b/ompi/mpi/c/request_get_status_all.c.in @@ -12,7 +12,7 @@ * Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2024 Triad National Security, LLC. All rights + * Copyright (c) 2024-2025 Triad National Security, LLC. All rights * reserved. * Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved * @@ -110,7 +110,7 @@ PROTOTYPE ERROR_CLASS request_get_status_all(INT count, REQUEST_CONST requests:c for (i = 0; i < count; i++) { if( (requests[i] == MPI_REQUEST_NULL) || (requests[i]->req_state == OMPI_REQUEST_INACTIVE) ) { if (MPI_STATUS_IGNORE != statuses) { - OMPI_COPY_STATUS(&statuses[i], ompi_status_empty, false); + OMPI_COPY_STATUS(&statuses[i], ompi_status_empty, true); } } /* If this is a generalized request, we *always* have to call diff --git a/ompi/mpi/c/request_get_status_any.c.in b/ompi/mpi/c/request_get_status_any.c.in index cc33ed33bf3..60fc6ce4446 100644 --- a/ompi/mpi/c/request_get_status_any.c.in +++ b/ompi/mpi/c/request_get_status_any.c.in @@ -12,7 +12,7 @@ * Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2024 Triad National Security, LLC. All rights + * Copyright (c) 2024-2025 Triad National Security, LLC. All rights * reserved. * Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved * @@ -73,7 +73,7 @@ PROTOTYPE ERROR_CLASS request_get_status_any(INT count, REQUEST_CONST requests:c *flag = true; *indx = MPI_UNDEFINED; if (MPI_STATUS_IGNORE != status) { - OMPI_COPY_STATUS(status, ompi_status_empty, false); + OMPI_COPY_STATUS(status, ompi_status_empty, true); } return MPI_SUCCESS; } @@ -115,7 +115,7 @@ PROTOTYPE ERROR_CLASS request_get_status_any(INT count, REQUEST_CONST requests:c *flag = true; *indx = MPI_UNDEFINED; if (MPI_STATUS_IGNORE != status) { - OMPI_COPY_STATUS(status, ompi_status_empty, false); + OMPI_COPY_STATUS(status, ompi_status_empty, true); } return MPI_SUCCESS; } diff --git a/ompi/mpi/c/testany.c.in b/ompi/mpi/c/testany.c.in index 50ed88b2fa5..4e533ecf6df 100644 --- a/ompi/mpi/c/testany.c.in +++ b/ompi/mpi/c/testany.c.in @@ -15,7 +15,7 @@ * reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2021-2024 Triad National Security, LLC. All rights + * Copyright (c) 2021-2025 Triad National Security, LLC. All rights * reserved. * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ @@ -67,7 +67,7 @@ PROTOTYPE ERROR_CLASS testany(INT count, REQUEST_INOUT requests, INT_OUT indx, I *completed = true; *indx = MPI_UNDEFINED; if (MPI_STATUS_IGNORE != status) { - OMPI_COPY_STATUS(status, ompi_status_empty, false); + OMPI_COPY_STATUS(status, ompi_status_empty, true); } return MPI_SUCCESS; } diff --git a/ompi/mpi/c/wait.c.in b/ompi/mpi/c/wait.c.in index d2db5ab726f..7271c18ef7c 100644 --- a/ompi/mpi/c/wait.c.in +++ b/ompi/mpi/c/wait.c.in @@ -14,7 +14,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2024 Triad National Security, LLC. All rights * reserved. - * Copyright (c) 2024 Triad National Security, LLC. All rights + * Copyright (c) 2024-2025 Triad National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -52,9 +52,10 @@ PROTOTYPE ERROR_CLASS wait(REQUEST_INOUT request, STATUS_OUT status) if (MPI_REQUEST_NULL == *request) { if (MPI_STATUS_IGNORE != status) { - OMPI_COPY_STATUS(status, ompi_status_empty, false); + OMPI_COPY_STATUS(status, ompi_status_empty, true); /* * Per MPI-1, the MPI_ERROR field is not defined for single-completion calls + * Rules changed later apparently. See section 3.7.3 of the MPI 4.1 standard. */ MEMCHECKER( opal_memchecker_base_mem_undefined(&status->MPI_ERROR, sizeof(int)); diff --git a/ompi/mpi/c/waitany.c.in b/ompi/mpi/c/waitany.c.in index 5d2fb4424eb..86bac469e4a 100644 --- a/ompi/mpi/c/waitany.c.in +++ b/ompi/mpi/c/waitany.c.in @@ -18,7 +18,7 @@ * Copyright (c) 2021-2024 Triad National Security, LLC. All rights * reserved. * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2024 Triad National Security, LLC. All rights + * Copyright (c) 2024-2025 Triad National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -68,7 +68,7 @@ PROTOTYPE ERROR_CLASS waitany(INT count, REQUEST_INOUT requests, INT_OUT indx, S if (OPAL_UNLIKELY(0 == count)) { *indx = MPI_UNDEFINED; if (MPI_STATUS_IGNORE != status) { - OMPI_COPY_STATUS(status, ompi_status_empty, false); + OMPI_COPY_STATUS(status, ompi_status_empty, true); } return MPI_SUCCESS; } diff --git a/ompi/request/request.c b/ompi/request/request.c index 3f72a23fde0..c55f010690d 100644 --- a/ompi/request/request.c +++ b/ompi/request/request.c @@ -18,7 +18,7 @@ * Copyright (c) 2015-2024 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. - * Copyright (c) 2018 Triad National Security, LLC. All rights + * Copyright (c) 2018-2025 Triad National Security, LLC. All rights * reserved. * Copyright (c) 2022 IBM Corporation. All rights reserved. * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. @@ -47,7 +47,14 @@ ompi_request_t ompi_request_empty = {{{{0}}}}; #if MPI_VERSION >= 4 ompi_request_t ompi_request_empty_send = {{{{0}}}}; #endif -ompi_status_public_t ompi_status_empty = {0}; +/* + * See section 3.7.3 of the MPI 1.3 (probably older as well) MPI standard + */ +ompi_status_public_t ompi_status_empty = {.MPI_TAG = MPI_ANY_TAG, + .MPI_SOURCE = MPI_ANY_SOURCE, + .MPI_ERROR = MPI_SUCCESS, + ._cancelled = 0, + ._ucount = 0UL}; ompi_request_fns_t ompi_request_functions = { ompi_request_default_test, ompi_request_default_test_any, From a69b935e201650f2a92b0c9298b403343976a55b Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 28 Oct 2025 09:07:17 -0600 Subject: [PATCH 2/3] DO NOT MERGE ME see if mpi4py believes us for 4.1 compliance Signed-off-by: Howard Pritchard --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 44eb7329d5d..20ae1c819c6 100644 --- a/VERSION +++ b/VERSION @@ -20,7 +20,7 @@ minor=1 release=0 # MPI Standard Compliance Level -mpi_standard_version=3 +mpi_standard_version=4 mpi_standard_subversion=1 # OMPI required dependency versions. From 7c2393c486286db43857a662861fbcb4db0f7dc1 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 28 Oct 2025 11:27:36 -0600 Subject: [PATCH 3/3] DONT MERGE ME: running mpi4py for 4.1 but without bigcount tests Signed-off-by: Howard Pritchard --- .github/workflows/ompi_mpi4py.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ompi_mpi4py.yaml b/.github/workflows/ompi_mpi4py.yaml index 0e9f675023e..25c865d1cb1 100644 --- a/.github/workflows/ompi_mpi4py.yaml +++ b/.github/workflows/ompi_mpi4py.yaml @@ -113,27 +113,27 @@ jobs: CFLAGS: "-O0" - name: Test mpi4py (singleton) - run: python test/main.py -v -x TestExcErrhandlerNull + run: python test/main.py -v -x testContiguousBigMPI if: ${{ true }} timeout-minutes: 10 - name: Test mpi4py (np=1) - run: mpiexec -n 1 python test/main.py -v -x TestExcErrhandlerNull + run: mpiexec -n 1 python test/main.py -v -x testContiguousBigMPI if: ${{ true }} timeout-minutes: 10 - name: Test mpi4py (np=2) - run: mpiexec -n 2 python test/main.py -v -f -x TestExcErrhandlerNull + run: mpiexec -n 2 python test/main.py -v -f -x testContiguousBigMPI if: ${{ true }} timeout-minutes: 10 - name: Test mpi4py (np=3) - run: mpiexec -n 3 python test/main.py -v -f -x TestExcErrhandlerNull + run: mpiexec -n 3 python test/main.py -v -f -x testContiguousBigMPI if: ${{ true }} timeout-minutes: 10 - name: Test mpi4py (np=4) - run: mpiexec -n 4 python test/main.py -v -f -x TestExcErrhandlerNull + run: mpiexec -n 4 python test/main.py -v -f -x testContiguousBigMPI if: ${{ true }} timeout-minutes: 10 - name: Test mpi4py (np=5) - run: mpiexec -n 5 python test/main.py -v -f -x TestExcErrhandlerNull + run: mpiexec -n 5 python test/main.py -v -f -x testContiguousBigMPI if: ${{ true }} timeout-minutes: 10 @@ -151,7 +151,7 @@ jobs: echo LD_LIBRARY_PATH=/opt/ompi/lib >> $GITHUB_ENV - name: Test mpi4py (singleton) - run: python test/main.py -v -x TestExcErrhandlerNull + run: python test/main.py -v -x testContiguousBigMPI if: ${{ true }} timeout-minutes: 10