From 96de61548c9a4c49313020046548e1db8694d62e Mon Sep 17 00:00:00 2001 From: Antoine Hoffmann <antoine.hoffmann@epfl.ch> Date: Mon, 7 Aug 2023 19:15:38 +0200 Subject: [PATCH] add timer for ExB SF routines --- matlab/profiler.m | 21 ++++++++++++++------- src/basic_mod.F90 | 4 +++- src/diagnose.F90 | 4 +++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/matlab/profiler.m b/matlab/profiler.m index 43a3713a..817c939a 100644 --- a/matlab/profiler.m +++ b/matlab/profiler.m @@ -3,8 +3,8 @@ function [] = profiler(data) % filename = sprintf([BASIC.RESDIR,'outputs_%.2d.h5'],00); % outfilename = ['/misc/HeLaZ_outputs',filename(3:end)]; CPUTI=[]; DTSIM=[]; RHSTC=[]; POITC=[]; SAPTC=[]; COLTC=[]; -GRATC=[]; NADTC=[]; ADVTC=[]; GHOTC=[]; CLOTC=[]; CHKTC=[]; -DIATC=[]; STETC=[]; TS0TC=[]; +GRATC=[]; NADTC=[]; ADVTC=[]; GHOTC=[]; CLOTC=[]; CHKTC=[]; +DIATC=[]; EXBTC=[]; STETC=[]; TS0TC=[]; for i = 1:numel(data.outfilenames) outfilename = data.outfilenames{i}; CPUTI = [ CPUTI; double(h5readatt(outfilename,'/data/input','cpu_time'))]; @@ -13,6 +13,11 @@ for i = 1:numel(data.outfilenames) RHSTC = [ RHSTC; h5read(outfilename,'/profiler/Tc_rhs')]; POITC = [ POITC; h5read(outfilename,'/profiler/Tc_poisson')]; SAPTC = [ SAPTC; h5read(outfilename,'/profiler/Tc_Sapj')]; + try + EXBTC = [ EXBTC; h5read(outfilename,'/profiler/Tc_ExBshear')]; + catch + EXBTC = 0.*SAPTC; + end COLTC = [ COLTC; h5read(outfilename,'/profiler/Tc_coll')]; GRATC = [ GRATC; h5read(outfilename,'/profiler/Tc_grad')]; NADTC = [ NADTC; h5read(outfilename,'/profiler/Tc_nadiab')]; @@ -26,14 +31,14 @@ for i = 1:numel(data.outfilenames) end CPUTI = CPUTI(end); DTSIM = mean(DTSIM); -N_T = 12; +N_T = 13; -missing_Tc = STETC - RHSTC - ADVTC - GHOTC - CLOTC ... +missing_Tc = STETC - RHSTC - ADVTC - GHOTC - CLOTC - EXBTC ... -COLTC - POITC - SAPTC - CHKTC - DIATC - GRATC - NADTC; total_Tc = STETC; TIME_PER_FCT = [diff(RHSTC); diff(ADVTC); diff(GHOTC);... - diff(CLOTC); diff(COLTC); diff(POITC); diff(SAPTC); ... + diff(CLOTC); diff(COLTC); diff(POITC); diff(SAPTC); diff(EXBTC); ... diff(CHKTC); diff(DIATC); diff(GRATC); diff(NADTC); diff(missing_Tc)]; TIME_PER_FCT = reshape(TIME_PER_FCT,[numel(TIME_PER_FCT)/N_T,N_T]); @@ -47,6 +52,7 @@ clos_Ta = mean(diff(CLOTC)); coll_Ta = mean(diff(COLTC)); poisson_Ta = mean(diff(POITC)); Sapj_Ta = mean(diff(SAPTC)); +ExB_Ta = mean(diff(EXBTC)); checkfield_Ta = mean(diff(CHKTC)); grad_Ta = mean(diff(GRATC)); nadiab_Ta = mean(diff(NADTC)); @@ -61,14 +67,15 @@ names = {... 'Capj'; 'Pois'; 'Sapj'; + 'ExBs'; 'Chck'; 'Diag'; 'Grad'; 'napj'; 'Miss'; }; -Ts_A = [rhs_Ta adv_field_Ta ghost_Ta clos_Ta coll_Ta... - poisson_Ta Sapj_Ta checkfield_Ta diag_Ta grad_Ta nadiab_Ta miss_Ta]; +Ts_A = [rhs_Ta adv_field_Ta ghost_Ta clos_Ta coll_Ta poisson_Ta... + Sapj_Ta ExB_Ta checkfield_Ta diag_Ta grad_Ta nadiab_Ta miss_Ta]; NSTEP_PER_SAMP= mean(diff(TS0TC))/DTSIM; %% Plots diff --git a/src/basic_mod.F90 b/src/basic_mod.F90 index 0c45dd45..fb34690a 100644 --- a/src/basic_mod.F90 +++ b/src/basic_mod.F90 @@ -34,7 +34,8 @@ MODULE basic end type chrono ! Define the chronos for each relevant routines type(chrono), PUBLIC, PROTECTED :: chrono_runt, chrono_mrhs, chrono_advf, chrono_pois, chrono_sapj,& - chrono_diag, chrono_chck, chrono_step, chrono_clos, chrono_ghst, chrono_coll, chrono_napj, chrono_grad + chrono_diag, chrono_chck, chrono_step, chrono_clos, chrono_ghst, chrono_coll, chrono_napj, & + chrono_grad, chrono_ExBs #ifdef TEST_SVD ! A chrono for SVD tests type(chrono), PUBLIC, PROTECTED :: chrono_CLA @@ -86,6 +87,7 @@ CONTAINS chrono_chck%ttot = 0 chrono_diag%ttot = 0 chrono_step%ttot = 0 + chrono_ExBs%ttot = 0 #ifdef TEST_SVD chrono_CLA%ttot = 0 #endif diff --git a/src/diagnose.F90 b/src/diagnose.F90 index 1f77b3e2..351acccd 100644 --- a/src/diagnose.F90 +++ b/src/diagnose.F90 @@ -132,11 +132,12 @@ SUBROUTINE diagnose_full(kstep) CALL creatd(fidres, 0, dims, "/profiler/Tc_coll", "cumulative collision computation time") CALL creatd(fidres, 0, dims, "/profiler/Tc_grad", "cumulative grad computation time") CALL creatd(fidres, 0, dims, "/profiler/Tc_nadiab", "cumulative nadiab moments computation time") + CALL creatd(fidres, 0, dims, "/profiler/Tc_ExBshear", "cumulative ExB shear time") CALL creatd(fidres, 0, dims, "/profiler/Tc_adv_field", "cumulative adv. fields computation time") CALL creatd(fidres, 0, dims, "/profiler/Tc_ghost", "cumulative communication time") CALL creatd(fidres, 0, dims, "/profiler/Tc_clos", "cumulative closure computation time") CALL creatd(fidres, 0, dims, "/profiler/Tc_checkfield", "cumulative checkfield computation time") - CALL creatd(fidres, 0, dims, "/profiler/Tc_diag", "cumulative sym computation time") + CALL creatd(fidres, 0, dims, "/profiler/Tc_diag", "cumulative diagnostic time") CALL creatd(fidres, 0, dims, "/profiler/Tc_step", "cumulative total step computation time") CALL creatd(fidres, 0, dims, "/profiler/time", "current simulation time") #ifdef TEST_SVD @@ -349,6 +350,7 @@ SUBROUTINE diagnose_0d CALL append(fidres, "/profiler/Tc_diag", REAL(chrono_diag%ttot,dp),ionode=0) CALL append(fidres, "/profiler/Tc_grad", REAL(chrono_grad%ttot,dp),ionode=0) CALL append(fidres, "/profiler/Tc_nadiab", REAL(chrono_napj%ttot,dp),ionode=0) + CALL append(fidres, "/profiler/Tc_ExBshear", REAL(chrono_ExBs%ttot,dp),ionode=0) CALL append(fidres, "/profiler/Tc_step", REAL(chrono_step%ttot,dp),ionode=0) #ifdef TEST_SVD CALL append(fidres, "/profiler/Tc_CLA", REAL(chrono_CLA%ttot,dp),ionode=0) -- GitLab