LCOV - code coverage report
Current view: top level - dynamics/fv - FVperf_module.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 10 13 76.9 %
Date: 2025-03-14 01:30:37 Functions: 3 3 100.0 %

          Line data    Source code
       1             : !===============================================================================
       2             : ! CVS: $Id$
       3             : ! CVS: $Source$
       4             : ! CVS: $Name$
       5             : !===============================================================================
       6             : 
       7             : !-----------------------------------------------------------------------
       8             : !              ESMA - Earth System Modeling Applications
       9             : !-----------------------------------------------------------------------
      10             : !BOP
      11             : !
      12             : ! !MODULE: FVperf_module --- Simple interfaces for performance profiling
      13             : !
      14             : ! !INTERFACE:
      15             : 
      16             : MODULE FVperf_module
      17             : 
      18             : ! !USES:
      19             :    use dynamics_vars, only : T_FVDYCORE_GRID
      20             : #if defined(GEOS_MODE)
      21             :    use GEOS_Mod            ! GEOS base class
      22             : #elif defined(CAM_MODE)
      23             :    use perf_mod
      24             : #else
      25             :    use perf_mod
      26             : #endif
      27             : #if defined( SPMD )
      28             :    use mod_comm, only: mp_barrier
      29             : #endif
      30             : 
      31             : CONTAINS
      32             : 
      33             : ! !DESCRIPTION: A hack to toggle between GEOS5 and CAM profiling
      34             : !
      35             : !  The basic problem solved here is to access GENSTATE in GEOS\_MODE
      36             : !  without being overly intrusive (e.g. putting GEOS\_MODE in every
      37             : !  file in which GEOS_GenericStateClockOn is used.  If GEOS\_MODE
      38             : !  is defined, the GENSTATE must be initialized outside this file,
      39             : !  the various timing markers registered with GenericStateClockAdd,
      40             : !  and the genstate in this module manual set.  If CAM\_MODE is 
      41             : !  defined, the user may use FVstartclock/FVstopclock exactly like
      42             : !  the CAM utilities t\_startf and t\_stopf.
      43             : !
      44             : !  This module will be removed as soon as there is consensus on a
      45             : !  unified profiling utility.
      46             : !-----------------------------------------------------------------------
      47             : !BOP
      48             : ! !IROUTINE: FVstartclock --- start the clock
      49             : !
      50             : ! !INTERFACE:
      51    21314304 :       subroutine FVstartclock(grid,marker)
      52             : ! !USES:
      53             :       implicit none
      54             : ! !INPUT PARAMETERS:
      55             : #if defined(GEOS_MODE)
      56             :       type (T_FVDYCORE_GRID), intent(inout) :: grid
      57             : #else
      58             :       type (T_FVDYCORE_GRID), intent(in) :: grid
      59             : #endif
      60             :       character(LEN=*)      , intent(in) :: marker
      61             : !EOP
      62             : !-----------------------------------------------------------------------
      63             : !BOC
      64             : #if defined(GEOS_MODE)
      65             :       call GEOS_GenericStateClockOn(grid%FVgenstate,marker)
      66             : #elif defined(CAM_MODE)
      67             :       call t_startf(marker)    
      68             : #else
      69    21314304 :       call t_startf(marker)
      70             : #endif
      71             : !EOC
      72    21314304 :       end subroutine FVstartclock
      73             : !-----------------------------------------------------------------------
      74             : 
      75             : !-----------------------------------------------------------------------
      76             : !BOP
      77             : ! !IROUTINE: FVstopclock --- stop the clock
      78             : !
      79             : ! !INTERFACE:
      80    21314304 :       subroutine FVstopclock(grid,marker)
      81             : ! !USES:
      82             :       implicit none
      83             : ! !INPUT PARAMETERS:
      84             : #if defined(GEOS_MODE)
      85             :       type (T_FVDYCORE_GRID), intent(inout) :: grid
      86             : #else
      87             :       type (T_FVDYCORE_GRID), intent(in) :: grid
      88             : #endif
      89             :       character(LEN=*)      , intent(in) :: marker
      90             : !EOP
      91             : !-----------------------------------------------------------------------
      92             : !BOC
      93             : #if defined(GEOS_MODE)
      94             :       call GEOS_GenericStateClockOff(grid%FVgenstate,marker)
      95             : #elif defined(CAM_MODE)
      96             :       call t_stopf(marker)    
      97             : #else
      98    21314304 :       call t_stopf(marker)
      99             : #endif
     100             : !EOC
     101    21314304 :       end subroutine FVstopclock
     102             : !-----------------------------------------------------------------------
     103             : 
     104             : !-----------------------------------------------------------------------
     105             : !BOP
     106             : ! !IROUTINE: FVbarrierclock --- instrumented timing barrier
     107             : !
     108             : ! !INTERFACE:
     109      806400 :       subroutine FVbarrierclock(grid,marker,comm)
     110             : ! !USES:
     111             :       implicit none
     112             : ! !INPUT PARAMETERS:
     113             : #if defined(GEOS_MODE)
     114             :       type (T_FVDYCORE_GRID), intent(inout) :: grid
     115             : #else
     116             :       type (T_FVDYCORE_GRID), intent(in) :: grid
     117             : #endif
     118             :       character(LEN=*)      , intent(in) :: marker
     119             :       integer               , intent(in) :: comm
     120             : !EOP
     121             : !-----------------------------------------------------------------------
     122             : !BOC
     123             : #if defined(GEOS_MODE)
     124             : #if ( defined SPMD ) && ( defined TIMING_BARRIERS )
     125             :       call GEOS_GenericStateClockOn(grid%FVgenstate,marker)
     126             :       call mp_barrier(comm)
     127             :       call GEOS_GenericStateClockOff(grid%FVgenstate,marker)
     128             : #endif
     129             : #elif defined(CAM_MODE)
     130             : #if ( defined SPMD )
     131             :       if (t_profile_onf()) then
     132             :          if (t_barrier_onf()) then
     133             :             call t_startf(marker)    
     134             :             call mp_barrier(comm)
     135             :             call t_stopf(marker)    
     136             :          endif
     137             :       endif
     138             : #endif
     139             : #else
     140             : #if ( defined SPMD )
     141      806400 :       if (t_profile_onf()) then
     142      806400 :          if (t_barrier_onf()) then
     143           0 :             call t_startf(marker)    
     144           0 :             call mp_barrier(comm)
     145           0 :             call t_stopf(marker)    
     146             :          endif
     147             :       endif
     148             : #endif
     149             : #endif
     150             : !EOC
     151      806400 :       end subroutine FVbarrierclock
     152             : !-----------------------------------------------------------------------
     153             : 
     154             : END MODULE FVperf_module
     155             : 
     156             : 

Generated by: LCOV version 1.14