Skip to content

Commit

Permalink
Merge pull request #1535 from marshallward/sync_clock_flag
Browse files Browse the repository at this point in the history
cpu_clock_id: synchro_flag arg changed to logical
  • Loading branch information
Hallberg-NOAA authored Oct 26, 2021
2 parents 9d0a92b + 5ffad6d commit 9031683
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
25 changes: 13 additions & 12 deletions config_src/infra/FMS1/MOM_cpu_clock_infra.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,24 @@ subroutine cpu_clock_end(id)
end subroutine cpu_clock_end

!> Returns the integer handle for a named CPU clock.
integer function cpu_clock_id( name, synchro_flag, grain )
integer function cpu_clock_id(name, sync, grain)
character(len=*), intent(in) :: name !< The unique name of the CPU clock
integer, optional, intent(in) :: synchro_flag !< An integer flag that controls whether the PEs
!! are synchronized before the cpu clocks start counting.
!! Synchronization occurs before the start of a clock if this
!! is odd, while additional (expensive) statistics can set
!! for other values. If absent, the default is taken from the
!! settings for FMS.
logical, optional, intent(in) :: sync !< A flag that controls whether the
!! PEs are synchronized before the cpu clocks start counting.
!! Synchronization occurs before the start of a clock if this
!! is enabled, while additional (expensive) statistics can
!! set for other values.
!! If absent, the default is taken from the settings for FMS.
integer, optional, intent(in) :: grain !< The timing granularity for this clock, usually set to
!! the values of CLOCK_COMPONENT, CLOCK_ROUTINE, CLOCK_LOOP, etc.

if (present(synchro_flag)) then
cpu_clock_id = mpp_clock_id(name, flags=synchro_flag, grain=grain)
else
cpu_clock_id = mpp_clock_id(name, flags=clock_flag_default, grain=grain)
endif
integer :: clock_flags

clock_flags = clock_flag_default
if (present(sync)) &
clock_flags = ibset(clock_flags, 0)

cpu_clock_id = mpp_clock_id(name, flags=clock_flags, grain=grain)
end function cpu_clock_id

end module MOM_cpu_clock_infra
25 changes: 13 additions & 12 deletions config_src/infra/FMS2/MOM_cpu_clock_infra.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,24 @@ subroutine cpu_clock_end(id)
end subroutine cpu_clock_end

!> Returns the integer handle for a named CPU clock.
integer function cpu_clock_id( name, synchro_flag, grain )
integer function cpu_clock_id(name, sync, grain)
character(len=*), intent(in) :: name !< The unique name of the CPU clock
integer, optional, intent(in) :: synchro_flag !< An integer flag that controls whether the PEs
!! are synchronized before the cpu clocks start counting.
!! Synchronization occurs before the start of a clock if this
!! is odd, while additional (expensive) statistics can set
!! for other values. If absent, the default is taken from the
!! settings for FMS.
logical, optional, intent(in) :: sync !< A flag that controls whether the
!! PEs are synchronized before the cpu clocks start counting.
!! Synchronization occurs before the start of a clock if this
!! is enabled, while additional (expensive) statistics can
!! set for other values.
!! If absent, the default is taken from the settings for FMS.
integer, optional, intent(in) :: grain !< The timing granularity for this clock, usually set to
!! the values of CLOCK_COMPONENT, CLOCK_ROUTINE, CLOCK_LOOP, etc.

if (present(synchro_flag)) then
cpu_clock_id = mpp_clock_id(name, flags=synchro_flag, grain=grain)
else
cpu_clock_id = mpp_clock_id(name, flags=clock_flag_default, grain=grain)
endif
integer :: clock_flags

clock_flags = clock_flag_default
if (present(sync)) &
clock_flags = ibset(clock_flags, 0)

cpu_clock_id = mpp_clock_id(name, flags=clock_flags, grain=grain)
end function cpu_clock_id

end module MOM_cpu_clock_infra

0 comments on commit 9031683

Please sign in to comment.