Skip to content

Commit

Permalink
Turn off default write/read of weights
Browse files Browse the repository at this point in the history
  • Loading branch information
mathomp4 committed Aug 22, 2024
1 parent 493149f commit 6786b54
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 28 deletions.
8 changes: 4 additions & 4 deletions base/MAPL_EsmfRegridder.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ subroutine create_route_handle(this, kind, rc)
spec = this%get_spec()

if (route_handles%count(spec) == 0) then ! new route_handle
file_weights = .true. !IAND(spec%hints,REGRID_HINT_FILE_WEIGHTS) /= 0
file_weights = IAND(spec%hints,REGRID_HINT_FILE_WEIGHTS) /= 0
compute_transpose = IAND(spec%hints,REGRID_HINT_COMPUTE_TRANSPOSE) /= 0

if (file_weights) then
Expand All @@ -1469,7 +1469,7 @@ subroutine create_route_handle(this, kind, rc)
rh_file_exists = .false.
end if
if (rh_file_exists) then
if (mapl_am_I_root()) write(*,*)__FILE__," reading "//trim(rh_file)
if (mapl_am_I_root()) write(*,*) "reading weight file "//trim(rh_file)
route_handle = ESMF_RouteHandleCreate(rh_file,_RC)
call route_handles%insert(spec, route_handle)
if (compute_transpose) then
Expand Down Expand Up @@ -1586,10 +1586,10 @@ subroutine create_route_handle(this, kind, rc)
call ESMF_FieldDestroy(dst_field, rc=status)
_VERIFY(status)
if (file_weights) then
if (mapl_am_I_root()) write(*,*)__FILE__," writing "//trim(rh_file)
if (mapl_am_I_root()) write(*,*) " writing weight file "//trim(rh_file)
call ESMF_RouteHandleWrite(route_handle,rh_file,_RC)
if (compute_transpose) then
if (mapl_am_I_root()) write(*,*)__FILE__," writing "//trim(rh_trans_file)
if (mapl_am_I_root()) write(*,*) " writing transpose weight file "//trim(rh_trans_file)
call ESMF_RouteHandleWrite(transpose_route_handle,rh_trans_file,_RC)
end if
end if
Expand Down
36 changes: 12 additions & 24 deletions gridcomps/ExtData2G/ExtDataGridCompNG.F90
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ MODULE MAPL_ExtDataGridComp2G
use MAPL_ExtDataLogger
use MAPL_ExtDataConstants
use gFTL_StringIntegerMap
use MAPL_MemUtilsMod

IMPLICIT NONE
PRIVATE
Expand Down Expand Up @@ -109,7 +108,7 @@ MODULE MAPL_ExtDataGridComp2G
!! are not actually required
type(ESMF_Config) :: CF
logical :: active = .true.
logical :: file_weights = .true.
logical :: file_weights = .false.
end type MAPL_ExtData_State

! Hook for the ESMF
Expand Down Expand Up @@ -258,7 +257,7 @@ SUBROUTINE Initialize_ ( GC, IMPORT, EXPORT, CLOCK, rc )
integer :: idx
type(MAPL_MetaComp),pointer :: MAPLSTATE

type(ExtDataOldTypesCreator),target :: config_yaml
type(ExtDataOldTypesCreator), target :: config_yaml
character(len=ESMF_MAXSTR) :: new_rc_file
logical :: found_in_config
integer :: num_primary,num_derived,num_rules
Expand Down Expand Up @@ -518,14 +517,13 @@ SUBROUTINE Run_ ( GC, IMPORT, EXPORT, CLOCK, rc )
integer :: idx,nitems
type(ESMF_Config) :: cf_master
type(ESMF_Time) :: adjusted_time
type(ESMF_VM) :: vm

_UNUSED_DUMMY(IMPORT)
_UNUSED_DUMMY(EXPORT)

! Get my name and set-up traceback handle
! ---------------------------------------
call ESMF_GridCompGet( GC, name=comp_name, config=CF_master, vm=vm, _RC )
call ESMF_GridCompGet( GC, name=comp_name, config=CF_master, _RC )

! Extract relevant runtime information
! ------------------------------------
Expand Down Expand Up @@ -603,15 +601,12 @@ SUBROUTINE Run_ ( GC, IMPORT, EXPORT, CLOCK, rc )

bundle_iter = IOBundles%begin()
do while (bundle_iter /= IoBundles%end())

io_bundle => bundle_iter%get()
bracket_side = io_bundle%bracket_side
entry_num = io_bundle%entry_index
file_Processed = io_bundle%file_name
item => self%primary%item(entry_num)

call MAPL_MemUtilsWrite(vm, 'MAPL_ExtData:ESMF_FieldBundleCreate '//trim(io_bundle%file_name), rc = status)

io_bundle%pbundle = ESMF_FieldBundleCreate(rc=status)
_VERIFY(STATUS)

Expand All @@ -622,12 +617,12 @@ SUBROUTINE Run_ ( GC, IMPORT, EXPORT, CLOCK, rc )

call MAPL_TimerOn(MAPLSTATE,"--PRead")
call MAPL_TimerOn(MAPLSTATE,"---CreateCFIO")
call MAPL_ExtDataCreateCFIO(IOBundles, vm=vm, rc=status)
call MAPL_ExtDataCreateCFIO(IOBundles, rc=status)
_VERIFY(status)
call MAPL_TimerOff(MAPLSTATE,"---CreateCFIO")

call MAPL_TimerOn(MAPLSTATE,"---prefetch")
call MAPL_ExtDataPrefetch(IOBundles, file_weights=self%file_weights, vm=vm, rc=status)
call MAPL_ExtDataPrefetch(IOBundles, file_weights=self%file_weights, rc=status)
_VERIFY(status)
call MAPL_TimerOff(MAPLSTATE,"---prefetch")
_VERIFY(STATUS)
Expand All @@ -640,7 +635,7 @@ SUBROUTINE Run_ ( GC, IMPORT, EXPORT, CLOCK, rc )
_VERIFY(STATUS)

call MAPL_TimerOn(MAPLSTATE,"---read-prefetch")
call MAPL_ExtDataReadPrefetch(IOBundles, vm=vm, rc=status)
call MAPL_ExtDataReadPrefetch(IOBundles,rc=status)
_VERIFY(status)
call MAPL_TimerOff(MAPLSTATE,"---read-prefetch")
call MAPL_TimerOff(MAPLSTATE,"--PRead")
Expand All @@ -655,7 +650,7 @@ SUBROUTINE Run_ ( GC, IMPORT, EXPORT, CLOCK, rc )
_VERIFY(status)
call bundle_iter%next()
enddo
call MAPL_ExtDataDestroyCFIO(IOBundles, vm=vm, rc=status)
call MAPL_ExtDataDestroyCFIO(IOBundles,rc=status)
_VERIFY(status)

call MAPL_TimerOff(MAPLSTATE,"-Read_Loop")
Expand Down Expand Up @@ -1344,9 +1339,8 @@ subroutine MAPL_ExtDataPopulateBundle(item,filec,pbundle,rc)

end subroutine MAPL_ExtDataPopulateBundle

subroutine MAPL_ExtDataCreateCFIO(IOBundles, vm, rc)
subroutine MAPL_ExtDataCreateCFIO(IOBundles, rc)
type(IOBundleNGVector), target, intent(inout) :: IOBundles
type(ESMF_VM), optional, intent(in) :: vm
integer, optional, intent(out ) :: rc

type (IOBundleNGVectorIterator) :: bundle_iter
Expand All @@ -1356,7 +1350,6 @@ subroutine MAPL_ExtDataCreateCFIO(IOBundles, vm, rc)
bundle_iter = IOBundles%begin()
do while (bundle_iter /= IOBundles%end())
io_bundle => bundle_iter%get()
If (present(vm)) call MAPL_MemUtilsWrite(vm, 'MAPL_ExtDataCreateCFIO '//trim(io_bundle%file_name), rc = status)
call io_bundle%make_io(_RC)
call bundle_iter%next()
enddo
Expand All @@ -1365,9 +1358,8 @@ subroutine MAPL_ExtDataCreateCFIO(IOBundles, vm, rc)

end subroutine MAPL_ExtDataCreateCFIO

subroutine MAPL_ExtDataDestroyCFIO(IOBundles, vm, rc)
subroutine MAPL_ExtDataDestroyCFIO(IOBundles,rc)
type(IOBundleNGVector), target, intent(inout) :: IOBundles
type(ESMF_VM), optional, intent(in) :: vm
integer, optional, intent(out ) :: rc

type(IOBundleNGVectorIterator) :: bundle_iter
Expand All @@ -1377,7 +1369,6 @@ subroutine MAPL_ExtDataDestroyCFIO(IOBundles, vm, rc)
bundle_iter = IOBundles%begin()
do while (bundle_iter /= IOBundles%end())
io_bundle => bundle_iter%get()
If (present(vm)) call MAPL_MemUtilsWrite(vm, 'MAPL_ExtDataDestroyCFIO '//trim(io_bundle%file_name), rc = status)
call io_bundle%clean(_RC)
call bundle_iter%next
enddo
Expand All @@ -1387,10 +1378,9 @@ subroutine MAPL_ExtDataDestroyCFIO(IOBundles, vm, rc)

end subroutine MAPL_ExtDataDestroyCFIO

subroutine MAPL_ExtDataPrefetch(IOBundles,file_weights,vm,rc)
subroutine MAPL_ExtDataPrefetch(IOBundles,file_weights,rc)
type(IOBundleNGVector), target, intent(inout) :: IOBundles
logical, intent(in) :: file_weights
type(ESMF_VM), optional, intent(in) :: vm
integer, optional, intent(out ) :: rc

integer :: n,nfiles,regrid_hints
Expand All @@ -1404,7 +1394,6 @@ subroutine MAPL_ExtDataPrefetch(IOBundles,file_weights,vm,rc)

do n = 1, nfiles
io_bundle => IOBundles%at(n)
If (present(vm)) call MAPL_MemUtilsWrite(vm, 'MAPL_ExtDataPrefetch '//trim(io_bundle%file_name), rc = status)
if (io_bundle%on_tiles) then
call io_bundle%tile_io%request_data_from_file(io_bundle%file_name,io_bundle%time_index,_RC)
else
Expand All @@ -1417,19 +1406,18 @@ subroutine MAPL_ExtDataPrefetch(IOBundles,file_weights,vm,rc)

end subroutine MAPL_ExtDataPrefetch

subroutine MAPL_ExtDataReadPrefetch(IOBundles, vm, rc)
subroutine MAPL_ExtDataReadPrefetch(IOBundles,rc)
type(IOBundleNGVector), target, intent(inout) :: IOBundles
type(ESMF_VM), optional, intent(in) :: vm
integer, optional, intent(out ) :: rc

integer :: nfiles, n
type (ExtDataNG_IOBundle), pointer :: io_bundle
integer :: status


nfiles = IOBundles%size()
do n=1, nfiles
io_bundle => IOBundles%at(n)
If (present(vm)) call MAPL_MemUtilsWrite(vm, 'MAPL_ExtDataReadPrefetch '//trim(io_bundle%file_name), rc = status)
if (io_bundle%on_tiles) then
call io_bundle%tile_io%process_data_from_file(_RC)
else
Expand Down

0 comments on commit 6786b54

Please sign in to comment.