SCALE-RM
Data Types | 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
NAMELIST
  • PARAM_PROF
    nametypedefault valuecomment
    PROF_RAP_LEVEL integer 2
    PROF_MPI_BARRIER logical .false.

History Output
No history output

Function/Subroutine Documentation

◆ prof_setup()

subroutine, public scale_prof::prof_setup ( )

Definition at line 103 of file scale_prof.F90.

References scale_io::io_fid_conf, and scale_prc::prc_abort().

Referenced by mod_rm_driver::rm_driver(), mod_rm_prep::rm_prep(), and scale::scale_init().

103  use scale_prc, only: &
104  prc_abort
105  implicit none
106 
107  namelist / param_prof / &
108  prof_rap_level, &
109  prof_mpi_barrier
110 
111  integer :: ierr
112 
113  log_newline
114  log_info("PRF_setup",*) 'Setup'
115 
116  !--- read namelist
117  rewind(io_fid_conf)
118  read(io_fid_conf,nml=param_prof,iostat=ierr)
119  if( ierr < 0 ) then !--- missing
120  log_info("PROF_setup",*) 'Not found namelist. Default used.'
121  elseif( ierr > 0 ) then !--- fatal error
122  log_error("PROF_setup",*) 'Not appropriate names in namelist PARAM_PROF. Check!'
123  call prc_abort
124  endif
125  log_nml(param_prof)
126 
127  log_newline
128  log_info("PROF_setup",*) 'Rap output level = ', prof_rap_level
129  log_info("PROF_setup",*) 'Add MPI_barrier in every rap? = ', prof_mpi_barrier
130 
131  prof_prefix = ''
132 
133  return
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:55
module PROCESS
Definition: scale_prc.F90:11
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:338
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 139 of file scale_prof.F90.

Referenced by mod_rm_driver::rm_driver(), and mod_rm_prep::rm_prep().

139  implicit none
140 
141  character(len=*), intent(in) :: prefxname
142 
143  !---------------------------------------------------------------------------
144 
145  if ( prefxname == '' ) then !--- no prefix
146  prof_prefix = ''
147  else
148  prof_prefix = trim(prefxname)//'_'
149  endif
150 
151  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

Definition at line 157 of file scale_prof.F90.

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

Referenced by mod_atmos_driver::atmos_driver_calc_tendency(), mod_atmos_driver::atmos_driver_calc_tendency_from_sflux(), mod_atmos_driver::atmos_driver_setup(), mod_atmos_driver::atmos_driver_update(), 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(), scale_atmos_phy_ae_kajino13::atmos_phy_ae_kajino13_negative_fixer(), scale_atmos_phy_cp_kf::atmos_phy_cp_kf_tendency(), mod_atmos_phy_mp_driver::atmos_phy_mp_driver_calc_tendency(), scale_atmos_phy_mp_kessler::atmos_phy_mp_kessler_adjustment(), scale_atmos_phy_mp_common::atmos_phy_mp_negative_fixer(), scale_atmos_phy_mp_common::atmos_phy_mp_saturation_adjustment_3d(), scale_atmos_phy_mp_sn14::atmos_phy_mp_sn14_qhyd2qtrc(), scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10_qhyd2qtrc(), scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10_tendency(), scale_atmos_phy_mp_tomita08::atmos_phy_mp_tomita08_adjustment(), scale_atmos_phy_rd_mstrnx::atmos_phy_rd_mstrnx_flux(), mod_atmos_driver::atmos_surface_get(), mod_atmos_driver::atmos_surface_set(), mod_atmos_vars::atmos_vars_history(), mod_atmos_vars::atmos_vars_restart_check(), scale_debug::check(), scale_comm_cartesc::comm_bcast_1d(), scale_comm_cartesc::comm_bcast_2d(), scale_comm_cartesc::comm_bcast_3d(), scale_comm_cartesc::comm_bcast_4d(), scale_comm_cartesc::comm_bcast_character(), scale_comm_cartesc::comm_bcast_int_1d(), scale_comm_cartesc::comm_bcast_int_2d(), scale_comm_cartesc::comm_bcast_int_scr(), scale_comm_cartesc::comm_bcast_logical_scr(), scale_comm_cartesc::comm_bcast_scr(), scale_comm_cartesc_nest::comm_cartesc_nest_nestdown(), scale_comm_cartesc_nest::comm_cartesc_nest_recvwait_issue(), scale_comm_cartesc_nest::comm_cartesc_nest_test(), scale_comm_icoa::comm_data_transfer_dp(), scale_comm_icoa::comm_data_transfer_nopl(), scale_comm_icoa::comm_data_transfer_sp(), scale_comm_cartesc::comm_horizontal_mean_3d(), scale_comm_icoa::comm_var_dp(), scale_comm_icoa::comm_var_sp(), scale_comm_cartesc::comm_vars8_init(), scale_comm_cartesc::comm_vars_init(), scale_file_cartesc::file_cartesc_close(), scale_file_cartesc::file_cartesc_create(), scale_file_cartesc::file_cartesc_def_axes(), scale_file_cartesc::file_cartesc_def_var(), scale_file_cartesc::file_cartesc_enddef(), scale_file_cartesc::file_cartesc_flush(), scale_file_cartesc::file_cartesc_open(), scale_file_cartesc::file_cartesc_put_globalattributes(), scale_file_cartesc::file_cartesc_read_1d(), scale_file_cartesc::file_cartesc_read_auto_2d(), scale_file_cartesc::file_cartesc_read_auto_3d(), scale_file_cartesc::file_cartesc_read_var_2d(), scale_file_cartesc::file_cartesc_read_var_3d(), scale_file_cartesc::file_cartesc_read_var_4d(), scale_file_cartesc::file_cartesc_write_axes(), scale_file_cartesc::file_cartesc_write_var_1d(), scale_file_cartesc::file_cartesc_write_var_2d(), scale_file_cartesc::file_cartesc_write_var_3d(), scale_file_cartesc::file_cartesc_write_var_3d_t(), scale_file_cartesc::file_cartesc_write_var_4d(), scale_file_history_cartesc::file_history_cartesc_truncate_3d(), scale_file_history::file_history_in_0d(), scale_file_history::file_history_in_1d(), scale_file_history::file_history_in_2d(), scale_file_history::file_history_in_3d(), scale_file_history::file_history_reg(), scale_file_history::file_history_write(), scale_interp::interp_factor2d(), scale_interp::interp_factor3d(), scale_interp::interp_interp2d(), scale_interp::interp_interp3d(), mod_land_driver::land_driver_calc_tendency(), mod_land_driver::land_driver_update(), mod_land_driver::land_surface_get(), mod_land_driver::land_surface_set(), mod_land_vars::land_vars_history(), mod_mkinit::mkinit(), scale_monitor::monitor_write(), mod_ocean_driver::ocean_driver_calc_tendency(), mod_ocean_driver::ocean_driver_update(), mod_ocean_driver::ocean_surface_get(), mod_ocean_driver::ocean_surface_set(), mod_ocean_vars::ocean_vars_history(), mod_mkinit::read_sounding(), mod_realinput::realinput_surface(), mod_rm_driver::rm_driver(), mod_rm_prep::rm_prep(), scale::scale_init(), scale_statistics::statistics_detail_2d(), scale_statistics::statistics_detail_3d(), scale_statistics::statistics_horizontal_max_2d(), scale_statistics::statistics_horizontal_max_3d(), scale_statistics::statistics_horizontal_mean_2d(), scale_statistics::statistics_horizontal_mean_3d(), scale_statistics::statistics_horizontal_min_2d(), scale_statistics::statistics_horizontal_min_3d(), scale_statistics::statistics_total_2d(), scale_statistics::statistics_total_3d(), mod_urban_driver::urban_driver_calc_tendency(), mod_urban_driver::urban_driver_update(), mod_urban_driver::urban_surface_get(), mod_urban_driver::urban_surface_set(), mod_urban_vars::urban_vars_history(), scale_debug::valcheck_1d(), scale_debug::valcheck_2d(), scale_debug::valcheck_3d(), and scale_comm_cartesc::wait_3d_mpi().

157  use scale_prc, only: &
158  prc_mpibarrier, &
160  implicit none
161 
162  character(len=*), intent(in) :: rapname_base
163  integer, intent(in), optional :: level
164 
165  character(len=H_SHORT) :: rapname
166 
167  integer :: id
168  integer :: level_
169  integer :: tn
170  !$ integer :: omp_get_thread_num
171  !---------------------------------------------------------------------------
172 
173  tn = 0
174  !$ tn = omp_get_thread_num()
175  if ( tn > 0 ) return
176 
177  if ( present(level) ) then
178  level_ = level
179  else
180  level_ = prof_default_rap_level
181  endif
182 
183  if( level_ > prof_rap_level ) return
184 
185  rapname = trim(prof_prefix)//trim(rapname_base)
186 
187  id = get_rapid( rapname, level_ )
188 
189  if(prof_mpi_barrier) call prc_mpibarrier
190 
191  prof_raptstr(id) = prc_mpitime()
192  prof_rapnstr(id) = prof_rapnstr(id) + 1
193 
194  !LOG_INFO("PROF_rapstart",'(1x,A,I8)') rapname, PROF_rapnstr(id)
195  !call flush(IO_FID_LOG)
196 
197 #ifdef FAPP
198  call fapp_start( trim(prof_grpname(get_grpid(rapname))), id, level_ )
199 #endif
200 #ifdef FINEPA
201  call start_collection( rapname )
202 #endif
203 
204  return
module PROCESS
Definition: scale_prc.F90:11
real(dp) function, public prc_mpitime()
Get MPI time.
Definition: scale_prc.F90:813
subroutine, public prc_mpibarrier
Barrier MPI.
Definition: scale_prc.F90:798
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 210 of file scale_prof.F90.

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

Referenced by mod_atmos_driver::atmos_driver_calc_tendency(), mod_atmos_driver::atmos_driver_calc_tendency_from_sflux(), mod_atmos_driver::atmos_driver_setup(), mod_atmos_driver::atmos_driver_update(), 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(), scale_atmos_phy_ae_kajino13::atmos_phy_ae_kajino13_negative_fixer(), scale_atmos_phy_cp_kf::atmos_phy_cp_kf_tendency(), mod_atmos_phy_mp_driver::atmos_phy_mp_driver_calc_tendency(), scale_atmos_phy_mp_kessler::atmos_phy_mp_kessler_adjustment(), scale_atmos_phy_mp_common::atmos_phy_mp_negative_fixer(), scale_atmos_phy_mp_common::atmos_phy_mp_saturation_adjustment_3d(), scale_atmos_phy_mp_sn14::atmos_phy_mp_sn14_qhyd2qtrc(), scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10_qhyd2qtrc(), scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10_tendency(), scale_atmos_phy_mp_tomita08::atmos_phy_mp_tomita08_adjustment(), scale_atmos_phy_rd_mstrnx::atmos_phy_rd_mstrnx_flux(), mod_atmos_driver::atmos_surface_get(), mod_atmos_driver::atmos_surface_set(), mod_atmos_vars::atmos_vars_history(), mod_atmos_vars::atmos_vars_restart_check(), scale_debug::check(), scale_comm_cartesc::comm_bcast_1d(), scale_comm_cartesc::comm_bcast_2d(), scale_comm_cartesc::comm_bcast_3d(), scale_comm_cartesc::comm_bcast_4d(), scale_comm_cartesc::comm_bcast_character(), scale_comm_cartesc::comm_bcast_int_1d(), scale_comm_cartesc::comm_bcast_int_2d(), scale_comm_cartesc::comm_bcast_int_scr(), scale_comm_cartesc::comm_bcast_logical_scr(), scale_comm_cartesc::comm_bcast_scr(), scale_comm_cartesc_nest::comm_cartesc_nest_nestdown(), scale_comm_cartesc_nest::comm_cartesc_nest_recvwait_issue(), scale_comm_cartesc_nest::comm_cartesc_nest_test(), scale_comm_icoa::comm_data_transfer_dp(), scale_comm_icoa::comm_data_transfer_nopl(), scale_comm_icoa::comm_data_transfer_sp(), scale_comm_cartesc::comm_horizontal_mean_3d(), scale_comm_icoa::comm_var_dp(), scale_comm_icoa::comm_var_sp(), scale_comm_cartesc::comm_vars8_init(), scale_comm_cartesc::comm_vars_init(), scale_file_cartesc::file_cartesc_close(), scale_file_cartesc::file_cartesc_create(), scale_file_cartesc::file_cartesc_def_axes(), scale_file_cartesc::file_cartesc_def_var(), scale_file_cartesc::file_cartesc_enddef(), scale_file_cartesc::file_cartesc_flush(), scale_file_cartesc::file_cartesc_open(), scale_file_cartesc::file_cartesc_put_globalattributes(), scale_file_cartesc::file_cartesc_read_1d(), scale_file_cartesc::file_cartesc_read_auto_2d(), scale_file_cartesc::file_cartesc_read_auto_3d(), scale_file_cartesc::file_cartesc_read_var_2d(), scale_file_cartesc::file_cartesc_read_var_3d(), scale_file_cartesc::file_cartesc_read_var_4d(), scale_file_cartesc::file_cartesc_write_axes(), scale_file_cartesc::file_cartesc_write_var_1d(), scale_file_cartesc::file_cartesc_write_var_2d(), scale_file_cartesc::file_cartesc_write_var_3d(), scale_file_cartesc::file_cartesc_write_var_3d_t(), scale_file_cartesc::file_cartesc_write_var_4d(), scale_file_history_cartesc::file_history_cartesc_truncate_3d(), scale_file_history::file_history_in_0d(), scale_file_history::file_history_in_1d(), scale_file_history::file_history_in_2d(), scale_file_history::file_history_in_3d(), scale_file_history::file_history_reg(), scale_file_history::file_history_write(), scale_interp::interp_factor2d(), scale_interp::interp_factor3d(), scale_interp::interp_interp2d(), scale_interp::interp_interp3d(), mod_land_driver::land_driver_calc_tendency(), mod_land_driver::land_driver_update(), mod_land_driver::land_surface_get(), mod_land_driver::land_surface_set(), mod_land_vars::land_vars_history(), mod_mkinit::mkinit(), scale_monitor::monitor_write(), mod_ocean_driver::ocean_driver_calc_tendency(), mod_ocean_driver::ocean_driver_update(), mod_ocean_driver::ocean_surface_get(), mod_ocean_driver::ocean_surface_set(), mod_ocean_vars::ocean_vars_history(), mod_mkinit::read_sounding(), mod_realinput::realinput_surface(), mod_rm_driver::rm_driver(), mod_rm_prep::rm_prep(), scale::scale_finalize(), scale_statistics::statistics_detail_2d(), scale_statistics::statistics_detail_3d(), scale_statistics::statistics_horizontal_max_2d(), scale_statistics::statistics_horizontal_max_3d(), scale_statistics::statistics_horizontal_mean_2d(), scale_statistics::statistics_horizontal_mean_3d(), scale_statistics::statistics_horizontal_min_2d(), scale_statistics::statistics_horizontal_min_3d(), scale_statistics::statistics_total_2d(), scale_statistics::statistics_total_3d(), mod_urban_driver::urban_driver_calc_tendency(), mod_urban_driver::urban_driver_update(), mod_urban_driver::urban_surface_get(), mod_urban_driver::urban_surface_set(), mod_urban_vars::urban_vars_history(), scale_debug::valcheck_1d(), scale_debug::valcheck_2d(), scale_debug::valcheck_3d(), and scale_comm_cartesc::wait_3d_mpi().

210  use scale_prc, only: &
211  prc_mpibarrier, &
213  implicit none
214 
215  character(len=*), intent(in) :: rapname_base
216  integer, intent(in), optional :: level
217 
218  character(len=H_SHORT) :: rapname
219 
220  integer :: id
221  integer :: level_
222  integer :: tn
223  !$ integer :: omp_get_thread_num
224  !---------------------------------------------------------------------------
225 
226  tn = 0
227  !$ tn = omp_get_thread_num()
228  if ( tn > 0 ) return
229 
230  if ( present(level) ) then
231  if( level > prof_rap_level ) return
232  endif
233 
234  rapname = trim(prof_prefix)//trim(rapname_base)
235 
236  id = get_rapid( rapname, level_ )
237 
238  if( level_ > prof_rap_level ) return
239 
240  if(prof_mpi_barrier) call prc_mpibarrier
241 
242  prof_rapttot(id) = prof_rapttot(id) + ( prc_mpitime()-prof_raptstr(id) )
243  prof_rapnend(id) = prof_rapnend(id) + 1
244 
245 #ifdef FINEPA
246  call stop_collection( rapname )
247 #endif
248 #ifdef FAPP
249  call fapp_stop( trim(prof_grpname(prof_grpid(id))), id, level_ )
250 #endif
251 
252  return
module PROCESS
Definition: scale_prc.F90:11
real(dp) function, public prc_mpitime()
Get MPI time.
Definition: scale_prc.F90:813
subroutine, public prc_mpibarrier
Barrier MPI.
Definition: scale_prc.F90:798
Here is the call graph for this function:

◆ prof_rapreport()

subroutine, public scale_prof::prof_rapreport ( )

Report raptime.

Definition at line 258 of file scale_prof.F90.

References scale_io::io_fid_log, scale_io::io_fid_stdout, scale_io::io_l, scale_io::io_log_allnode, scale_io::io_log_suppress, scale_prc::prc_ismaster, scale_prc::prc_mpitimestat(), and scale_prc::prc_nprocs.

Referenced by mod_rm_driver::rm_driver(), mod_rm_prep::rm_prep(), and scale::scale_finalize().

258  use scale_prc, only: &
259  prc_mpitimestat, &
261  implicit none
262 
263  real(DP) :: avgvar(prof_rapnlimit)
264  real(DP) :: maxvar(prof_rapnlimit)
265  real(DP) :: minvar(prof_rapnlimit)
266  integer :: maxidx(prof_rapnlimit)
267  integer :: minidx(prof_rapnlimit)
268 
269  integer :: id, gid
270  integer :: fid
271  !---------------------------------------------------------------------------
272 
273  do id = 1, prof_rapnmax
274  if ( prof_rapnstr(id) /= prof_rapnend(id) ) then
275  log_warn("PROF_rapreport",*) 'Mismatch Report',id,prof_rapname(id),prof_rapnstr(id),prof_rapnend(id)
276  endif
277  enddo
278 
279  log_newline
280  log_info("PROF_rapreport",'(1x,A,I2,A)') 'Computational Time Report (Rap level = ', prof_rap_level, ')'
281 
282  if ( io_log_allnode ) then ! report for each node
283 
284  do gid = 1, prof_rapnmax
285  do id = 1, prof_rapnmax
286  if ( prof_raplevel(id) <= prof_rap_level &
287  .AND. prof_grpid(id) == gid ) then
288  log_info_cont('(1x,A,I3.3,A,A,A,F10.3,A,I9)') &
289  'ID=',id,' : ',prof_rapname(id),' T=',prof_rapttot(id),' N=',prof_rapnstr(id)
290  endif
291  enddo
292  enddo
293 
294  else
295 
296  call prc_mpitimestat( avgvar(1:prof_rapnmax), &
297  maxvar(1:prof_rapnmax), &
298  minvar(1:prof_rapnmax), &
299  maxidx(1:prof_rapnmax), &
300  minidx(1:prof_rapnmax), &
301  prof_rapttot(1:prof_rapnmax) )
302 
303  fid = -1
304  if ( io_log_suppress ) then ! report to STDOUT
305  if ( prc_ismaster ) then
306  write(*,*) 'INFO [PROF_rapreport] Computational Time Report'
307  fid = io_fid_stdout ! master node
308  endif
309  else
310  if ( io_l ) fid = io_fid_log
311  endif
312 
313  do gid = 1, prof_rapnmax
314  do id = 1, prof_rapnmax
315  if ( prof_raplevel(id) <= prof_rap_level &
316  .AND. prof_grpid(id) == gid &
317  .AND. fid > 0 ) then
318  write(fid,'(6x,A,I3.3,3A,F10.3,A,F10.3,A,I5,2A,F10.3,A,I5,2A,I9)') &
319  'ID=',id,' : ',prof_rapname(id), &
320  ' T(avg)=',avgvar(id), &
321  ', T(max)=',maxvar(id),'[',maxidx(id),']', &
322  ', T(min)=',minvar(id),'[',minidx(id),']', &
323  ', N=',prof_rapnstr(id)
324  endif
325  enddo
326  enddo
327 
328  endif
329 
330  return
logical, public io_log_suppress
suppress all of log output?
Definition: scale_io.F90:63
logical, public io_l
output log or not? (this process)
Definition: scale_io.F90:61
integer, parameter, public io_fid_stdout
Definition: scale_io.F90:54
logical, public io_log_allnode
output log for each node?
Definition: scale_io.F90:65
module PROCESS
Definition: scale_prc.F90:11
logical, public prc_ismaster
master process in local communicator?
Definition: scale_prc.F90:90
integer, public io_fid_log
Log file ID.
Definition: scale_io.F90:56
subroutine, public prc_mpitimestat(avgvar, maxvar, minvar, maxidx, minidx, var)
Calc global statistics for timer.
Definition: scale_prc.F90:835
Here is the call graph for this function:
Here is the caller graph for this function: