Skip to content

Commit bb6990e

Browse files
committed
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 <[email protected]>
1 parent 25ce8f9 commit bb6990e

File tree

6 files changed

+21
-13
lines changed

6 files changed

+21
-13
lines changed

ompi/mpi/c/request_get_status_all.c.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
1313
* Copyright (c) 2015 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
15-
* Copyright (c) 2024 Triad National Security, LLC. All rights
15+
* Copyright (c) 2024-2025 Triad National Security, LLC. All rights
1616
* reserved.
1717
* Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved
1818
*
@@ -110,7 +110,7 @@ PROTOTYPE ERROR_CLASS request_get_status_all(INT count, REQUEST_CONST requests:c
110110
for (i = 0; i < count; i++) {
111111
if( (requests[i] == MPI_REQUEST_NULL) || (requests[i]->req_state == OMPI_REQUEST_INACTIVE) ) {
112112
if (MPI_STATUS_IGNORE != statuses) {
113-
OMPI_COPY_STATUS(&statuses[i], ompi_status_empty, false);
113+
OMPI_COPY_STATUS(&statuses[i], ompi_status_empty, true);
114114
}
115115
}
116116
/* If this is a generalized request, we *always* have to call

ompi/mpi/c/request_get_status_any.c.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
1313
* Copyright (c) 2015 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
15-
* Copyright (c) 2024 Triad National Security, LLC. All rights
15+
* Copyright (c) 2024-2025 Triad National Security, LLC. All rights
1616
* reserved.
1717
* Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved
1818
*
@@ -73,7 +73,7 @@ PROTOTYPE ERROR_CLASS request_get_status_any(INT count, REQUEST_CONST requests:c
7373
*flag = true;
7474
*indx = MPI_UNDEFINED;
7575
if (MPI_STATUS_IGNORE != status) {
76-
OMPI_COPY_STATUS(status, ompi_status_empty, false);
76+
OMPI_COPY_STATUS(status, ompi_status_empty, true);
7777
}
7878
return MPI_SUCCESS;
7979
}
@@ -115,7 +115,7 @@ PROTOTYPE ERROR_CLASS request_get_status_any(INT count, REQUEST_CONST requests:c
115115
*flag = true;
116116
*indx = MPI_UNDEFINED;
117117
if (MPI_STATUS_IGNORE != status) {
118-
OMPI_COPY_STATUS(status, ompi_status_empty, false);
118+
OMPI_COPY_STATUS(status, ompi_status_empty, true);
119119
}
120120
return MPI_SUCCESS;
121121
}

ompi/mpi/c/testany.c.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* reserved.
1616
* Copyright (c) 2014-2015 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
18-
* Copyright (c) 2021-2024 Triad National Security, LLC. All rights
18+
* Copyright (c) 2021-2025 Triad National Security, LLC. All rights
1919
* reserved.
2020
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
2121
* $COPYRIGHT$
@@ -67,7 +67,7 @@ PROTOTYPE ERROR_CLASS testany(INT count, REQUEST_INOUT requests, INT_OUT indx, I
6767
*completed = true;
6868
*indx = MPI_UNDEFINED;
6969
if (MPI_STATUS_IGNORE != status) {
70-
OMPI_COPY_STATUS(status, ompi_status_empty, false);
70+
OMPI_COPY_STATUS(status, ompi_status_empty, true);
7171
}
7272
return MPI_SUCCESS;
7373
}

ompi/mpi/c/wait.c.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2024 Triad National Security, LLC. All rights
1616
* reserved.
17-
* Copyright (c) 2024 Triad National Security, LLC. All rights
17+
* Copyright (c) 2024-2025 Triad National Security, LLC. All rights
1818
* reserved.
1919
* $COPYRIGHT$
2020
*
@@ -52,9 +52,10 @@ PROTOTYPE ERROR_CLASS wait(REQUEST_INOUT request, STATUS_OUT status)
5252

5353
if (MPI_REQUEST_NULL == *request) {
5454
if (MPI_STATUS_IGNORE != status) {
55-
OMPI_COPY_STATUS(status, ompi_status_empty, false);
55+
OMPI_COPY_STATUS(status, ompi_status_empty, true);
5656
/*
5757
* Per MPI-1, the MPI_ERROR field is not defined for single-completion calls
58+
* Rules changed later apparently. See section 3.7.3 of the MPI 4.1 standard.
5859
*/
5960
MEMCHECKER(
6061
opal_memchecker_base_mem_undefined(&status->MPI_ERROR, sizeof(int));

ompi/mpi/c/waitany.c.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Copyright (c) 2021-2024 Triad National Security, LLC. All rights
1919
* reserved.
2020
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
21-
* Copyright (c) 2024 Triad National Security, LLC. All rights
21+
* Copyright (c) 2024-2025 Triad National Security, LLC. All rights
2222
* reserved.
2323
* $COPYRIGHT$
2424
*
@@ -68,7 +68,7 @@ PROTOTYPE ERROR_CLASS waitany(INT count, REQUEST_INOUT requests, INT_OUT indx, S
6868
if (OPAL_UNLIKELY(0 == count)) {
6969
*indx = MPI_UNDEFINED;
7070
if (MPI_STATUS_IGNORE != status) {
71-
OMPI_COPY_STATUS(status, ompi_status_empty, false);
71+
OMPI_COPY_STATUS(status, ompi_status_empty, true);
7272
}
7373
return MPI_SUCCESS;
7474
}

ompi/request/request.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Copyright (c) 2015-2024 Research Organization for Information Science
1919
* and Technology (RIST). All rights reserved.
2020
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
21-
* Copyright (c) 2018 Triad National Security, LLC. All rights
21+
* Copyright (c) 2018-2025 Triad National Security, LLC. All rights
2222
* reserved.
2323
* Copyright (c) 2022 IBM Corporation. All rights reserved.
2424
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
@@ -47,7 +47,14 @@ ompi_request_t ompi_request_empty = {{{{0}}}};
4747
#if MPI_VERSION >= 4
4848
ompi_request_t ompi_request_empty_send = {{{{0}}}};
4949
#endif
50-
ompi_status_public_t ompi_status_empty = {0};
50+
/*
51+
* See section 3.7.3 of the MPI 1.3 (probably older as well) MPI standard
52+
*/
53+
ompi_status_public_t ompi_status_empty = {.MPI_TAG = MPI_ANY_TAG,
54+
.MPI_SOURCE = MPI_ANY_SOURCE,
55+
.MPI_ERROR = MPI_SUCCESS,
56+
._cancelled = 0,
57+
._ucount = 0UL};
5158
ompi_request_fns_t ompi_request_functions = {
5259
ompi_request_default_test,
5360
ompi_request_default_test_any,

0 commit comments

Comments
 (0)