diff --git a/CHANGELOG.md b/CHANGELOG.md index dac6501fe597..bbf0a9e62f6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated +## [2.47.2] - 2024-08-16 + +### Fixed + +- Fix bug in supporting externally initialized MPI + ## [2.47.1] - 2024-07-17 ### Fixed diff --git a/CMakeLists.txt b/CMakeLists.txt index 34a9c4d35e30..febab17e3ed3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ endif () project ( MAPL - VERSION 2.47.1 + VERSION 2.47.2 LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF # Set the possible values of build type for cmake-gui diff --git a/gridcomps/Cap/MAPL_Cap.F90 b/gridcomps/Cap/MAPL_Cap.F90 index 007d857d6da0..3905711b796a 100644 --- a/gridcomps/Cap/MAPL_Cap.F90 +++ b/gridcomps/Cap/MAPL_Cap.F90 @@ -447,17 +447,19 @@ subroutine initialize_mpi(this, unusable, rc) _UNUSED_DUMMY(unusable) - !call MPI_Initialized(this%mpi_already_initialized, ierror) - !_VERIFY(ierror) - call ESMF_InitializePreMPI(_RC) + call MPI_Initialized(this%mpi_already_initialized, ierror) + _VERIFY(ierror) if (.not. this%mpi_already_initialized) then + call ESMF_InitializePreMPI(_RC) call MPI_Init_thread(MPI_THREAD_MULTIPLE, provided, ierror) - _ASSERT(provided == MPI_THREAD_MULTIPLE, 'MPI_THREAD_MULTIPLE not supported by this MPI.') -! call MPI_Init_thread(MPI_THREAD_SINGLE, provided, ierror) -! _VERIFY(ierror) -! _ASSERT(provided == MPI_THREAD_SINGLE, "MPI_THREAD_SINGLE not supported by this MPI.") + else + ! If we are here, then MPI has already been initialized by the user + ! and we are just using it. But we need to make sure that the user + ! has initialized MPI with the correct threading level. + call MPI_Query_thread(provided, ierror) end if + _ASSERT(provided == MPI_THREAD_MULTIPLE, 'MPI_THREAD_MULTIPLE not supported by this MPI.') call MPI_Comm_rank(this%comm_world, this%rank, ierror); _VERIFY(ierror) call MPI_Comm_size(this%comm_world, npes_world, ierror); _VERIFY(ierror)