From 8072a6d3eedf0032d451c20f842cc9ec3d17c6d0 Mon Sep 17 00:00:00 2001 From: Antoine Hoffmann <antoine.hoffmann@epfl.ch> Date: Mon, 14 Nov 2022 09:32:54 +0100 Subject: [PATCH] Fixing integrated profiler in the code (still some time is missing) --- matlab/profiler.m | 13 +++++++------ src/basic_mod.F90 | 15 +++++++++++---- src/diagnose.F90 | 10 +++++----- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/matlab/profiler.m b/matlab/profiler.m index a8184e13..86d73e4d 100644 --- a/matlab/profiler.m +++ b/matlab/profiler.m @@ -7,15 +7,15 @@ DT_SIM = h5readatt(outfilename,'/data/input','dt'); rhs_Tc = h5read(outfilename,'/profiler/Tc_rhs'); +poisson_Tc = h5read(outfilename,'/profiler/Tc_poisson'); +Sapj_Tc = h5read(outfilename,'/profiler/Tc_Sapj'); +coll_Tc = h5read(outfilename,'/profiler/Tc_coll'); +process_Tc = h5read(outfilename,'/profiler/Tc_process'); adv_field_Tc = h5read(outfilename,'/profiler/Tc_adv_field'); ghost_Tc = h5read(outfilename,'/profiler/Tc_ghost'); clos_Tc = h5read(outfilename,'/profiler/Tc_clos'); -coll_Tc = h5read(outfilename,'/profiler/Tc_coll'); -poisson_Tc = h5read(outfilename,'/profiler/Tc_poisson'); -Sapj_Tc = h5read(outfilename,'/profiler/Tc_Sapj'); checkfield_Tc= h5read(outfilename,'/profiler/Tc_checkfield'); diag_Tc = h5read(outfilename,'/profiler/Tc_diag'); -process_Tc = h5read(outfilename,'/profiler/Tc_process'); step_Tc = h5read(outfilename,'/profiler/Tc_step'); Ts0D = h5read(outfilename,'/profiler/time'); @@ -65,9 +65,10 @@ FIGNAME = 'profiler'; else %% Normalized Area plot fig = figure; - +colors = colorcube(N_T); p1 = area(Ts0D(2:end),100*TIME_PER_FCT./diff(total_Tc),'LineStyle','none', 'FaceColor','flat'); -for i = 1:N_T; p1(i).FaceColor = rand(1,3); end; +% for i = 1:N_T; p1(i).FaceColor = rand(1,3); end; +for i = 1:N_T; p1(i).FaceColor = colors(i,:); end; legend('Compute RHS','Adv. fields','ghosts comm', 'closure', 'collision','Poisson','Nonlin','Check+sym', 'Diagnos.', 'Missing') xlabel('Sim. Time'); ylabel('Step Comp. Time [\%]') ylim([0,100]); xlim([Ts0D(2),Ts0D(end)]); diff --git a/src/basic_mod.F90 b/src/basic_mod.F90 index ece5f9b1..c0ae90b5 100644 --- a/src/basic_mod.F90 +++ b/src/basic_mod.F90 @@ -86,10 +86,17 @@ CONTAINS READ(lu_in,basic) !Init cumulative timers - tc_rhs = 0.; tc_adv_field = 0.; tc_poisson = 0. - tc_Sapj = 0.; tc_diag = 0.; tc_checkfield = 0. - tc_ghost = 0.; tc_coll = 0.; tc_process = 0. - tc_clos = 0.; tc_step = 0.; + tc_rhs = 0. + tc_poisson = 0. + tc_Sapj = 0. + tc_coll = 0. + tc_process = 0. + tc_adv_field = 0. + tc_ghost = 0. + tc_clos = 0. + tc_checkfield = 0. + tc_diag = 0. + tc_step = 0. END SUBROUTINE basic_data diff --git a/src/diagnose.F90 b/src/diagnose.F90 index 912baa9e..008b4f52 100644 --- a/src/diagnose.F90 +++ b/src/diagnose.F90 @@ -124,15 +124,15 @@ SUBROUTINE diagnose_full(kstep) ! Profiler time measurement CALL creatg(fidres, "/profiler", "performance analysis") CALL creatd(fidres, 0, dims, "/profiler/Tc_rhs", "cumulative rhs computation time") - CALL creatd(fidres, 0, dims, "/profiler/Tc_adv_field", "cumulative adv. fields computation time") - CALL creatd(fidres, 0, dims, "/profiler/Tc_clos", "cumulative closure computation time") - CALL creatd(fidres, 0, dims, "/profiler/Tc_ghost", "cumulative communication time") - CALL creatd(fidres, 0, dims, "/profiler/Tc_coll", "cumulative collision computation time") CALL creatd(fidres, 0, dims, "/profiler/Tc_poisson", "cumulative poisson computation time") CALL creatd(fidres, 0, dims, "/profiler/Tc_Sapj", "cumulative Sapj computation time") + CALL creatd(fidres, 0, dims, "/profiler/Tc_coll", "cumulative collision computation time") + CALL creatd(fidres, 0, dims, "/profiler/Tc_process", "cumulative process computation 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_process", "cumulative process computation time") CALL creatd(fidres, 0, dims, "/profiler/Tc_step", "cumulative total step computation time") CALL creatd(fidres, 0, dims, "/profiler/time", "current simulation time") -- GitLab