Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some more stdout timers for gravity #2506

Merged
merged 2 commits into from
Jun 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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