MOM6
MOM_cpu_clock.F90
1 !> Wraps the MPP cpu clock functions
3 
4 ! This file is part of MOM6. See LICENSE.md for the license.
5 
6 use fms_mod, only : clock_flag_default
7 use mpp_mod, only : cpu_clock_begin => mpp_clock_begin
8 use mpp_mod, only : cpu_clock_end => mpp_clock_end, mpp_clock_id
9 use mpp_mod, only : clock_component, clock_subcomponent, clock_module_driver
10 use mpp_mod, only : clock_module, clock_routine, clock_loop, clock_infra
11 use mpp_mod, only : clock_sync => mpp_clock_sync
12 
13 implicit none ; private
14 
15 public :: cpu_clock_id, cpu_clock_begin, cpu_clock_end
16 public :: clock_component, clock_subcomponent, clock_module_driver, clock_module
17 public :: clock_routine, clock_loop, clock_infra, clock_sync
18 
19 contains
20 
21 !> cpu_clock_id returns the integer handle for a named CPU clock.
22 function cpu_clock_id( name, synchro_flag, grain )
23  character(len=*), intent(in) :: name !< The unique name of the CPU clock
24  integer, intent(in), optional :: synchro_flag !< An integer flag that controls whether the PEs
25  !! are synchronized before the cpu clocks start counting.
26  !! Synchronization occurs before the start of a clock if this
27  !! is odd, while additional (expensive) statistics can set
28  !! for other values. If absent, the default is taken from the
29  !! settings for FMS.
30  integer, intent(in), optional :: grain !< The timing granularity for this clock, usually set to
31  !! the values of CLOCK_COMPONENT, CLOCK_ROUTINE, CLOCK_LOOP, etc.
32  integer :: cpu_clock_id !< The integer CPU clock handle.
33 
34  if (present(synchro_flag)) then
35  cpu_clock_id = mpp_clock_id(name, flags=synchro_flag, grain=grain)
36  else
37  cpu_clock_id = mpp_clock_id(name, flags=clock_flag_default, grain=grain)
38  endif
39 
40 end function cpu_clock_id
41 
42 end module mom_cpu_clock
mom_cpu_clock
Wraps the MPP cpu clock functions.
Definition: MOM_cpu_clock.F90:2