SCALE-RM
Functions/Subroutines
scale_prof Module Reference

module profiler More...

Functions/Subroutines

subroutine, public prof_setup
 
subroutine, public prof_setprefx (prefxname)
 
subroutine, public prof_rapstart (rapname_base, level)
 Start raptime. More...
 
subroutine, public prof_rapend (rapname_base, level)
 Save raptime. More...
 
subroutine, public prof_rapreport
 Report raptime. More...
 

Detailed Description

module profiler

Description
Time counter & FLOP counter(PAPI) toolbox
Author
Team SCALE

Function/Subroutine Documentation

◆ prof_setup()

subroutine, public scale_prof::prof_setup ( )

Definition at line 79 of file scale_prof.F90.

References scale_stdio::io_fid_conf, scale_stdio::io_fid_log, scale_stdio::io_l, scale_stdio::io_lnml, and scale_process::prc_mpistop().

Referenced by mod_rm_driver::scalerm(), and mod_rm_prep::scalerm_prep().

79  use scale_process, only: &
81  implicit none
82 
83  namelist / param_prof / &
84  prof_rap_level, &
85  prof_mpi_barrier
86 
87  integer :: ierr
88 
89  if( io_l ) write(io_fid_log,*)
90  if( io_l ) write(io_fid_log,*) '++++++ Module[PROF] / Categ[COMMON] / Origin[SCALElib]'
91 
92  !--- read namelist
93  rewind(io_fid_conf)
94  read(io_fid_conf,nml=param_prof,iostat=ierr)
95  if( ierr < 0 ) then !--- missing
96  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
97  elseif( ierr > 0 ) then !--- fatal error
98  write(*,*) 'xxx Not appropriate names in namelist PARAM_PROF. Check!'
99  call prc_mpistop
100  endif
101  if( io_lnml ) write(io_fid_log,nml=param_prof)
102 
103  if( io_l ) write(io_fid_log,*) '*** Rap output level = ', prof_rap_level
104  if( io_l ) write(io_fid_log,*) '*** Add MPI_barrier in every rap? = ', prof_mpi_barrier
105 
106  prof_prefix = ''
107 
108  return
subroutine, public prc_mpistop
Abort MPI.
module PROCESS
integer, public io_fid_conf
Config file ID.
Definition: scale_stdio.F90:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prof_setprefx()

subroutine, public scale_prof::prof_setprefx ( character(len=*), intent(in)  prefxname)
Parameters
[in]prefxnameprefix

Definition at line 114 of file scale_prof.F90.

Referenced by mod_rm_driver::scalerm().

114  implicit none
115 
116  character(len=*), intent(in) :: prefxname
117 
118  !---------------------------------------------------------------------------
119 
120  if ( prefxname == '' ) then !--- no prefix
121  prof_prefix = ''
122  else
123  prof_prefix = trim(prefxname)//'_'
124  endif
125 
126  return
Here is the caller graph for this function:

◆ prof_rapstart()

subroutine, public scale_prof::prof_rapstart ( character(len=*), intent(in)  rapname_base,
integer, intent(in), optional  level 
)

Start raptime.

Parameters
[in]rapname_basename of item
[in]levellevel of item (default is 2)

Definition at line 132 of file scale_prof.F90.

References scale_process::prc_mpibarrier(), and scale_process::prc_mpitime().

Referenced by scale_atmos_phy_ae_kajino13::aerosol_zerochem(), mod_atmos_driver::atmos_driver(), mod_atmos_driver::atmos_driver_resume1(), mod_atmos_driver::atmos_driver_resume2(), mod_atmos_driver::atmos_driver_setup(), scale_atmos_dyn::atmos_dyn(), scale_atmos_dyn_common::atmos_dyn_divergence(), scale_atmos_dyn_common::atmos_dyn_numfilter_coef(), scale_atmos_dyn_common::atmos_dyn_numfilter_coef_q(), scale_atmos_dyn_tinteg_large_rk3::atmos_dyn_tinteg_large_rk3(), scale_atmos_dyn_tinteg_short_rk3::atmos_dyn_tinteg_short_rk3(), scale_atmos_dyn_tinteg_short_rk4::atmos_dyn_tinteg_short_rk4(), scale_atmos_dyn_tstep_large_fvm_heve::atmos_dyn_tstep_large_fvm_heve(), mod_atmos_phy_ae_driver::atmos_phy_ae_driver_resume(), mod_atmos_phy_ch_driver::atmos_phy_ch_driver_resume(), mod_atmos_phy_cp_driver::atmos_phy_cp_driver_resume(), scale_atmos_phy_cp_kf::atmos_phy_cp_kf(), mod_atmos_phy_mp_driver::atmos_phy_mp_driver_resume(), scale_atmos_phy_mp_kessler::atmos_phy_mp_kessler(), scale_atmos_phy_mp_common::atmos_phy_mp_negative_fixer(), scale_atmos_phy_mp_common::atmos_phy_mp_precipitation(), scale_atmos_phy_mp_common::atmos_phy_mp_saturation_adjustment(), scale_atmos_phy_mp_sn14::atmos_phy_mp_sn14(), scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10(), scale_atmos_phy_mp_tomita08::atmos_phy_mp_tomita08(), mod_atmos_phy_rd_driver::atmos_phy_rd_driver_resume(), scale_atmos_phy_rd_mstrnx::atmos_phy_rd_mstrnx(), mod_atmos_phy_sf_driver::atmos_phy_sf_driver_resume(), mod_atmos_phy_tb_driver::atmos_phy_tb_driver_resume(), mod_atmos_vars::atmos_vars_restart_check(), scale_atmos_dyn_common::calc_numdiff(), scale_debug::check(), scale_comm::comm_bcast_1d(), scale_comm::comm_bcast_2d(), scale_comm::comm_bcast_3d(), scale_comm::comm_bcast_4d(), scale_comm::comm_bcast_int_1d(), scale_comm::comm_bcast_int_2d(), scale_comm::comm_bcast_int_scr(), scale_comm::comm_bcast_logical_scr(), scale_comm::comm_bcast_scr(), scale_comm::comm_horizontal_max_2d(), scale_comm::comm_horizontal_mean(), scale_comm::comm_horizontal_min_2d(), scale_comm::comm_vars8_init(), scale_comm::comm_vars_init(), scale_fileio::fileio_close(), scale_fileio::fileio_create(), scale_fileio::fileio_def_var(), scale_fileio::fileio_enddef(), scale_fileio::fileio_read_1d(), scale_fileio::fileio_read_2d(), scale_fileio::fileio_read_3d(), scale_fileio::fileio_read_4d(), scale_fileio::fileio_write_1d(), scale_fileio::fileio_write_2d(), scale_fileio::fileio_write_3d(), scale_fileio::fileio_write_3d_t(), scale_fileio::fileio_write_4d(), scale_fileio::fileio_write_var_1d(), scale_fileio::fileio_write_var_2d(), scale_fileio::fileio_write_var_3d(), scale_fileio::fileio_write_var_3d_t(), scale_fileio::fileio_write_var_4d(), scale_history::hist_get_2d(), scale_history::hist_get_3d(), scale_history::hist_in_0d(), scale_history::hist_put_0d(), scale_history::hist_put_1d(), scale_history::hist_put_2d(), scale_history::hist_put_3d(), scale_history::hist_query(), scale_history::hist_reg(), scale_history::hist_setup(), scale_history::hist_write(), mod_land_driver::land_driver(), mod_land_driver::land_driver_resume(), mod_land_phy_driver::land_phy_driver_resume(), scale_monitor::monit_write(), scale_atmos_phy_mp_sn14::mp_negativefilter(), scale_atmos_phy_mp_suzuki10::mp_suzuki10(), scale_grid_nest::nest_comm_nestdown(), scale_grid_nest::nest_comm_recvwait_issue(), scale_grid_nest::nest_comm_test(), mod_ocean_driver::ocean_driver(), mod_ocean_driver::ocean_driver_resume(), mod_ocean_phy_driver::ocean_phy_driver_resume(), scale_atmos_phy_mp_suzuki10::r_collcoag(), mod_rm_driver::scalerm(), mod_rm_prep::scalerm_prep(), scale_rm_statistics::stat_detail(), scale_rm_statistics::stat_total_2d(), scale_rm_statistics::stat_total_3d(), mod_urban_driver::urban_driver(), mod_urban_driver::urban_driver_resume(), mod_urban_phy_driver::urban_phy_driver_resume(), scale_debug::valcheck_1d(), scale_debug::valcheck_2d(), scale_debug::valcheck_3d(), and scale_comm::wait_3d_mpi().

132  use scale_process, only: &
133  prc_mpibarrier, &
135  implicit none
136 
137  character(len=*), intent(in) :: rapname_base
138  integer, intent(in), optional :: level
139 
140  character(len=H_SHORT*2) :: rapname
141 
142  integer :: id
143  integer :: level_
144  !---------------------------------------------------------------------------
145 
146  if ( present(level) ) then
147  level_ = level
148  else
149  level_ = prof_default_rap_level
150  endif
151 
152  if( level_ > prof_rap_level ) return
153 
154  rapname = trim(prof_prefix)//trim(rapname_base)
155 
156  id = get_rapid( rapname, level_ )
157 
158  if(prof_mpi_barrier) call prc_mpibarrier
159 
160  prof_raptstr(id) = prc_mpitime()
161  prof_rapnstr(id) = prof_rapnstr(id) + 1
162 
163  !if( IO_L ) write(IO_FID_LOG,*) rapname, PROF_rapnstr(id)
164 
165 #ifdef _FAPP_
166  call fapp_start( trim(prof_grpname(get_grpid(rapname))), id, level_ )
167 #endif
168 #ifdef _FINEPA_
169  call start_collection( rapname )
170 #endif
171 
172  return
real(dp) function, public prc_mpitime()
Get MPI time.
module PROCESS
subroutine, public prc_mpibarrier
Barrier MPI.
Here is the call graph for this function:

◆ prof_rapend()

subroutine, public scale_prof::prof_rapend ( character(len=*), intent(in)  rapname_base,
integer, intent(in), optional  level 
)

Save raptime.

Parameters
[in]rapname_basename of item
[in]levellevel of item

Definition at line 178 of file scale_prof.F90.

References scale_process::prc_mpibarrier(), and scale_process::prc_mpitime().

Referenced by scale_atmos_phy_ae_kajino13::aerosol_zerochem(), mod_atmos_driver::atmos_driver(), mod_atmos_driver::atmos_driver_resume1(), mod_atmos_driver::atmos_driver_resume2(), mod_atmos_driver::atmos_driver_setup(), scale_atmos_dyn::atmos_dyn(), scale_atmos_dyn_common::atmos_dyn_divergence(), scale_atmos_dyn_common::atmos_dyn_numfilter_coef(), scale_atmos_dyn_common::atmos_dyn_numfilter_coef_q(), scale_atmos_dyn_tinteg_large_rk3::atmos_dyn_tinteg_large_rk3(), scale_atmos_dyn_tinteg_short_rk3::atmos_dyn_tinteg_short_rk3(), scale_atmos_dyn_tinteg_short_rk4::atmos_dyn_tinteg_short_rk4(), scale_atmos_dyn_tstep_large_fvm_heve::atmos_dyn_tstep_large_fvm_heve(), mod_atmos_phy_ae_driver::atmos_phy_ae_driver_resume(), mod_atmos_phy_ch_driver::atmos_phy_ch_driver_resume(), mod_atmos_phy_cp_driver::atmos_phy_cp_driver_resume(), scale_atmos_phy_cp_kf::atmos_phy_cp_kf(), mod_atmos_phy_mp_driver::atmos_phy_mp_driver_resume(), scale_atmos_phy_mp_kessler::atmos_phy_mp_kessler(), scale_atmos_phy_mp_common::atmos_phy_mp_negative_fixer(), scale_atmos_phy_mp_common::atmos_phy_mp_precipitation(), scale_atmos_phy_mp_common::atmos_phy_mp_saturation_adjustment(), scale_atmos_phy_mp_sn14::atmos_phy_mp_sn14(), scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10(), scale_atmos_phy_mp_tomita08::atmos_phy_mp_tomita08(), mod_atmos_phy_rd_driver::atmos_phy_rd_driver_resume(), scale_atmos_phy_rd_mstrnx::atmos_phy_rd_mstrnx(), mod_atmos_phy_sf_driver::atmos_phy_sf_driver_resume(), mod_atmos_phy_tb_driver::atmos_phy_tb_driver_resume(), mod_atmos_vars::atmos_vars_restart_check(), scale_atmos_dyn_common::calc_numdiff(), scale_debug::check(), scale_comm::comm_bcast_1d(), scale_comm::comm_bcast_2d(), scale_comm::comm_bcast_3d(), scale_comm::comm_bcast_4d(), scale_comm::comm_bcast_int_1d(), scale_comm::comm_bcast_int_2d(), scale_comm::comm_bcast_int_scr(), scale_comm::comm_bcast_logical_scr(), scale_comm::comm_bcast_scr(), scale_comm::comm_horizontal_max_2d(), scale_comm::comm_horizontal_mean(), scale_comm::comm_horizontal_min_2d(), scale_comm::comm_vars8_init(), scale_comm::comm_vars_init(), scale_fileio::fileio_close(), scale_fileio::fileio_create(), scale_fileio::fileio_def_var(), scale_fileio::fileio_enddef(), scale_fileio::fileio_read_1d(), scale_fileio::fileio_read_2d(), scale_fileio::fileio_read_3d(), scale_fileio::fileio_read_4d(), scale_fileio::fileio_write_1d(), scale_fileio::fileio_write_2d(), scale_fileio::fileio_write_3d(), scale_fileio::fileio_write_3d_t(), scale_fileio::fileio_write_4d(), scale_fileio::fileio_write_var_1d(), scale_fileio::fileio_write_var_2d(), scale_fileio::fileio_write_var_3d(), scale_fileio::fileio_write_var_3d_t(), scale_fileio::fileio_write_var_4d(), scale_history::hist_get_2d(), scale_history::hist_get_3d(), scale_history::hist_in_0d(), scale_history::hist_put_0d(), scale_history::hist_put_1d(), scale_history::hist_put_2d(), scale_history::hist_put_3d(), scale_history::hist_query(), scale_history::hist_reg(), scale_history::hist_setup(), scale_history::hist_write(), mod_land_driver::land_driver(), mod_land_driver::land_driver_resume(), mod_land_phy_driver::land_phy_driver_resume(), scale_monitor::monit_write(), scale_atmos_phy_mp_sn14::mp_negativefilter(), scale_atmos_phy_mp_suzuki10::mp_suzuki10(), scale_grid_nest::nest_comm_nestdown(), scale_grid_nest::nest_comm_recvwait_issue(), scale_grid_nest::nest_comm_test(), mod_ocean_driver::ocean_driver(), mod_ocean_driver::ocean_driver_resume(), mod_ocean_phy_driver::ocean_phy_driver_resume(), scale_atmos_phy_mp_suzuki10::r_collcoag(), mod_rm_driver::scalerm(), mod_rm_prep::scalerm_prep(), scale_rm_statistics::stat_detail(), scale_rm_statistics::stat_total_2d(), scale_rm_statistics::stat_total_3d(), mod_urban_driver::urban_driver(), mod_urban_driver::urban_driver_resume(), mod_urban_phy_driver::urban_phy_driver_resume(), scale_debug::valcheck_1d(), scale_debug::valcheck_2d(), scale_debug::valcheck_3d(), and scale_comm::wait_3d_mpi().

178  use scale_process, only: &
179  prc_mpibarrier, &
181  implicit none
182 
183  character(len=*), intent(in) :: rapname_base
184  integer, intent(in), optional :: level
185 
186  character(len=H_SHORT*2) :: rapname
187 
188  integer :: id
189  integer :: level_
190  !---------------------------------------------------------------------------
191 
192  if ( present(level) ) then
193  if( level > prof_rap_level ) return
194  endif
195 
196  rapname = trim(prof_prefix)//trim(rapname_base)
197 
198  id = get_rapid( rapname, level_ )
199 
200  if( level_ > prof_rap_level ) return
201 
202  if(prof_mpi_barrier) call prc_mpibarrier
203 
204  prof_rapttot(id) = prof_rapttot(id) + ( prc_mpitime()-prof_raptstr(id) )
205  prof_rapnend(id) = prof_rapnend(id) + 1
206 
207 #ifdef _FINEPA_
208  call stop_collection( rapname )
209 #endif
210 #ifdef _FAPP_
211  call fapp_stop( trim(prof_grpname(prof_grpid(id))), id, level_ )
212 #endif
213 
214  return
real(dp) function, public prc_mpitime()
Get MPI time.
module PROCESS
subroutine, public prc_mpibarrier
Barrier MPI.
Here is the call graph for this function:

◆ prof_rapreport()

subroutine, public scale_prof::prof_rapreport ( )

Report raptime.

Definition at line 220 of file scale_prof.F90.

References scale_stdio::io_fid_log, scale_stdio::io_l, scale_stdio::io_log_allnode, scale_stdio::io_log_suppress, scale_process::prc_ismaster, scale_process::prc_mpitimestat(), and scale_process::prc_nprocs.

Referenced by mod_rm_driver::scalerm(), and mod_rm_prep::scalerm_prep().

220  use scale_process, only: &
221  prc_mpitimestat, &
223  implicit none
224 
225  real(DP) :: avgvar(prof_rapnlimit)
226  real(DP) :: maxvar(prof_rapnlimit)
227  real(DP) :: minvar(prof_rapnlimit)
228  integer :: maxidx(prof_rapnlimit)
229  integer :: minidx(prof_rapnlimit)
230 
231  integer :: id, gid
232  integer :: fid
233  !---------------------------------------------------------------------------
234 
235  do id = 1, prof_rapnmax
236  if ( prof_rapnstr(id) /= prof_rapnend(id) ) then
237  write(*,*) '*** Mismatch Report',id,prof_rapname(id),prof_rapnstr(id),prof_rapnend(id)
238  endif
239  enddo
240 
241  if( io_l ) write(io_fid_log,*)
242  if( io_l ) write(io_fid_log,*) '*** Computational Time Report'
243  if( io_l ) write(io_fid_log,*) '*** Rap level is ', prof_rap_level
244 
245  if ( io_log_allnode ) then ! report for each node
246 
247  do gid = 1, prof_rapnmax
248  do id = 1, prof_rapnmax
249  if ( prof_raplevel(id) <= prof_rap_level .AND. &
250  prof_grpid(id) == gid .AND. &
251  io_l ) then
252  write(io_fid_log,'(1x,A,I3.3,A,A,A,F10.3,A,I9)') &
253  '*** ID=',id,' : ',prof_rapname(id),' T=',prof_rapttot(id),' N=',prof_rapnstr(id)
254  endif
255  enddo
256  enddo
257 
258  else
259 
260  call prc_mpitimestat( avgvar(1:prof_rapnmax), &
261  maxvar(1:prof_rapnmax), &
262  minvar(1:prof_rapnmax), &
263  maxidx(1:prof_rapnmax), &
264  minidx(1:prof_rapnmax), &
265  prof_rapttot(1:prof_rapnmax) )
266 
267  fid = -1
268  if ( io_log_suppress ) then ! report to STDOUT
269  if ( prc_ismaster ) then
270  write(*,*) '*** Computational Time Report'
271  fid = 6 ! master node
272  endif
273  else
274  if ( io_l ) fid = io_fid_log
275  endif
276 
277  do gid = 1, prof_rapnmax
278  do id = 1, prof_rapnmax
279  if ( prof_raplevel(id) <= prof_rap_level .AND. &
280  prof_grpid(id) == gid .AND. &
281  fid > 0 ) then
282  write(io_fid_log,'(1x,A,I3.3,A,A,A,F10.3,A,F10.3,A,I5,A,A,F10.3,A,I5,A,A,I9)') &
283  '*** ID=',id,' : ',prof_rapname(id), &
284  ' T(avg)=',avgvar(id), &
285  ', T(max)=',maxvar(id),'[',maxidx(id),']', &
286  ', T(min)=',minvar(id),'[',minidx(id),']', &
287  ' N=',prof_rapnstr(id)
288  endif
289  enddo
290  enddo
291 
292  endif
293 
294  return
logical, public prc_ismaster
master process in local communicator?
subroutine, public prc_mpitimestat(avgvar, maxvar, minvar, maxidx, minidx, var)
Calc global statistics for timer.
module PROCESS
Here is the call graph for this function:
Here is the caller graph for this function: