From ade590bf2739d0bd4dd6d8cc321656828229373f Mon Sep 17 00:00:00 2001 From: Wenduo Wang Date: Mon, 22 Jul 2024 13:01:46 -0700 Subject: [PATCH 1/2] Revert "Check that requests belong to similar sessions" bot:notacherrypick This reverts commit c3498bcf3d263e5985c18a308806ccc1a5d87ade. Signed-off-by: Wenduo Wang --- ompi/communicator/communicator.h | 6 +++++- ompi/mpi/c/testall.c | 25 +++++++++++++++++++++---- ompi/mpi/c/testany.c | 25 +++++++++++++++++++++---- ompi/mpi/c/testsome.c | 25 +++++++++++++++++++++---- ompi/mpi/c/waitall.c | 25 +++++++++++++++++++++---- ompi/mpi/c/waitany.c | 25 +++++++++++++++++++++---- ompi/mpi/c/waitsome.c | 25 +++++++++++++++++++++---- ompi/request/request.c | 23 ----------------------- ompi/request/request.h | 17 ----------------- 9 files changed, 131 insertions(+), 65 deletions(-) diff --git a/ompi/communicator/communicator.h b/ompi/communicator/communicator.h index f61a8350685..81a66400446 100644 --- a/ompi/communicator/communicator.h +++ b/ompi/communicator/communicator.h @@ -25,7 +25,6 @@ * Copyright (c) 2018-2024 Triad National Security, LLC. All rights * reserved. * Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. - * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -610,6 +609,11 @@ static inline struct ompi_proc_t* ompi_comm_peer_lookup (const ompi_communicator return ompi_group_peer_lookup(comm->c_remote_group,peer_id); } +static inline bool ompi_comm_instances_same(const ompi_communicator_t *comm1, const ompi_communicator_t *comm2) +{ + return comm1->instance == comm2->instance; +} + #if OPAL_ENABLE_FT_MPI /* * Support for MPI_ANY_SOURCE point-to-point operations diff --git a/ompi/mpi/c/testall.c b/ompi/mpi/c/testall.c index 4eac940b257..28d9ffc502c 100644 --- a/ompi/mpi/c/testall.c +++ b/ompi/mpi/c/testall.c @@ -17,7 +17,6 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2021 Triad National Security, LLC. All rights * reserved. - * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -58,13 +57,31 @@ int MPI_Testall(int count, MPI_Request requests[], int *flag, ); if ( MPI_PARAM_CHECK ) { - int rc = MPI_SUCCESS; + int i, rc = MPI_SUCCESS; + MPI_Request check_req = NULL; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if( (NULL == requests) && (0 != count) ) { rc = MPI_ERR_REQUEST; } else { - if(!ompi_request_check_same_instance(requests, count) ) { - rc = MPI_ERR_REQUEST; + for (i = 0; i < count; i++) { + if (NULL == requests[i]) { + rc = MPI_ERR_REQUEST; + break; + } + if (&ompi_request_empty == requests[i]) { + continue; + } else if (NULL == requests[i]->req_mpi_object.comm) { + continue; + } else if (NULL == check_req) { + check_req = requests[i]; + } + else { + if (!ompi_comm_instances_same(requests[i]->req_mpi_object.comm, + check_req->req_mpi_object.comm)) { + rc = MPI_ERR_REQUEST; + break; + } + } } } if ((NULL == flag) || (count < 0)) { diff --git a/ompi/mpi/c/testany.c b/ompi/mpi/c/testany.c index 8a70002d495..4993ce729f0 100644 --- a/ompi/mpi/c/testany.c +++ b/ompi/mpi/c/testany.c @@ -17,7 +17,6 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2021 Triad National Security, LLC. All rights * reserved. - * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -57,13 +56,31 @@ int MPI_Testany(int count, MPI_Request requests[], int *indx, int *completed, MP ); if ( MPI_PARAM_CHECK ) { - int rc = MPI_SUCCESS; + int i, rc = MPI_SUCCESS; + MPI_Request check_req = NULL; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if ((NULL == requests) && (0 != count)) { rc = MPI_ERR_REQUEST; } else { - if(!ompi_request_check_same_instance(requests, count) ) { - rc = MPI_ERR_REQUEST; + for (i = 0; i < count; i++) { + if (NULL == requests[i]) { + rc = MPI_ERR_REQUEST; + break; + } + if (&ompi_request_empty == requests[i]) { + continue; + } else if (NULL == requests[i]->req_mpi_object.comm) { + continue; + } else if (NULL == check_req) { + check_req = requests[i]; + } + else { + if (!ompi_comm_instances_same(requests[i]->req_mpi_object.comm, + check_req->req_mpi_object.comm)) { + rc = MPI_ERR_REQUEST; + break; + } + } } } if (((NULL == indx || NULL == completed) && count > 0) || diff --git a/ompi/mpi/c/testsome.c b/ompi/mpi/c/testsome.c index 459335ded67..84ea14fabd7 100644 --- a/ompi/mpi/c/testsome.c +++ b/ompi/mpi/c/testsome.c @@ -17,7 +17,6 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2021 Triad National Security, LLC. All rights * reserved. - * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -59,13 +58,31 @@ int MPI_Testsome(int incount, MPI_Request requests[], ); if ( MPI_PARAM_CHECK ) { - int rc = MPI_SUCCESS; + int indx, rc = MPI_SUCCESS; + MPI_Request check_req = NULL; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if ((NULL == requests) && (0 != incount)) { rc = MPI_ERR_REQUEST; } else { - if(!ompi_request_check_same_instance(requests, incount) ) { - rc = MPI_ERR_REQUEST; + for (indx = 0; indx < incount; ++indx) { + if (NULL == requests[indx]) { + rc = MPI_ERR_REQUEST; + break; + } + if (&ompi_request_empty == requests[indx]) { + continue; + } else if (NULL == requests[indx]->req_mpi_object.comm) { + continue; + } else if (NULL == check_req) { + check_req = requests[indx]; + } + else { + if (!ompi_comm_instances_same(requests[indx]->req_mpi_object.comm, + check_req->req_mpi_object.comm)) { + rc = MPI_ERR_REQUEST; + break; + } + } } } if (((NULL == outcount || NULL == indices) && incount > 0) || diff --git a/ompi/mpi/c/waitall.c b/ompi/mpi/c/waitall.c index ce2353dfc9b..14485de4e70 100644 --- a/ompi/mpi/c/waitall.c +++ b/ompi/mpi/c/waitall.c @@ -16,7 +16,6 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2021 Triad National Security, LLC. All rights * reserved. - * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -56,13 +55,31 @@ int MPI_Waitall(int count, MPI_Request requests[], MPI_Status statuses[]) ); if ( MPI_PARAM_CHECK ) { - int rc = MPI_SUCCESS; + int i, rc = MPI_SUCCESS; + MPI_Request check_req = NULL; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if( (NULL == requests) && (0 != count) ) { rc = MPI_ERR_REQUEST; } else { - if(!ompi_request_check_same_instance(requests, count) ) { - rc = MPI_ERR_REQUEST; + for (i = 0; i < count; i++) { + if (NULL == requests[i]) { + rc = MPI_ERR_REQUEST; + break; + } + if (&ompi_request_empty == requests[i]) { + continue; + } else if (NULL == requests[i]->req_mpi_object.comm) { + continue; + } else if (NULL == check_req) { + check_req = requests[i]; + } + else { + if (!ompi_comm_instances_same(requests[i]->req_mpi_object.comm, + check_req->req_mpi_object.comm)) { + rc = MPI_ERR_REQUEST; + break; + } + } } } if (count < 0) { diff --git a/ompi/mpi/c/waitany.c b/ompi/mpi/c/waitany.c index 83c7fdf2a9e..4b1dd771e3d 100644 --- a/ompi/mpi/c/waitany.c +++ b/ompi/mpi/c/waitany.c @@ -17,7 +17,6 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2021 Triad National Security, LLC. All rights * reserved. - * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -57,13 +56,31 @@ int MPI_Waitany(int count, MPI_Request requests[], int *indx, MPI_Status *status ); if ( MPI_PARAM_CHECK ) { - int rc = MPI_SUCCESS; + int i, rc = MPI_SUCCESS; + MPI_Request check_req = NULL; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if ((NULL == requests) && (0 != count)) { rc = MPI_ERR_REQUEST; } else { - if(!ompi_request_check_same_instance(requests, count) ) { - rc = MPI_ERR_REQUEST; + for (i = 0; i < count; i++) { + if (NULL == requests[i]) { + rc = MPI_ERR_REQUEST; + break; + } + if (requests[i] == &ompi_request_empty) { + continue; + } else if (NULL == requests[i]->req_mpi_object.comm) { + continue; + } else if (NULL == check_req) { + check_req = requests[i]; + } + else { + if (!ompi_comm_instances_same(requests[i]->req_mpi_object.comm, + check_req->req_mpi_object.comm)) { + rc = MPI_ERR_REQUEST; + break; + } + } } } if ((NULL == indx && count > 0) || diff --git a/ompi/mpi/c/waitsome.c b/ompi/mpi/c/waitsome.c index 3b5b7ea3cc3..169c7e10ec4 100644 --- a/ompi/mpi/c/waitsome.c +++ b/ompi/mpi/c/waitsome.c @@ -17,7 +17,6 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2021 Triad National Security, LLC. All rights * reserved. - * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -59,13 +58,31 @@ int MPI_Waitsome(int incount, MPI_Request requests[], ); if ( MPI_PARAM_CHECK ) { - int rc = MPI_SUCCESS; + int indx, rc = MPI_SUCCESS; + MPI_Request check_req = NULL; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if ((NULL == requests) && (0 != incount)) { rc = MPI_ERR_REQUEST; } else { - if(!ompi_request_check_same_instance(requests, incount) ) { - rc = MPI_ERR_REQUEST; + for (indx = 0; indx < incount; ++indx) { + if (NULL == requests[indx]) { + rc = MPI_ERR_REQUEST; + break; + } + if (&ompi_request_empty == requests[indx]) { + continue; + } else if (NULL == requests[indx]->req_mpi_object.comm) { + continue; + } else if (NULL == check_req) { + check_req = requests[indx]; + } + else { + if (!ompi_comm_instances_same(requests[indx]->req_mpi_object.comm, + check_req->req_mpi_object.comm)) { + rc = MPI_ERR_REQUEST; + break; + } + } } } if (((NULL == outcount || NULL == indices) && incount > 0) || diff --git a/ompi/request/request.c b/ompi/request/request.c index 9e736e66a9e..cd824392e41 100644 --- a/ompi/request/request.c +++ b/ompi/request/request.c @@ -21,7 +21,6 @@ * Copyright (c) 2018 Triad National Security, LLC. All rights * reserved. * Copyright (c) 2022 IBM Corporation. All rights reserved. - * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -249,25 +248,3 @@ int ompi_request_persistent_noop_create(ompi_request_t** request) *request = req; return OMPI_SUCCESS; } - -bool ompi_request_check_same_instance(ompi_request_t** requests, - int count) -{ - ompi_request_t *req, *base = NULL; - - for(int idx = 0; idx < count; idx++ ) { - req = requests[idx]; - if(OMPI_REQUEST_NULL == req->req_type) /* predefined requests are generic */ - continue; - /* Only PML requests have support for MPI sessions */ - if(OMPI_REQUEST_PML != req->req_type) - continue; - if(NULL == base) { - base = req; - continue; - } - if(base->req_mpi_object.comm != req->req_mpi_object.comm) - return false; - } - return true; -} diff --git a/ompi/request/request.h b/ompi/request/request.h index baf6fbe3fd7..3d076cfeb7f 100644 --- a/ompi/request/request.h +++ b/ompi/request/request.h @@ -19,7 +19,6 @@ * Copyright (c) 2018 Triad National Security, LLC. All rights * reserved. * Copyright (c) 2022 IBM Corporation. All rights reserved. - * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -557,22 +556,6 @@ static inline int ompi_request_set_callback(ompi_request_t* request, return OMPI_SUCCESS; } -/** - * Check if an array of requests contains only requests that belong to the same - * instance or MPI Session. Exclude predefined requests, that are generic and part - * of all instances. - * Right now, only tests for PML requests as they are the only requests that have - * support for MPI Sessions. - * - * @param requests (IN) Array of requests - * @param count (IN) Number of requests - * @return true if all requests are part of the same instance - * or MPI Session, false otherwise. - * - */ -bool ompi_request_check_same_instance(ompi_request_t** requests, - int count); - END_C_DECLS #endif From 2196d01cd04310cc70d8382972adb1dbe2d4cb02 Mon Sep 17 00:00:00 2001 From: Wenduo Wang Date: Thu, 18 Jul 2024 17:08:37 -0700 Subject: [PATCH 2/2] workflow: add macOS check Increase CI coverage to prevent #12693 Signed-off-by: Wenduo Wang (cherry picked from commit fcf7e16d7103b26b3d8cc4bdc6f9fe7b94d3e606) --- .github/workflows/macos-checks.yaml | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/macos-checks.yaml diff --git a/.github/workflows/macos-checks.yaml b/.github/workflows/macos-checks.yaml new file mode 100644 index 00000000000..0b90adeb9a3 --- /dev/null +++ b/.github/workflows/macos-checks.yaml @@ -0,0 +1,45 @@ +name: macOS + +on: [pull_request] + +jobs: + macOS: + runs-on: macos-latest + steps: + - name: Setup macOS + run: | + # Copied from mpi4py/mpi-publish + # create gfortran symlink + cd $(brew --prefix)/bin + gfortran=$(ls gfortran-* | sort | head -n 1) + sudo ln -s $gfortran gfortran + # install autotools + brew install autoconf + brew install automake + brew install libtool + # unlink libevent + brew unlink libevent || true + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Build Open MPI + run: | + ./autogen.pl + ./configure --prefix=/opt/openmpi + make -j $(sysctl -n hw.logicalcpu) + - name: Run unit tests + run: | + make check + - name: Install Open MPI + run: | + sudo make install + - name: Add Open MPI to PATH + run: echo /opt/openmpi/bin >> $GITHUB_PATH + - name: Build examples + run: | + pushd examples + make + popd + - name: Test ring + run: | + mpirun --map-by ppr:1:core examples/ring_c