From 8c46d4ffaba471807df5efc62a49c59f5745bd01 Mon Sep 17 00:00:00 2001 From: Rusty Benson <6594772+bensonr@users.noreply.github.com> Date: Thu, 12 May 2022 15:16:19 -0400 Subject: [PATCH] fixes io performance issues by making everyone a reader when io_layout=1,1 (#13) adds capability to use FMS feature to ignore data integrity checksums in restarts --- FV3GFS/FV3GFS_io.F90 | 19 +++++++------ atmos_drivers/coupled/atmos_model.F90 | 39 ++++++++++++++++----------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/FV3GFS/FV3GFS_io.F90 b/FV3GFS/FV3GFS_io.F90 index 259b100d..bec644ec 100644 --- a/FV3GFS/FV3GFS_io.F90 +++ b/FV3GFS/FV3GFS_io.F90 @@ -166,21 +166,22 @@ module FV3GFS_io_mod !-------------------- ! FV3GFS_restart_read !-------------------- - subroutine FV3GFS_restart_read (IPD_Data, IPD_Restart, Atm_block, Model, fv_domain) + subroutine FV3GFS_restart_read (IPD_Data, IPD_Restart, Atm_block, Model, fv_domain, enforce_rst_cksum) type(IPD_data_type), intent(inout) :: IPD_Data(:) type(IPD_restart_type), intent(inout) :: IPD_Restart type(block_control_type), intent(in) :: Atm_block type(IPD_control_type), intent(inout) :: Model type(domain2d), intent(in) :: fv_domain + logical, intent(in) :: enforce_rst_cksum !--- read in surface data from chgres - call sfc_prop_restart_read (IPD_Data%Sfcprop, Atm_block, Model, fv_domain) + call sfc_prop_restart_read (IPD_Data%Sfcprop, Atm_block, Model, fv_domain, enforce_rst_cksum) !--- read in if (Model%sfc_override) call sfc_prop_override (IPD_Data%Sfcprop, IPD_Data%Grid, Atm_block, Model, fv_domain) !--- read in physics restart data - call phys_restart_read (IPD_Restart, Atm_block, Model, fv_domain) + call phys_restart_read (IPD_Restart, Atm_block, Model, fv_domain, enforce_rst_cksum) end subroutine FV3GFS_restart_read @@ -834,12 +835,13 @@ end subroutine register_sfc_prop_restart_vars ! opens: oro_data.tile?.nc, sfc_data.tile?.nc ! !---------------------------------------------------------------------- - subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) + subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, enforce_rst_cksum) !--- interface variable definitions type(GFS_sfcprop_type), intent(inout) :: Sfcprop(:) type (block_control_type), intent(in) :: Atm_block type(IPD_control_type), intent(inout) :: Model type (domain2d), intent(in) :: fv_domain + logical, intent(in) :: enforce_rst_cksum !--- local variables integer :: i, j, k, ix, lsoil, num, nb integer :: isc, iec, jsc, jec, npz, nx, ny @@ -925,7 +927,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) !--- read the orography restart/data call mpp_error(NOTE,'reading topographic/orographic information from INPUT/oro_data.tile*.nc') - call read_restart(Oro_restart) + call read_restart(Oro_restart, ignore_checksum=enforce_rst_cksum) call close_file(Oro_restart) !--- copy data into GFS containers @@ -1003,7 +1005,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) !--- read the surface restart/data call mpp_error(NOTE,'reading surface properties data from INPUT/sfc_data.tile*.nc') - call read_restart(Sfc_restart) + call read_restart(Sfc_restart, ignore_checksum=enforce_rst_cksum) call close_file(Sfc_restart) !--- place the data into the block GFS containers @@ -2371,12 +2373,13 @@ end subroutine register_coarse_sfc_prop_restart_fields ! opens: phys_data.tile?.nc ! !---------------------------------------------------------------------- - subroutine phys_restart_read (IPD_Restart, Atm_block, Model, fv_domain) + subroutine phys_restart_read (IPD_Restart, Atm_block, Model, fv_domain, enforce_rst_cksum) !--- interface variable definitions type(IPD_restart_type), intent(in) :: IPD_Restart type(block_control_type), intent(in) :: Atm_block type(IPD_control_type), intent(in) :: Model type(domain2d), intent(in) :: fv_domain + logical, intent(in) :: enforce_rst_cksum !--- local variables integer :: i, j, k, nb, ix, num integer :: isc, iec, jsc, jec, npz, nx, ny @@ -2439,7 +2442,7 @@ subroutine phys_restart_read (IPD_Restart, Atm_block, Model, fv_domain) !--- read the surface restart/data call mpp_error(NOTE,'reading physics restart data from INPUT/phy_data.tile*.nc') - call read_restart(Phy_restart) + call read_restart(Phy_restart, ignore_checksum=enforce_rst_cksum) call close_file(Phy_restart) else call mpp_error(NOTE,'No physics restarts - cold starting physical parameterizations') diff --git a/atmos_drivers/coupled/atmos_model.F90 b/atmos_drivers/coupled/atmos_model.F90 index 783b76bd..80fcf650 100644 --- a/atmos_drivers/coupled/atmos_model.F90 +++ b/atmos_drivers/coupled/atmos_model.F90 @@ -89,7 +89,7 @@ module atmos_model_mod IPD_radiation_step, & IPD_physics_step1, & IPD_physics_step2 -#ifdef STOCHY +#ifdef STOCHY use stochastic_physics, only: init_stochastic_physics, & run_stochastic_physics use stochastic_physics_sfc, only: run_stochastic_physics_sfc @@ -118,7 +118,8 @@ module atmos_model_mod ! type atmos_data_type type (domain2d) :: domain ! domain decomposition - integer :: axes(4) ! axis indices (returned by diag_manager) for the atmospheric grid + type (domain2d) :: domain_for_read ! domain decomposition for reads + integer :: axes(4) ! axis indices (returned by diag_manager) for the atmospheric grid ! (they correspond to the x, y, pfull, phalf axes) real, pointer, dimension(:,:) :: lon_bnd => null() ! local longitude axis grid box corners in radians. real, pointer, dimension(:,:) :: lat_bnd => null() ! local latitude axis grid box corners in radians. @@ -130,7 +131,7 @@ module atmos_model_mod integer :: iau_offset ! iau running window length integer, pointer :: pelist(:) =>null() ! pelist where atmosphere is running. logical :: pe ! current pe. - type(grid_box_type) :: grid ! hold grid information needed for 2nd order conservative flux exchange + type(grid_box_type) :: grid ! hold grid information needed for 2nd order conservative flux exchange ! to calculate gradient on cubic sphere grid. integer :: layout(2) ! computer task laytout logical :: regional ! true if domain is regional @@ -159,9 +160,13 @@ module atmos_model_mod logical :: sync = .false. logical :: first_time_step = .true. logical :: fprint = .true. +logical :: enforce_rst_cksum = .true. ! enforce or override data integrity restart checksums real, dimension(4096) :: fdiag = 0. ! xic: TODO: this is hard coded, space can run out in some cases. Should make it allocatable. -logical :: fdiag_override = .false. ! lmh: if true overrides fdiag and fhzer: all quantities are zeroed out after every calcluation, output interval and accumulation/avg/max/min are controlled by diag_manager, fdiag controls output interval only -namelist /atmos_model_nml/ blocksize, chksum_debug, dycore_only, debug, sync, first_time_step, fdiag, fprint, fdiag_override +logical :: fdiag_override = .false. ! lmh: if true overrides fdiag and fhzer: all quantities are zeroed out + ! after every calcluation, output interval and accumulation/avg/max/min + ! are controlled by diag_manager, fdiag controls output interval only +namelist /atmos_model_nml/ blocksize, chksum_debug, dycore_only, debug, sync, first_time_step, fdiag, fprint, & + fdiag_override, enforce_rst_cksum type (time_type) :: diag_time, diag_time_fhzero logical :: fdiag_fix = .false. @@ -201,7 +206,7 @@ module atmos_model_mod ! atmospheric tendencies for dynamics, radiation, vertical diffusion of ! momentum, tracers, and heat/moisture. For heat/moisture only the ! downward sweep of the tridiagonal elimination is performed, hence -! the name "_down". +! the name "_down". ! !