Skip to content

Commit

Permalink
Merge pull request #2527 from GEOS-ESM/feature/ygyu/revise_sampler
Browse files Browse the repository at this point in the history
Revise sampler code in History
  • Loading branch information
tclune authored Jan 19, 2024
2 parents 0d20fe3 + 89211d2 commit b042b6e
Show file tree
Hide file tree
Showing 10 changed files with 1,070 additions and 663 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Modify trajectory sampler for a collection with multiple platforms: P3B (air craft) + FIREX
- Modify swath sampler to handle two Epoch swath grids
- Handle regrid accumulate for time step (1 sec) during which no obs exists
- Use IntState%stampoffset(n) to adjust filenames for an epoch time
- 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
Expand Down
9 changes: 9 additions & 0 deletions Tests/ExtDataDriverGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ subroutine initialize_gc(gc, import_state, export_state, clock, rc)
type(ExtData_DriverGridComp), pointer :: cap
class(BaseProfiler), pointer :: t_p
logical :: use_extdata2g
integer :: useShmem

_UNUSED_DUMMY(import_state)
_UNUSED_DUMMY(export_state)
Expand Down Expand Up @@ -176,6 +177,7 @@ subroutine initialize_gc(gc, import_state, export_state, clock, rc)
call ESMF_ConfigLoadFile(cap%config, cap%configFile, rc = status)
_VERIFY(status)


! CAP's MAPL MetaComp
!---------------------

Expand All @@ -185,6 +187,11 @@ subroutine initialize_gc(gc, import_state, export_state, clock, rc)
call MAPL_Set(MAPLOBJ, name = cap%name, cf = cap%config, rc = status)
_VERIFY(status)

call MAPL_GetResource(MAPLOBJ, useShmem, label = 'USE_SHMEM:', default = 0, _RC)
if (useShmem /= 0) then
call MAPL_InitializeShmem (_RC)
end if

call ESMF_ConfigGetAttribute(cap%config,cap%run_fbf,label="RUN_FBF:",default=.false.)
call ESMF_ConfigGetAttribute(cap%config,cap%run_hist,label="RUN_HISTORY:",default=.true.)
call ESMF_ConfigGetAttribute(cap%config,cap%run_extdata,label="RUN_EXTDATA:",default=.true.)
Expand Down Expand Up @@ -484,6 +491,8 @@ subroutine finalize_gc(gc, import_state, export_state, clock, rc)
call ESMF_ConfigDestroy(cap%config, rc = status)
_VERIFY(status)

call MAPL_FinalizeSHMEM (_RC)

_RETURN(ESMF_SUCCESS)
end subroutine finalize_gc

Expand Down
26 changes: 26 additions & 0 deletions base/MAPL_Comms.F90
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ module MAPL_CommsMod
interface MAPL_BcastShared
module procedure MAPL_BcastShared_1DR4
module procedure MAPL_BcastShared_2DR4
module procedure MAPL_BcastShared_2DR8
end interface

interface MAPL_CommsScatterV
Expand Down Expand Up @@ -1117,6 +1118,31 @@ subroutine MAPL_BcastShared_2DR4(VM, Data, N, Root, RootOnly, rc)

end subroutine MAPL_BcastShared_2DR4


subroutine MAPL_BcastShared_2DR8(VM, Data, N, Root, RootOnly, rc)
type(ESMF_VM) :: VM
real(kind=REAL64), pointer, intent(INOUT) :: Data(:,:)
integer, intent(IN ) :: N
integer, optional, intent(IN ) :: Root
logical, intent(IN ) :: RootOnly
integer, optional, intent( OUT) :: rc
integer :: status

if(.not.MAPL_ShmInitialized) then
if (RootOnly) then
_RETURN(ESMF_SUCCESS)
end if
call MAPL_CommsBcast(vm, DATA=Data, N=N, ROOT=Root, _RC)
else
call MAPL_SyncSharedMemory(_RC)
call MAPL_BroadcastToNodes(Data, N=N, ROOT=Root, _RC)
call MAPL_SyncSharedMemory(_RC)
endif

_RETURN(ESMF_SUCCESS)

end subroutine MAPL_BcastShared_2DR8

! Rank 0
!---------------------------
#define RANK_ 0
Expand Down
Loading

0 comments on commit b042b6e

Please sign in to comment.