Skip to content
Open
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
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
| mo-marqh | Mark Hedley | Met Office | 2025-12-11 |
| MatthewHambley | Matthew Hambley | Met Office | 2025-12-15 |
| yaswant | Yaswant Pradhan | Met Office | 2025-12-16 |
| jedbakerMO | Jed Baker | Met Office | 2025-12-29 |

Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ module io_demo_constants_mod
use fs_continuity_mod, only: W2
use function_space_collection_mod, only: function_space_collection
use function_space_mod, only: function_space_type
use io_config_mod, only: subroutine_timers
use log_mod, only: log_event, LOG_LEVEL_TRACE, &
LOG_LEVEL_ERROR
use mesh_mod, only: mesh_type
use timer_mod, only: timer
use timing_mod, only: start_timing, stop_timing, &
tik, LPROF

! Kernels
use sci_calc_dA_at_w2_kernel_mod, only: calc_dA_at_w2_kernel_type
Expand Down Expand Up @@ -61,8 +61,9 @@ contains
type(mesh_type), pointer, intent(in) :: mesh
type(field_type), target, intent(in) :: chi(:)
type(field_type), target, intent(in) :: panel_id
integer(tik) :: id

if ( subroutine_timers ) call timer('io_demo_constants_alg')
if ( LPROF ) call start_timing( id, 'io_demo_constants_alg' )
call log_event( "io_demo: creating runtime constants", LOG_LEVEL_TRACE )

!============================= dx_at_w2 setup =============================!
Expand All @@ -72,7 +73,7 @@ contains
call log_event( "io_demo: runtime constants created", LOG_LEVEL_TRACE )


if ( subroutine_timers ) call timer('io_demo_constants_alg')
if ( LPROF ) call stop_timing( id, 'io_demo_constants_alg' )
call log_event( "io_demo: created FEM constants", LOG_LEVEL_TRACE )

end subroutine create_io_demo_constants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module multifile_io_mod
use inventory_by_mesh_mod, only: inventory_by_mesh_type
use io_context_collection_mod, only: io_context_collection_type
use io_context_mod, only: io_context_type, callback_clock_arg
use io_config_mod, only: use_xios_io, subroutine_timers
use io_config_mod, only: use_xios_io
use log_mod, only: log_event, log_level_error, &
log_level_trace, log_level_info, &
log_scratch_space
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ module simple_diffusion_constants_mod
use fs_continuity_mod, only: W2
use function_space_collection_mod, only: function_space_collection
use function_space_mod, only: function_space_type
use io_config_mod, only: subroutine_timers
use log_mod, only: log_event, LOG_LEVEL_TRACE, &
LOG_LEVEL_ERROR
use mesh_mod, only: mesh_type
use timer_mod, only: timer
use timing_mod, only: start_timing, stop_timing, &
tik, LPROF

! Kernels
use sci_calc_da_at_w2_kernel_mod, only: calc_dA_at_w2_kernel_type
Expand Down Expand Up @@ -61,8 +61,9 @@ contains
type(mesh_type), pointer, intent(in) :: mesh
type(field_type), target, intent(in) :: chi(:)
type(field_type), target, intent(in) :: panel_id
integer(tik) :: id

if ( subroutine_timers ) call timer('simple_diffusion_constants_alg')
if ( LPROF ) call start_timing( id, 'simple_diffusion_constants_alg' )
call log_event( "simple_diffusion: creating runtime constants", LOG_LEVEL_TRACE )

!============================= dx_at_w2 setup =============================!
Expand All @@ -72,7 +73,7 @@ contains
call log_event( "simple_diffusion: runtime constants created", LOG_LEVEL_TRACE )


if ( subroutine_timers ) call timer('simple_diffusion_constants_alg')
if ( LPROF ) call stop_timing( id, 'simple_diffusion_constants_alg' )
call log_event( "simple_diffusion: created FEM constants", LOG_LEVEL_TRACE )

end subroutine create_simple_diffusion_constants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ module skeleton_constants_mod
use function_space_collection_mod, only: function_space_collection
use function_space_mod, only: function_space_type
use inventory_by_mesh_mod, only: inventory_by_mesh_type
use io_config_mod, only: subroutine_timers
use log_mod, only: log_event, LOG_LEVEL_INFO, &
LOG_LEVEL_ERROR
use mesh_mod, only: mesh_type
use operator_mod, only: operator_type
use quadrature_xyoz_mod, only: quadrature_xyoz_type
use quadrature_rule_gaussian_mod, only: quadrature_rule_gaussian_type
use timer_mod, only: timer
use timing_mod, only: start_timing, stop_timing, &
tik, LPROF

! Configuration
use finite_element_config_mod, only: element_order_h, &
Expand Down Expand Up @@ -109,8 +109,9 @@ contains
type(function_space_type), pointer :: w2v_fs => null()
type(function_space_type), pointer :: w3_fs => null()
type(function_space_type), pointer :: wtheta_fs => null()
integer(tik) :: id

if ( subroutine_timers ) call timer('skeleton_constants_alg')
if ( LPROF ) call start_timing( id, 'skeleton_constants_alg' )
call log_event( "Skeleton: creating runtime constants", LOG_LEVEL_INFO )

!======================== Create quadrature object ========================!
Expand Down Expand Up @@ -178,7 +179,7 @@ contains
mm_w0, mm_w1, mm_w2, mm_w2b, mm_w3, mm_wtheta, grad, curl, div, &
broken_div )

if ( subroutine_timers ) call timer('skeleton_constants_alg')
if ( LPROF ) call stop_timing( id, 'skeleton_constants_alg' )
call log_event( "Skeleton: created FEM constants", LOG_LEVEL_INFO )

end subroutine create_skeleton_constants
Expand Down
5 changes: 0 additions & 5 deletions components/driver/source/driver_io_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,8 @@ subroutine init_xios_io_context( context_name, &
integer(i_def) :: num_meshes, i, j

type(namelist_type), pointer :: io_nml
logical :: subroutine_timers

io_nml => modeldb%configuration%get_namelist('io')
call io_nml%get_value( 'subroutine_timers', subroutine_timers )

subroutine_timers = .false.

mesh => null()
chi => null()
Expand All @@ -230,7 +226,6 @@ subroutine init_xios_io_context( context_name, &
file_list => io_context%get_filelist()
call populate_filelist(file_list, modeldb)
end if
call io_context%set_timer_flag(subroutine_timers)

! ===============================
! Check that a mesh exists
Expand Down
66 changes: 0 additions & 66 deletions components/driver/source/driver_timer_mod.f90

This file was deleted.

14 changes: 7 additions & 7 deletions components/lfric-xios/source/lfric_xios_action_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
module lfric_xios_action_mod

use constants_mod, only : str_def
use timing_mod, only : start_timing, stop_timing, tik, LPROF

implicit none

Expand Down Expand Up @@ -36,7 +37,6 @@ subroutine advance(context, model_clock)
!> is old enough to not have xios_get_current_context forwarded through the
!> xios module.
use icontext, only : xios_get_current_context
use timer_mod, only : timer
use xios, only : xios_context, &
xios_set_current_context, &
xios_update_calendar
Expand All @@ -50,6 +50,7 @@ subroutine advance(context, model_clock)
type(lfric_xios_file_type), pointer :: file => null()
type(xios_context) :: xios_context_handle
type(linked_list_type), pointer :: filelist
integer(tik) :: id

! Get the handle of the current context (Not necessarily the one passed to this routine).
! This is used to reset the context on return.
Expand All @@ -76,9 +77,9 @@ subroutine advance(context, model_clock)
end if

! Update XIOS calendar
if (context%get_timer_flag()) call timer('xios_update_calendar')
if ( LPROF ) call start_timing( id, 'xios_update_calendar' )
call xios_update_calendar( model_clock%get_step() - model_clock%get_first_step() + 1 )
if (context%get_timer_flag()) call timer('xios_update_calendar')
if ( LPROF ) call stop_timing( id, 'xios_update_calendar' )

! Read all files that need to be read from
filelist => context%get_filelist()
Expand Down Expand Up @@ -126,7 +127,6 @@ subroutine advance_read_only(context, model_clock)
!> is old enough to not have xios_get_current_context forwarded through the
!> xios module.
use icontext, only : xios_get_current_context
use timer_mod, only : timer
use xios, only : xios_context, &
xios_date, &
xios_set_current_context, &
Expand All @@ -143,6 +143,7 @@ subroutine advance_read_only(context, model_clock)
type(lfric_xios_file_type), pointer :: file => null()
type(xios_context) :: xios_context_handle
type(linked_list_type), pointer :: filelist
integer(tik) :: id

! Get the handle of the current context (Not necessarily the one passed to this routine).
! This is used to reset the context on return.
Expand All @@ -153,10 +154,9 @@ subroutine advance_read_only(context, model_clock)
call context%set_current()
call context%tick_context_clock()
! Update XIOS calendar
if (context%get_timer_flag()) call timer('xios_update_calendar')

if ( LPROF ) call start_timing( id, 'xios_update_calendar' )
call xios_update_calendar( context%get_context_clock_step() )
if (context%get_timer_flag()) call timer('xios_update_calendar')
if ( LPROF ) call stop_timing( id, 'xios_update_calendar' )

! Read all files that need to be read from
filelist => context%get_filelist()
Expand Down
54 changes: 17 additions & 37 deletions components/lfric-xios/source/lfric_xios_context_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ module lfric_xios_context_mod
use lfric_xios_file_mod, only : lfric_xios_file_type
use linked_list_mod, only : linked_list_type, linked_list_item_type
use model_clock_mod, only : model_clock_type
use timer_mod, only : timer
use timing_mod, only : start_timing, stop_timing, &
tik, LPROF
use xios, only : xios_context, &
xios_context_initialize, &
xios_close_context_definition, &
Expand Down Expand Up @@ -56,8 +57,6 @@ module lfric_xios_context_mod
procedure, public :: initialise_xios_context
procedure, public :: get_filelist
procedure, public :: set_current
procedure, public :: set_timer_flag
procedure, public :: get_timer_flag
procedure, public :: tick_context_clock
procedure, public :: get_context_clock_step
procedure, public :: finalise_xios_context
Expand Down Expand Up @@ -115,10 +114,12 @@ subroutine initialise_xios_context( this, communicator, &
type(linked_list_item_type), pointer :: loop => null()
type(lfric_xios_file_type), pointer :: file => null()
logical :: zero_start
integer(tik) :: idlx, idxc

write(log_scratch_space, "(A)") &
"Initialising XIOS context: " // this%get_context_name()
call log_event(log_scratch_space, log_level_debug)
if ( LPROF ) call start_timing(idlx, 'lfric_xios_init_context')

if (present(start_at_zero)) then
zero_start = start_at_zero
Expand All @@ -138,9 +139,14 @@ subroutine initialise_xios_context( this, communicator, &

if (associated(before_close)) call before_close(model_clock)

! Close the context definition - no more I/O operations can be defined
! after this point
! Close the context definition - no more I/O configuration operations
! can be defined after this point
if ( LPROF ) call start_timing(idxc, 'xios_close_context_definition')
call log_event('XIOS context definition closing', log_level_debug)
call xios_close_context_definition()
if ( LPROF ) call stop_timing(idxc, 'xios_close_context_definition')
call log_event('XIOS context definition closed', log_level_debug)

this%xios_context_initialised = .true.

! Read all files that need to be read from
Expand All @@ -155,6 +161,7 @@ subroutine initialise_xios_context( this, communicator, &
loop => loop%next
end do
end if
if ( LPROF ) call stop_timing(idlx, 'lfric_xios_init_context')

end subroutine initialise_xios_context

Expand All @@ -176,7 +183,9 @@ subroutine finalise_xios_context( this )

type(linked_list_item_type), pointer :: loop => null()
type(lfric_xios_file_type), pointer :: file => null()
integer(tik) :: idlx, idxc

if ( LPROF ) call start_timing(idlx, 'lfric_xios_finalise_context')
if (this%xios_context_initialised) then
! Perform final write
if (this%filelist%get_length() > 0) then
Expand All @@ -195,7 +204,9 @@ subroutine finalise_xios_context( this )
! will be closed.
write(log_scratch_space, "(A)") "Finalising XIOS context: " // this%get_context_name()
call log_event(log_scratch_space, log_level_debug)
if ( LPROF ) call start_timing(idxc, 'xios_context_finalize')
call xios_context_finalize()
if ( LPROF ) call stop_timing(idxc, 'xios_context_finalize')

! We have closed the context on our end, but we need to make sure that XIOS
! has closed the files for all servers before we process them.
Expand All @@ -217,6 +228,7 @@ subroutine finalise_xios_context( this )
end if
nullify(loop)
nullify(file)
if ( LPROF ) call stop_timing(idlx, 'lfric_xios_finalise_context')

end subroutine finalise_xios_context

Expand Down Expand Up @@ -247,38 +259,6 @@ subroutine set_current( this )

end subroutine set_current

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Tells I/O context whether to use subroutine timers
!>
!> @param[in] timer_flag
!>
subroutine set_timer_flag( this, timer_flag )

implicit none

class(lfric_xios_context_type), target, intent(inout) :: this
logical, intent(in) :: timer_flag

this%uses_timer = timer_flag

end subroutine set_timer_flag

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Returns whether the IO context uses timers
!>
!> @return timer_flag
!>
function get_timer_flag(this) result(timer_flag)

implicit none

class(lfric_xios_context_type), target, intent(in) :: this
logical :: timer_flag

timer_flag = this%uses_timer

end function get_timer_flag

subroutine tick_context_clock(this)
implicit none
class(lfric_xios_context_type), intent(inout) :: this
Expand Down
Loading