Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to refactor use of FLAP. #1007

Merged
merged 4 commits into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Relocated CapOptions related modules to `./gridcomps/Cap`. Also simplified the
FLAP options layer a bit. Had to introduce some minor naming kludges to keep
high level GEOS interfaces working. This should be revisited under 3.0.

### Fixed
- Fixed issue #486. Empty state restarts will now be ignored (with warning) for writing (the code also protects reading, but the existing code already had a different protection)
- Added default `CMAKE_BUILD_TYPE` for MAPL standalone. Defaults to `Release` build if not set on command line
Expand Down
1 change: 0 additions & 1 deletion Tests/ExtDataDriver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ program ExtData_Driver
use ESMF
use ExtData_DriverGridCompMod, only: ExtData_DriverGridComp, new_ExtData_DriverGridComp
use ExtDataUtRoot_GridCompMod, only: ROOT_SetServices => SetServices
use FLAP
use ExtDataDriverMod
use MAPL

Expand Down
10 changes: 5 additions & 5 deletions Tests/ExtDataDriverMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module ExtDataDriverMod
type(MpiServer), pointer :: i_server=>null()
type(MpiServer), pointer :: o_server=>null()
type(DirectoryService) :: directory_service
class (MAPL_CapOptions), allocatable :: cap_options
type (MAPL_CapOptions) :: cap_options
type(SplitCommunicator) :: split_comm

contains
Expand All @@ -45,8 +45,8 @@ function newExtDataDriver(name,set_services, unusable, cap_options, rc) result(d
type(ExtDataDriver) :: driver
character(*), intent(in) :: name
procedure() :: set_services
class (KeywordEnforcer), optional, intent(in) :: unusable
class ( MAPL_CapOptions), optional, intent(in) :: cap_options
class(KeywordEnforcer), optional, intent(in) :: unusable
class(MAPL_CapOptions), optional, intent(in) :: cap_options
integer, optional, intent(out) :: rc

integer :: status
Expand All @@ -55,9 +55,9 @@ function newExtDataDriver(name,set_services, unusable, cap_options, rc) result(d
driver%name = name
driver%set_services => set_services
if (present(cap_options)) then
allocate(driver%cap_options, source = cap_options)
driver%cap_options = cap_options
else
allocate(driver%cap_options, source = MAPL_CapOptions())
driver%cap_options = MAPL_CapOptions()
endif
call driver%initialize_mpi()
call MAPL_Initialize(rc=status)
Expand Down
16 changes: 8 additions & 8 deletions Tests/pfio_MAPL_demo.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ program main
use, intrinsic :: iso_fortran_env, only: REAL32
use mpi
use MAPL
use MAPL_FlapCliMod
use MAPL_CapOptionsMod
use pFIO_UnlimitedEntityMod

implicit none

type(MAPL_FlapCLI) :: cli
type(MAPL_CapOptions) :: cap_options
type(ServerManager) :: ioserver_manager
type(SplitCommunicator) :: split_comm
Expand Down Expand Up @@ -57,9 +57,9 @@ program main
integer, allocatable :: map_domainY(:,:,:)
integer, allocatable :: map_proc(:,:)

integer :: client_comm,rank, npes, ierror, provided,required
integer :: status, pe_id, rc
integer :: i, j, k, hist_id, stage_id, n, num_steps
integer :: client_comm, npes, ierror
integer :: status, pe_id
integer :: i, j, k, hist_id, n, num_steps
integer :: i1, i2, j1, j2, k1, k2
real :: hh
real, allocatable :: local_temp(:,:,:)
Expand All @@ -74,9 +74,9 @@ program main
!BOC

! Read and parse the command line, and set parameters
cli = MAPL_FlapCLI(description = 'GEOS AGCM', &
authors = 'GMAO')
cap_options = MAPL_CapOptions(cli)
cap_options = MAPL_FlapCLI( &
description = 'GEOS AGCM', &
authors = 'GMAO')

call MPI_init(ierror)

Expand Down
10 changes: 1 addition & 9 deletions base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set (srcs
MAPL_StringRouteHandleMap.F90
MAPL_IdentityRegridder.F90 MAPL_stubs.F90
MAPL_Integer64GridFactoryMap.F90 MAPL_sun_uc.F90
MAPL_CapOptions.F90 MAPL_TilingRegridder.F90
MAPL_TilingRegridder.F90
MAPL_CFIO.F90 MAPL_IO.F90 MAPL_TimeMethods.F90
MAPL_LatLonGridFactory.F90 MAPL_TransposeRegridder.F90
MAPL_Comms.F90 MAPL_LatLonToLatLonRegridder.F90 MAPL_TripolarGridFactory.F90
Expand All @@ -53,9 +53,6 @@ set (srcs
# tstqsat.F90
)

if (BUILD_WITH_FLAP)
list (APPEND srcs MAPL_FlapCLI.F90)
endif()

esma_add_library(
${this} SRCS ${srcs}
Expand All @@ -76,11 +73,6 @@ target_compile_definitions (${this} PRIVATE TWO_SIDED_COMM MAPL_MODE)
target_include_directories (${this} PUBLIC
$<BUILD_INTERFACE:${MAPL_SOURCE_DIR}/include>)

if (BUILD_WITH_FLAP)
target_link_libraries(${this} PRIVATE FLAP::FLAP)
target_compile_definitions (${this} PRIVATE USE_FLAP)
endif()

# Kludge for OSX security and DYLD_LIBRARY_PATH ...
foreach(dir ${OSX_EXTRA_LIBRARY_PATH})
target_link_libraries(${this} PUBLIC "-Xlinker -rpath -Xlinker ${dir}")
Expand Down
177 changes: 0 additions & 177 deletions base/MAPL_CapOptions.F90

This file was deleted.

4 changes: 0 additions & 4 deletions base/MAPL_Mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ module MAPL_Mod
use MAPL_InterpMod
use MAPL_HeapMod
use MAPL_SatVaporMod
use MAPL_CapOptionsMod
#ifdef USE_FLAP
use MAPL_FlapCLIMod
#endif
use MAPL_MemUtilsMod
use MAPL_HashMod
use MAPL_LoadBalanceMod
Expand Down
4 changes: 4 additions & 0 deletions gridcomps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ esma_add_library (${this}

target_include_directories (${this} PUBLIC
$<BUILD_INTERFACE:${MAPL_SOURCE_DIR}/include>)
if (BUILD_WITH_FLAP)
target_link_libraries(${this} PRIVATE FLAP::FLAP)
target_compile_definitions (${this} PRIVATE USE_FLAP)
endif()

add_subdirectory(Cap)
add_subdirectory(History)
11 changes: 10 additions & 1 deletion gridcomps/Cap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
esma_set_this (OVERRIDE MAPL.cap)

set (srcs
MAPL_Cap.F90
MAPL_CapGridComp.F90
MAPL_NUOPCWrapperMod.F90
CapOptions.F90
)
if (BUILD_WITH_FLAP)
list (APPEND srcs FlapCLI.F90)
endif()


esma_add_library (${this} SRCS ${srcs} DEPENDENCIES MAPL.shared MAPL.constants MAPL.base MAPL.profiler MAPL.history TYPE ${MAPL_LIBRARY_TYPE})
target_link_libraries (${this} PUBLIC GFTL::gftl GFTL_SHARED::gftl-shared esmf NetCDF::NetCDF_Fortran
Expand All @@ -15,5 +19,10 @@ if (NOT CMAKE_Fortran_COMPILER_ID MATCHES "NAG")
target_link_libraries(${this} PRIVATE OpenMP::OpenMP_Fortran)
endif ()
target_include_directories (${this} PUBLIC $<BUILD_INTERFACE:${MAPL_SOURCE_DIR}/include>)
if (BUILD_WITH_FLAP)
target_link_libraries(${this} PRIVATE FLAP::FLAP)
target_compile_definitions (${this} PRIVATE USE_FLAP)
endif()


set_target_properties (${this} PROPERTIES Fortran_MODULE_DIRECTORY ${include_${this}})
Loading