Skip to content

Commit bac74e2

Browse files
committed
Add timers to driver-mct to provide context to SCORPIO timers
SCORPIO has introduced some new timers. Unfortunately, the existing timers in driver-mct are not sufficient to localize where the SCORPIO calls are coming from. Here new timers are added to provide the missing context. A few timers are also added to provide context for these added timers and for some of the already existing timers. While 25 new timers are introduced, in normal usage only 7 to 11 new timers appear in the timing files. Four existing timers were renamed in order to add a CPL prefix: comp_init_cc_iac => CPL:comp_init_cc_iac driver_rofpost_histaux => CPL:seq_hist_writeaux-r2x DRIVER_ROFPOST_BARRIER => CPL:ROFPOST_BARRIER DRIVER_ROFPOST => CPL:ROFPOST Two existing timers were renamed to eliminate collisions from the previous renamings: CPL:ROFPOST_BARRIER => CPL:ROFRUNPOST_BARRIER CPL:ROFPOST => CPL:ROFRUNPOST [BFB]
1 parent 995c3ec commit bac74e2

File tree

2 files changed

+102
-10
lines changed

2 files changed

+102
-10
lines changed

driver-mct/main/cime_comp_mod.F90

Lines changed: 88 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,12 +1060,15 @@ subroutine cime_pre_init2()
10601060
!| Initialize infodata
10611061
!----------------------------------------------------------
10621062

1063+
call t_startf('CPL:seq_infodata_init')
10631064
if (len_trim(cpl_inst_tag) > 0) then
10641065
call seq_infodata_init(infodata,nlfilename, GLOID, pioid, &
10651066
cpl_tag=cpl_inst_tag)
10661067
else
10671068
call seq_infodata_init(infodata,nlfilename, GLOID, pioid)
10681069
end if
1070+
call t_stopf('CPL:seq_infodata_init')
1071+
10691072
call seq_infodata_GetData(infodata, cime_model=cime_model)
10701073

10711074
!----------------------------------------------------------
@@ -1234,11 +1237,13 @@ subroutine cime_pre_init2()
12341237
!| Initialize time manager
12351238
!----------------------------------------------------------
12361239

1240+
call t_startf('CPL:seq_timemgr_clockInit')
12371241
call seq_timemgr_clockInit(seq_SyncClock, nlfilename, &
12381242
read_restart, rest_file, pioid, mpicom_gloid, &
12391243
EClock_d, EClock_a, EClock_l, EClock_o, &
12401244
EClock_i, Eclock_g, Eclock_r, Eclock_w, Eclock_e, &
12411245
EClock_z)
1246+
call t_stopf('CPL:seq_timemgr_clockInit')
12421247

12431248
if (iamroot_CPLID) then
12441249
call seq_timemgr_clockPrint(seq_SyncClock)
@@ -1463,11 +1468,11 @@ subroutine cime_init()
14631468
call t_adj_detailf(-2)
14641469
call t_stopf('CPL:comp_init_cc_esp')
14651470

1466-
call t_startf('comp_init_cc_iac')
1471+
call t_startf('CPL:comp_init_cc_iac')
14671472
call t_adj_detailf(+2)
14681473
call component_init_cc(Eclock_z, iac, iac_init, infodata, NLFilename)
14691474
call t_adj_detailf(-2)
1470-
call t_stopf('comp_init_cc_iac')
1475+
call t_stopf('CPL:comp_init_cc_iac')
14711476

14721477
call t_startf('CPL:comp_init_cx_all')
14731478
call t_adj_detailf(+2)
@@ -2317,14 +2322,19 @@ subroutine cime_init()
23172322

23182323
call seq_diag_zero_mct(mode='all')
23192324
if (read_restart .and. iamin_CPLID) then
2325+
23202326
if (iamroot_CPLID) then
23212327
write(logunit,103) subname,' Reading restart file ',trim(rest_file)
23222328
call shr_sys_flush(logunit)
23232329
end if
2330+
2331+
call t_startf('CPL:seq_rest_read-init')
23242332
call seq_rest_read(rest_file, infodata, &
23252333
atm, lnd, ice, ocn, rof, glc, wav, esp, iac, &
23262334
fractions_ax, fractions_lx, fractions_ix, fractions_ox, &
23272335
fractions_rx, fractions_gx, fractions_wx, fractions_zx)
2336+
call t_stopf('CPL:seq_rest_read-init')
2337+
23282338
endif
23292339

23302340
call t_adj_detailf(-2)
@@ -2380,10 +2390,14 @@ subroutine cime_init()
23802390
write(logunit,104) ' Write history file at ',ymd,tod
23812391
call shr_sys_flush(logunit)
23822392
endif
2393+
2394+
call t_startf('CPL:seq_hist_write-init')
23832395
call seq_hist_write(infodata, EClock_d, &
23842396
atm, lnd, ice, ocn, rof, glc, wav, iac, &
23852397
fractions_ax, fractions_lx, fractions_ix, fractions_ox, &
23862398
fractions_rx, fractions_gx, fractions_wx, fractions_zx, trim(cpl_inst_tag))
2399+
call t_stopf('CPL:seq_hist_write-init')
2400+
23872401
if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
23882402

23892403
call t_adj_detailf(-2)
@@ -2970,23 +2984,27 @@ subroutine cime_run()
29702984
endif
29712985
if (rof_present) then
29722986
if (iamin_CPLID) then
2973-
call cime_comp_barriers(mpicom=mpicom_CPLID, timer='DRIVER_ROFPOST_BARRIER')
2974-
call t_drvstartf ('DRIVER_ROFPOST',cplrun=.true.,barrier=mpicom_CPLID)
2987+
2988+
call cime_comp_barriers(mpicom=mpicom_CPLID, timer='CPL:ROFPOST_BARRIER')
2989+
call t_drvstartf ('CPL:ROFPOST',cplrun=.true.,barrier=mpicom_CPLID)
29752990
if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
29762991
if (do_hist_r2x) then
2977-
call t_drvstartf ('driver_rofpost_histaux', barrier=mpicom_CPLID)
29782992
! Write coupler's hr2x file at 24 hour marks,
29792993
! and at the end of the run interval, even if that's not at a 24 hour mark.
29802994
write_hist_alarm = t24hr_alarm .or. stop_alarm
2995+
2996+
call t_startf('CPL:seq_hist_writeaux-r2x')
29812997
do eri = 1,num_inst_rof
29822998
inst_suffix = component_get_suffix(rof(eri))
29832999
call seq_hist_writeaux(infodata, EClock_d, rof(eri), flow='c2x', &
29843000
aname='r2x',dname='domrb',inst_suffix=trim(inst_suffix), &
29853001
nx=rof_nx, ny=rof_ny, nt=1, write_now=write_hist_alarm)
29863002
enddo
2987-
call t_drvstopf ('driver_rofpost_histaux')
3003+
call t_stopf('CPL:seq_hist_writeaux-r2x')
3004+
29883005
endif
2989-
call t_drvstopf ('DRIVER_ROFPOST', cplrun=.true.)
3006+
call t_drvstopf ('CPL:ROFPOST', cplrun=.true.)
3007+
29903008
endif
29913009
endif
29923010
!----------------------------------------------------------
@@ -3238,10 +3256,19 @@ subroutine cime_run()
32383256
call shr_sys_flush(logunit)
32393257
end if
32403258
if (iamin_CPLID) then
3259+
3260+
call cime_comp_barriers(mpicom=mpicom_CPLID, timer='CPL:RESTART_READ_BARRIER')
3261+
call t_drvstartf ('CPL:RESTART_READ',cplrun=.true.,barrier=mpicom_CPLID)
3262+
3263+
call t_startf('CPL:seq_rest_read')
32413264
call seq_rest_read(drv_resume_file, infodata, &
32423265
atm, lnd, ice, ocn, rof, glc, wav, esp, iac, &
32433266
fractions_ax, fractions_lx, fractions_ix, fractions_ox, &
32443267
fractions_rx, fractions_gx, fractions_wx, fractions_zx)
3268+
call t_stopf('CPL:seq_rest_read')
3269+
3270+
call t_drvstopf ('CPL:RESTART_READ',cplrun=.true.)
3271+
32453272
end if
32463273
! Clear the resume file so we don't try to read it again
32473274
drv_resume = .FALSE.
@@ -4382,8 +4409,10 @@ subroutine cime_run_rof_recv_post()
43824409
! rof post
43834410
!----------------------------------------------------------
43844411
if (iamin_CPLID) then
4385-
call cime_comp_barriers(mpicom=mpicom_CPLID, timer='CPL:ROFPOST_BARRIER')
4386-
call t_drvstartf ('CPL:ROFPOST',cplrun=.true.,barrier=mpicom_CPLID)
4412+
4413+
call cime_comp_barriers(mpicom=mpicom_CPLID, timer='CPL:ROFRUNPOST_BARRIER')
4414+
call t_drvstartf ('CPL:ROFRUNPOST',cplrun=.true.,barrier=mpicom_CPLID)
4415+
43874416
if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
43884417

43894418
call component_diag(infodata, rof, flow='c2x', comment= 'recv rof', &
@@ -4394,7 +4423,9 @@ subroutine cime_run_rof_recv_post()
43944423
if (rof_c2_ice) call prep_ice_calc_r2x_ix(timer='CPL:rofpost_rof2ice')
43954424
if (rof_c2_ocn) call prep_ocn_calc_r2x_ox(timer='CPL:rofpost_rof2ocn')
43964425
end if
4397-
call t_drvstopf ('CPL:ROFPOST', cplrun=.true.)
4426+
4427+
call t_drvstopf ('CPL:ROFRUNPOST', cplrun=.true.)
4428+
43984429
endif
43994430

44004431
end subroutine cime_run_rof_recv_post
@@ -4713,28 +4744,38 @@ subroutine cime_run_write_history(lnd2glc_averaged_now)
47134744

47144745
call cime_comp_barriers(mpicom=mpicom_CPLID, timer='CPL:HISTORY_BARRIER')
47154746
call t_drvstartf ('CPL:HISTORY',cplrun=.true.,barrier=mpicom_CPLID)
4747+
call t_startf('CPL:cime_run_write_history')
4748+
47164749
if ( history_alarm) then
47174750
if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
47184751
if (iamroot_CPLID) then
47194752
write(logunit,104) ' Write history file at ',ymd,tod
47204753
call shr_sys_flush(logunit)
47214754
endif
47224755

4756+
call t_startf('CPL:seq_hist_write')
47234757
call seq_hist_write(infodata, EClock_d, &
47244758
atm, lnd, ice, ocn, rof, glc, wav, iac, &
47254759
fractions_ax, fractions_lx, fractions_ix, fractions_ox, &
47264760
fractions_rx, fractions_gx, fractions_wx, fractions_zx, trim(cpl_inst_tag))
4761+
call t_stopf('CPL:seq_hist_write')
47274762

47284763
if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
47294764
endif
47304765

47314766
if (do_histavg) then
4767+
4768+
call t_startf('CPL:seq_hist_writeavg')
47324769
call seq_hist_writeavg(infodata, EClock_d, &
47334770
atm, lnd, ice, ocn, rof, glc, wav, iac, histavg_alarm, &
47344771
trim(cpl_inst_tag))
4772+
call t_stopf('CPL:seq_hist_writeavg')
4773+
47354774
endif
47364775

47374776
if (do_hist_a2x) then
4777+
4778+
call t_startf('CPL:seq_hist_writeaux-a2x')
47384779
do eai = 1,num_inst_atm
47394780
inst_suffix = component_get_suffix(atm(eai))
47404781
if (trim(hist_a2x_flds) == 'all') then
@@ -4747,9 +4788,13 @@ subroutine cime_run_write_history(lnd2glc_averaged_now)
47474788
nx=atm_nx, ny=atm_ny, nt=ncpl, flds=hist_a2x_flds)
47484789
endif
47494790
enddo
4791+
call t_stopf('CPL:seq_hist_writeaux-a2x')
4792+
47504793
endif
47514794

47524795
if (do_hist_a2x1hri .and. t1hr_alarm) then
4796+
4797+
call t_startf('CPL:seq_hist_writeaux-a2x1hri')
47534798
do eai = 1,num_inst_atm
47544799
inst_suffix = component_get_suffix(atm(eai))
47554800
if (trim(hist_a2x1hri_flds) == 'all') then
@@ -4762,9 +4807,13 @@ subroutine cime_run_write_history(lnd2glc_averaged_now)
47624807
nx=atm_nx, ny=atm_ny, nt=24, flds=hist_a2x1hri_flds)
47634808
endif
47644809
enddo
4810+
call t_stopf('CPL:seq_hist_writeaux-a2x1hri')
4811+
47654812
endif
47664813

47674814
if (do_hist_a2x1hr) then
4815+
4816+
call t_startf('CPL:seq_hist_writeaux-a2x1hr')
47684817
do eai = 1,num_inst_atm
47694818
inst_suffix = component_get_suffix(atm(eai))
47704819
if (trim(hist_a2x1hr_flds) == 'all') then
@@ -4777,9 +4826,13 @@ subroutine cime_run_write_history(lnd2glc_averaged_now)
47774826
nx=atm_nx, ny=atm_ny, nt=24, write_now=t1hr_alarm, flds=hist_a2x1hr_flds)
47784827
endif
47794828
enddo
4829+
call t_stopf('CPL:seq_hist_writeaux-a2x1hr')
4830+
47804831
endif
47814832

47824833
if (do_hist_a2x3hr) then
4834+
4835+
call t_startf('CPL:seq_hist_writeaux-a2x3hr')
47834836
do eai = 1,num_inst_atm
47844837
inst_suffix = component_get_suffix(atm(eai))
47854838
if (trim(hist_a2x3hr_flds) == 'all') then
@@ -4792,9 +4845,13 @@ subroutine cime_run_write_history(lnd2glc_averaged_now)
47924845
nx=atm_nx, ny=atm_ny, nt=8, write_now=t3hr_alarm, flds=hist_a2x3hr_flds)
47934846
endif
47944847
enddo
4848+
call t_stopf('CPL:seq_hist_writeaux-a2x3hr')
4849+
47954850
endif
47964851

47974852
if (do_hist_a2x3hrp) then
4853+
4854+
call t_startf('CPL:seq_hist_writeaux-a2x3hrp')
47984855
do eai = 1,num_inst_atm
47994856
inst_suffix = component_get_suffix(atm(eai))
48004857
if (trim(hist_a2x3hrp_flds) == 'all') then
@@ -4807,9 +4864,13 @@ subroutine cime_run_write_history(lnd2glc_averaged_now)
48074864
nx=atm_nx, ny=atm_ny, nt=8, write_now=t3hr_alarm, flds=hist_a2x3hrp_flds)
48084865
endif
48094866
enddo
4867+
call t_stopf('CPL:seq_hist_writeaux-a2x3hrp')
4868+
48104869
endif
48114870

48124871
if (do_hist_a2x24hr) then
4872+
4873+
call t_startf('CPL:seq_hist_writeaux-a2x24hr')
48134874
do eai = 1,num_inst_atm
48144875
inst_suffix = component_get_suffix(atm(eai))
48154876
if (trim(hist_a2x24hr_flds) == 'all') then
@@ -4822,6 +4883,8 @@ subroutine cime_run_write_history(lnd2glc_averaged_now)
48224883
nx=atm_nx, ny=atm_ny, nt=1, write_now=t24hr_alarm, flds=hist_a2x24hr_flds)
48234884
endif
48244885
enddo
4886+
call t_stopf('CPL:seq_hist_writeaux-a2x24hr')
4887+
48254888
endif
48264889

48274890
if (do_hist_l2x1yrg) then
@@ -4865,6 +4928,8 @@ subroutine cime_run_write_history(lnd2glc_averaged_now)
48654928
call shr_cal_ymds2rday_offset(etime=etime_curr, &
48664929
rdays_offset = tbnds1_offset, &
48674930
years_offset = -1)
4931+
4932+
call t_startf('CPL:seq_hist_writeaux-l2x1yrg')
48684933
do eli = 1,num_inst_lnd
48694934
inst_suffix = component_get_suffix(lnd(eli))
48704935
! Use yr_offset=-1 so the file with fields from year 1 has time stamp
@@ -4875,18 +4940,25 @@ subroutine cime_run_write_history(lnd2glc_averaged_now)
48754940
tbnds1_offset = tbnds1_offset, yr_offset=-1, &
48764941
av_to_write=prep_glc_get_l2gacc_lx_one_instance(eli))
48774942
enddo
4943+
call t_stopf('CPL:seq_hist_writeaux-l2x1yrg')
4944+
48784945
endif
48794946
endif
48804947

48814948
if (do_hist_l2x) then
4949+
4950+
call t_startf('CPL:seq_hist_writeaux-l2x')
48824951
do eli = 1,num_inst_lnd
48834952
inst_suffix = component_get_suffix(lnd(eli))
48844953
call seq_hist_writeaux(infodata, EClock_d, lnd(eli), flow='c2x', &
48854954
aname='l2x',dname='doml',inst_suffix=trim(inst_suffix), &
48864955
nx=lnd_nx, ny=lnd_ny, nt=ncpl)
48874956
enddo
4957+
call t_stopf('CPL:seq_hist_writeaux-l2x')
4958+
48884959
endif
48894960

4961+
call t_stopf('CPL:cime_run_write_history')
48904962
call t_drvstopf ('CPL:HISTORY',cplrun=.true.)
48914963

48924964
end if
@@ -4913,24 +4985,30 @@ subroutine cime_run_write_restart(drv_pause, write_restart, drv_resume_file)
49134985
if ( (restart_alarm .or. drv_pause)) then
49144986
call cime_comp_barriers(mpicom=mpicom_CPLID, timer='CPL:RESTART_BARRIER')
49154987
call t_drvstartf ('CPL:RESTART',cplrun=.true.,barrier=mpicom_CPLID)
4988+
call t_startf('CPL:cime_run_write_restart')
4989+
49164990
if (drv_threading) call seq_comm_setnthreads(nthreads_CPLID)
49174991
if (iamroot_CPLID) then
49184992
write(logunit,104) ' Write restart file at ',ymd,tod
49194993
call shr_sys_flush(logunit)
49204994
endif
49214995

4996+
call t_startf('CPL:seq_rest_write')
49224997
call seq_rest_write(EClock_d, seq_SyncClock, infodata, &
49234998
atm, lnd, ice, ocn, rof, glc, wav, esp, iac, &
49244999
fractions_ax, fractions_lx, fractions_ix, fractions_ox, &
49255000
fractions_rx, fractions_gx, fractions_wx, fractions_zx, &
49265001
trim(cpl_inst_tag), drv_resume_file)
5002+
call t_stopf('CPL:seq_rest_write')
49275003

49285004
if (iamroot_CPLID) then
49295005
write(logunit,103) ' Restart filename: ',trim(drv_resume_file)
49305006
call shr_sys_flush(logunit)
49315007
endif
49325008

49335009
if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)
5010+
5011+
call t_stopf('CPL:cime_run_write_restart')
49345012
call t_drvstopf ('CPL:RESTART',cplrun=.true.)
49355013
else
49365014
drv_resume_file = ' '

driver-mct/main/component_mod.F90

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,13 @@ subroutine component_init_aream(infodata, rof_c2_ocn, samegrid_ao, samegrid_al,
495495
dom_s => component_get_dom_cx(ocn(1)) ! dom_ox
496496
dom_d => component_get_dom_cx(atm(1)) ! dom_ax
497497

498+
call t_startf('CPL:seq_map_readdata-ocn2atm')
498499
call seq_map_readdata('seq_maps.rc','ocn2atm_fmapname:', mpicom_CPLID, CPLID, &
499500
gsmap_s=gsmap_s, av_s=dom_s%data, avfld_s='aream', filefld_s='area_a', &
500501
gsmap_d=gsmap_d, av_d=dom_d%data, avfld_d='aream', filefld_d='area_b', &
501502
string='ocn2atm aream initialization')
503+
call t_stopf('CPL:seq_map_readdata-ocn2atm')
504+
502505
endif
503506
end if
504507

@@ -514,13 +517,18 @@ subroutine component_init_aream(infodata, rof_c2_ocn, samegrid_ao, samegrid_al,
514517
gsmap_s => component_get_gsmap_cx(rof(1)) ! gsmap_rx
515518
dom_s => component_get_dom_cx(rof(1)) ! dom_rx
516519

520+
call t_startf('CPL:seq_map_readdata-rof2ocn_liq')
517521
call seq_map_readdata('seq_maps.rc', 'rof2ocn_liq_rmapname:',mpicom_CPLID, CPLID, &
518522
gsmap_s=gsmap_s, av_s=dom_s%data, avfld_s='aream', filefld_s='area_a', &
519523
string='rof2ocn liq aream initialization')
524+
call t_stopf('CPL:seq_map_readdata-rof2ocn_liq')
520525

526+
call t_startf('CPL:seq_map_readdata-rof2ocn_ice')
521527
call seq_map_readdata('seq_maps.rc', 'rof2ocn_ice_rmapname:',mpicom_CPLID, CPLID, &
522528
gsmap_s=gsmap_s, av_s=dom_s%data, avfld_s='aream', filefld_s='area_a', &
523529
string='rof2ocn ice aream initialization')
530+
call t_stopf('CPL:seq_map_readdata-rof2ocn_ice')
531+
524532
endif
525533
end if
526534

@@ -534,9 +542,12 @@ subroutine component_init_aream(infodata, rof_c2_ocn, samegrid_ao, samegrid_al,
534542
gsmap_d => component_get_gsmap_cx(lnd(1)) ! gsmap_lx
535543
dom_d => component_get_dom_cx(lnd(1)) ! dom_lx
536544

545+
call t_startf('CPL:seq_map_readdata-atm2lnd')
537546
call seq_map_readdata('seq_maps.rc','atm2lnd_fmapname:',mpicom_CPLID, CPLID, &
538547
gsmap_d=gsmap_d, av_d=dom_d%data, avfld_d='aream', filefld_d='area_b', &
539548
string='atm2lnd aream initialization')
549+
call t_stopf('CPL:seq_map_readdata-atm2lnd')
550+
540551
endif
541552
end if
542553

@@ -550,9 +561,12 @@ subroutine component_init_aream(infodata, rof_c2_ocn, samegrid_ao, samegrid_al,
550561
gsmap_d => component_get_gsmap_cx(glc(1)) ! gsmap_gx
551562
dom_d => component_get_dom_cx(glc(1)) ! dom_gx
552563

564+
call t_startf('CPL:seq_map_readdata-lnd2glc')
553565
call seq_map_readdata('seq_maps.rc','lnd2glc_fmapname:',mpicom_CPLID, CPLID, &
554566
gsmap_d=gsmap_d, av_d=dom_d%data, avfld_d='aream', filefld_d='area_b', &
555567
string='lnd2glc aream initialization')
568+
call t_stopf('CPL:seq_map_readdata-lnd2glc')
569+
556570
endif
557571
endif
558572

0 commit comments

Comments
 (0)