From 6b6707dc7a159f1d86a1e0e9fce665eeed1b4a67 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 26 Jan 2024 10:52:53 -0500 Subject: [PATCH 1/2] Fixes #2553. Detect mpiuni builds of ESMF --- CHANGELOG.md | 4 ++-- gridcomps/Cap/MAPL_Cap.F90 | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1c8b8d7391b..4586f6066459 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added + - Convert from ABI Fixed Grid to lon/lat coordinates used in MAPL_XYGridFactory (supporting geostationary GOES-R series) - Modify trajectory sampler for a collection with multiple platforms: P3B (air craft) + FIREX - Modify swath sampler to handle two Epoch swath grids @@ -16,8 +17,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - parse "GOCART::CO2" from 'geovals_fields' entry in PLATFORM - Add call MAPL_InitializeShmem to ExtDataDriverGridComp.F90 - Read swath data on root, call MAPL_CommsBcast [which sends data to Shmem (when Shmem initialized) or to MAPL_comm otherwise]. This approach avoids race in reading nc files [e.g. 37 files for 3 hr swath data] - - - Added memory utility, MAPL_MemReport that can be used in any code linking MAPL - Added capability in XY grid factory to add a mask to the grid any points are missing needed for geostationary input data - Added capability in the MAPL ESMF regridding wrapper to apply a destination mask if the destination grid contains a mask @@ -41,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Explictly `use` some `iso_c_binding` types previously pulled in through ESMF. This is fixed in future ESMF versions (8.7+) and so we anticipate this here - Add explicit `Fortran_MODULE_DIRECTORY` to `CMakeLists.txt` in benchmarks to avoid race condition in Ninja builds +- Add check to make sure ESMF was not built as `mpiuni` ### Removed diff --git a/gridcomps/Cap/MAPL_Cap.F90 b/gridcomps/Cap/MAPL_Cap.F90 index 3b23c8a5c92d..00640e024c4b 100644 --- a/gridcomps/Cap/MAPL_Cap.F90 +++ b/gridcomps/Cap/MAPL_Cap.F90 @@ -275,6 +275,8 @@ subroutine run_model(this, comm, unusable, rc) integer :: status class(Logger), pointer :: lgr logical :: file_exists + type (ESMF_VM) :: VM + character(len=:), allocatable :: esmfComm _UNUSED_DUMMY(unusable) @@ -298,6 +300,11 @@ subroutine run_model(this, comm, unusable, rc) call ESMF_Initialize (logKindFlag=this%cap_options%esmf_logging_mode, mpiCommunicator=comm, _RC) end if + ! We check to see if ESMF_COMM was built as mpiuni which is not allowed for MAPL + call ESMF_VmGetCurrent(VM, _RC) + call ESMF_VmGet(VM, esmfComm = esmfComm, _RC) + _ASSERT( esmfComm /= 'mpiuni', 'ESMF_COMM=mpiuni is not allowed for MAPL') + ! Note per ESMF this is a temporary routine as eventually MOAB will ! be the only mesh generator. But until then, this allows us to ! test it From 401eb47bd8b2b155058d4abbb7c0c2e036b5af9b Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 26 Jan 2024 13:16:57 -0500 Subject: [PATCH 2/2] Use ESMF_Initialize to get the vm --- gridcomps/Cap/MAPL_Cap.F90 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gridcomps/Cap/MAPL_Cap.F90 b/gridcomps/Cap/MAPL_Cap.F90 index 00640e024c4b..007d857d6da0 100644 --- a/gridcomps/Cap/MAPL_Cap.F90 +++ b/gridcomps/Cap/MAPL_Cap.F90 @@ -275,7 +275,7 @@ subroutine run_model(this, comm, unusable, rc) integer :: status class(Logger), pointer :: lgr logical :: file_exists - type (ESMF_VM) :: VM + type (ESMF_VM) :: vm character(len=:), allocatable :: esmfComm _UNUSED_DUMMY(unusable) @@ -295,14 +295,13 @@ subroutine run_model(this, comm, unusable, rc) ! If the file exists, we pass it into ESMF_Initialize, else, we ! use the one from the command line arguments if (file_exists) then - call ESMF_Initialize (configFileName='ESMF.rc', mpiCommunicator=comm, _RC) + call ESMF_Initialize (configFileName='ESMF.rc', mpiCommunicator=comm, vm=vm, _RC) else - call ESMF_Initialize (logKindFlag=this%cap_options%esmf_logging_mode, mpiCommunicator=comm, _RC) + call ESMF_Initialize (logKindFlag=this%cap_options%esmf_logging_mode, mpiCommunicator=comm, vm=vm, _RC) end if ! We check to see if ESMF_COMM was built as mpiuni which is not allowed for MAPL - call ESMF_VmGetCurrent(VM, _RC) - call ESMF_VmGet(VM, esmfComm = esmfComm, _RC) + call ESMF_VmGet(vm, esmfComm = esmfComm, _RC) _ASSERT( esmfComm /= 'mpiuni', 'ESMF_COMM=mpiuni is not allowed for MAPL') ! Note per ESMF this is a temporary routine as eventually MOAB will