Skip to content

Commit

Permalink
Add some more stdout timers for gravity (#2506)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxpkatz authored Jun 18, 2023
1 parent f64dbaf commit 8698f73
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Source/gravity/Castro_gravity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -109,13 +111,31 @@ 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
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);

Expand Down Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions Source/gravity/Gravity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<AMREX_SPACEDIM; ++n)
Expand All @@ -716,6 +718,21 @@ Gravity::multilevel_solve_for_new_phi (int level, int finest_level_in)

int is_new = 1;
actual_multilevel_solve(level, finest_level_in, amrex::GetVecOfVecOfPtrs(grad_phi_curr), is_new);

if (gravity::verbose)
{
const int IOProc = ParallelDescriptor::IOProcessorNumber();
Real end = ParallelDescriptor::second() - strt;

#ifdef BL_LAZY
Lazy::QueueReduction( [=] () mutable {
#endif
ParallelDescriptor::ReduceRealMax(end,IOProc);
amrex::Print() << "Gravity::multilevel_solve_for_new_phi() time = " << end << std::endl << std::endl;
#ifdef BL_LAZY
});
#endif
}
}

void
Expand Down

0 comments on commit 8698f73

Please sign in to comment.