From 8698f7367d74136ac80e3c52afa923ff2977d711 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sun, 18 Jun 2023 17:21:57 -0400 Subject: [PATCH] Add some more stdout timers for gravity (#2506) --- Source/gravity/Castro_gravity.cpp | 35 +++++++++++++++++++++++++++++++ Source/gravity/Gravity.cpp | 17 +++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/Source/gravity/Castro_gravity.cpp b/Source/gravity/Castro_gravity.cpp index ed6f129495..f0cecf9f44 100644 --- a/Source/gravity/Castro_gravity.cpp +++ b/Source/gravity/Castro_gravity.cpp @@ -15,6 +15,8 @@ Castro::construct_old_gravity (Real time) { BL_PROFILE("Castro::construct_old_gravity()"); + const Real strt_time = ParallelDescriptor::second(); + MultiFab& grav_old = get_old_data(Gravity_Type); MultiFab& phi_old = get_old_data(PhiGrav_Type); @@ -109,6 +111,22 @@ Castro::construct_old_gravity (Real time) // Define the old gravity vector. gravity->get_old_grav_vector(level, grav_old, time); + + if (verbose > 0) + { + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + Real run_time = ParallelDescriptor::second() - strt_time; + +#ifdef BL_LAZY + Lazy::QueueReduction( [=] () mutable { +#endif + ParallelDescriptor::ReduceRealMax(run_time,IOProc); + + amrex::Print() << "Castro::construct_old_gravity() time = " << run_time << "\n" << "\n"; +#ifdef BL_LAZY + }); +#endif + } } void @@ -116,6 +134,8 @@ Castro::construct_new_gravity (Real time) { BL_PROFILE("Castro::construct_new_gravity()"); + const Real strt_time = ParallelDescriptor::second(); + MultiFab& grav_new = get_new_data(Gravity_Type); MultiFab& phi_new = get_new_data(PhiGrav_Type); @@ -232,6 +252,21 @@ Castro::construct_new_gravity (Real time) } + if (verbose > 0) + { + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + Real run_time = ParallelDescriptor::second() - strt_time; + +#ifdef BL_LAZY + Lazy::QueueReduction( [=] () mutable { +#endif + ParallelDescriptor::ReduceRealMax(run_time,IOProc); + + amrex::Print() << "Castro::construct_new_gravity() time = " << run_time << "\n" << "\n"; +#ifdef BL_LAZY + }); +#endif + } } void Castro::construct_old_gravity_source(MultiFab& source, MultiFab& state_in, Real time, Real dt) diff --git a/Source/gravity/Gravity.cpp b/Source/gravity/Gravity.cpp index 4f7b5ddd7c..cb7d1c1c95 100644 --- a/Source/gravity/Gravity.cpp +++ b/Source/gravity/Gravity.cpp @@ -705,6 +705,8 @@ Gravity::multilevel_solve_for_new_phi (int level, int finest_level_in) amrex::Print() << "... multilevel solve for new phi at base level " << level << " to finest level " << finest_level_in << std::endl; } + const Real strt = ParallelDescriptor::second(); + for (int lev = level; lev <= finest_level_in; lev++) { BL_ASSERT(grad_phi_curr[lev].size()==AMREX_SPACEDIM); for (int n=0; n