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

A series of minor tweaks #17

Merged
merged 1 commit into from
Oct 6, 2021
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
13 changes: 7 additions & 6 deletions Source/PeleLMAdvance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void PeleLM::Advance(int is_initIter) {
if (m_verbose > 1) {
Real VelAdvEnd = ParallelDescriptor::second() - VelAdvStart;
ParallelDescriptor::ReduceRealMax(VelAdvEnd, ParallelDescriptor::IOProcessorNumber());
amrex::Print() << " - Advance()::VelocityAdvance " << VelAdvEnd << "\n";
amrex::Print() << " - Advance()::VelocityAdvance --> Time: " << VelAdvEnd << "\n";
}
//----------------------------------------------------------------

Expand All @@ -161,14 +161,15 @@ void PeleLM::Advance(int is_initIter) {
{
Real run_time = ParallelDescriptor::second() - strt_time;
ParallelDescriptor::ReduceRealMax(run_time, ParallelDescriptor::IOProcessorNumber());
amrex::Print() << " >> PeleLM::Advance() " << run_time << "\n";
amrex::Print() << " >> PeleLM::Advance() --> Time: " << run_time << "\n";
}
}

void PeleLM::oneSDC(int sdcIter,
std::unique_ptr<AdvanceAdvData> &advData,
std::unique_ptr<AdvanceDiffData> &diffData)
{
BL_PROFILE("PeleLM::oneSDC()");
m_sdcIter = sdcIter;

if (m_verbose > 0) {
Expand Down Expand Up @@ -226,7 +227,7 @@ void PeleLM::oneSDC(int sdcIter,
if (m_verbose > 1) {
Real MACEnd = ParallelDescriptor::second() - MACStart;
ParallelDescriptor::ReduceRealMax(MACEnd, ParallelDescriptor::IOProcessorNumber());
amrex::Print() << " - oneSDC()::MACProjection() " << MACEnd << "\n";
amrex::Print() << " - oneSDC()::MACProjection() --> Time: " << MACEnd << "\n";
}
//----------------------------------------------------------------

Expand All @@ -250,7 +251,7 @@ void PeleLM::oneSDC(int sdcIter,
if (m_verbose > 1) {
Real ScalAdvEnd = ParallelDescriptor::second() - ScalAdvStart;
ParallelDescriptor::ReduceRealMax(ScalAdvEnd, ParallelDescriptor::IOProcessorNumber());
amrex::Print() << " - oneSDC()::ScalarAdvection() " << ScalAdvEnd << "\n";
amrex::Print() << " - oneSDC()::ScalarAdvection() --> Time: " << ScalAdvEnd << "\n";
}
//----------------------------------------------------------------

Expand All @@ -269,7 +270,7 @@ void PeleLM::oneSDC(int sdcIter,
if (m_verbose > 1) {
Real ScalDiffEnd = ParallelDescriptor::second() - ScalDiffStart;
ParallelDescriptor::ReduceRealMax(ScalDiffEnd, ParallelDescriptor::IOProcessorNumber());
amrex::Print() << " - oneSDC()::ScalarDiffusion() " << ScalDiffEnd << "\n";
amrex::Print() << " - oneSDC()::ScalarDiffusion() --> Time: " << ScalDiffEnd << "\n";
}
//----------------------------------------------------------------

Expand All @@ -295,7 +296,7 @@ void PeleLM::oneSDC(int sdcIter,
if (m_verbose > 1) {
Real ScalReacEnd = ParallelDescriptor::second() - ScalReacStart;
ParallelDescriptor::ReduceRealMax(ScalReacEnd, ParallelDescriptor::IOProcessorNumber());
amrex::Print() << " - oneSDC()::ScalarReaction() " << ScalReacEnd << "\n";
amrex::Print() << " - oneSDC()::ScalarReaction() --> Time: " << ScalReacEnd << "\n";
}
//----------------------------------------------------------------

Expand Down
14 changes: 7 additions & 7 deletions Source/PeleLMBC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@ PeleLM::fetchBCRecArray(int scomp, int ncomp) {

// Fill the entire class state at once
void PeleLM::fillPatchState(const TimeStamp &a_time) {
BL_PROFILE_VAR("PeleLM::fillPatchState()", fillPatchState);
BL_PROFILE("PeleLM::fillPatchState()");
for (int lev = 0; lev <= finest_level; lev++) {
fillPatchState(lev,a_time);
}
}

// Fill the a given level class state
void PeleLM::fillPatchState(int lev, const TimeStamp &a_time) {
BL_PROFILE_VAR("PeleLM::fillPatchStateLev()", fillPatchStateLev);
BL_PROFILE("PeleLM::fillPatchStateLev()");

auto ldata_p = getLevelDataPtr(lev,a_time);
Real time = getTime(lev, a_time);
Expand All @@ -231,7 +231,7 @@ void PeleLM::fillPatchState(int lev, const TimeStamp &a_time) {

// Fill a state components
void PeleLM::fillPatchDensity(const TimeStamp &a_time) {
BL_PROFILE_VAR("PeleLM::fillPatchDensity()", fillPatchDensity);
BL_PROFILE("PeleLM::fillPatchDensity()");
for (int lev = 0; lev <= finest_level; lev++) {
auto ldata_p = getLevelDataPtr(lev,a_time);
Real time = getTime(lev, a_time);
Expand All @@ -240,7 +240,7 @@ void PeleLM::fillPatchDensity(const TimeStamp &a_time) {
}

void PeleLM::fillPatchSpecies(const TimeStamp &a_time) {
BL_PROFILE_VAR("PeleLM::fillPatchSpecies()", fillPatchSpecies);
BL_PROFILE("PeleLM::fillPatchSpecies()");
for (int lev = 0; lev <= finest_level; lev++) {
auto ldata_p = getLevelDataPtr(lev,a_time);
Real time = getTime(lev, a_time);
Expand All @@ -249,7 +249,7 @@ void PeleLM::fillPatchSpecies(const TimeStamp &a_time) {
}

void PeleLM::fillPatchTemp(const TimeStamp &a_time) {
BL_PROFILE_VAR("PeleLM::fillPatchTemp()", fillPatchTemp);
BL_PROFILE("PeleLM::fillPatchTemp()");
for (int lev = 0; lev <= finest_level; lev++) {
auto ldata_p = getLevelDataPtr(lev,a_time);
Real time = getTime(lev, a_time);
Expand All @@ -259,7 +259,7 @@ void PeleLM::fillPatchTemp(const TimeStamp &a_time) {

#ifdef PLM_USE_EFIELD
void PeleLM::fillPatchPhiV(const TimeStamp &a_time) {
BL_PROFILE_VAR("PeleLM::fillPatchPhiV()", fillPatchPhiV);
BL_PROFILE("PeleLM::fillPatchPhiV()");
for (int lev = 0; lev <= finest_level; lev++) {
auto ldata_p = getLevelDataPtr(lev,a_time);
Real time = getTime(lev, a_time);
Expand All @@ -274,7 +274,7 @@ void PeleLM::fillPatchPhiV(const TimeStamp &a_time) {
// Fill the entire state at once
std::unique_ptr<MultiFab>
PeleLM::fillPatchState(int lev, Real a_time, int nGrow) {
BL_PROFILE_VAR("PeleLM::fillPatchState()", fillPatchState);
BL_PROFILE("PeleLM::fillPatchState()");

std::unique_ptr<MultiFab> mf;
mf.reset(new MultiFab(grids[lev], dmap[lev], NVAR, nGrow));
Expand Down
2 changes: 1 addition & 1 deletion Source/PeleLMEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using namespace amrex;

void PeleLM::Evolve() {
BL_PROFILE_VAR("PeleLM::Evolve()", Evolve);
BL_PROFILE("PeleLM::Evolve()");

bool do_not_evolve = ( (m_max_step == 0) ||
((m_stop_time >= 0.) && (m_cur_time > m_stop_time)) );
Expand Down
2 changes: 1 addition & 1 deletion Source/PeleLMForces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void PeleLM::getVelForces(const TimeStamp &a_time,

int has_divTau = (a_divTau != nullptr);

#ifdef _OPENMP
#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
for (MFIter mfi(*a_velForce,TilingIfNotGPU()); mfi.isValid(); ++mfi)
Expand Down
8 changes: 7 additions & 1 deletion Source/PeleLMInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ void PeleLM::MakeNewLevelFromScratch( int lev,

if (m_verbose > 0) {
amrex::Print() << " Making new level " << lev << " from scratch" << std::endl;
if (m_verbose > 2) {
if (m_verbose > 2 && lev > 0) {
auto const dx = geom[lev].CellSizeArray();
Real vol = AMREX_D_TERM(dx[0],*dx[1],*dx[2]);
amrex::Print() << " with " << ba.numPts() << " cells,"
<< " over " << ba.numPts() * vol / geom[0].ProbSize() * 100 << "% of the domain \n";
}
if (m_verbose > 3 && lev > 0) {
amrex::Print() << " with BoxArray " << ba << std::endl;
}
}
Expand Down
6 changes: 5 additions & 1 deletion Source/PeleLMPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ void PeleLM::WriteJobInfo(const std::string& path) const
jobInfoFile << PrettyLine;

jobInfoFile << "number of MPI processes: " << ParallelDescriptor::NProcs() << "\n";
#ifdef _OPENMP
#ifdef AMREX_USE_OMP
jobInfoFile << "number of threads: " << omp_get_max_threads() << "\n";
#endif

Expand Down Expand Up @@ -541,6 +541,7 @@ void PeleLM::WriteJobInfo(const std::string& path) const
const char* githash1 = buildInfoGetGitHash(1);
const char* githash2 = buildInfoGetGitHash(2);
const char* githash3 = buildInfoGetGitHash(3);
const char* githash4 = buildInfoGetGitHash(4);

if (strlen(githash1) > 0) {
jobInfoFile << "PeleLMeX git describe: " << githash1 << "\n";
Expand All @@ -551,6 +552,9 @@ void PeleLM::WriteJobInfo(const std::string& path) const
if (strlen(githash3) > 0) {
jobInfoFile << "PelePhysics git describe: " << githash3 << "\n";
}
if (strlen(githash4) > 0) {
jobInfoFile << "AMREX-Hydro git describe: " << githash3 << "\n";
}

jobInfoFile << "\n\n";

Expand Down
8 changes: 4 additions & 4 deletions Source/PeleLMReactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace amrex;

void PeleLM::advanceChemistry(std::unique_ptr<AdvanceAdvData> &advData)
{
BL_PROFILE_VAR("PeleLM::advanceChemistry()", advanceChemistry);
BL_PROFILE("PeleLM::advanceChemistry()");

for (int lev = finest_level; lev >= 0; --lev) {

Expand All @@ -27,13 +27,10 @@ void PeleLM::advanceChemistry(std::unique_ptr<AdvanceAdvData> &advData)
*avgDownIR,
0,nCompIR(),refRatio(lev));
#endif
//VisMF::Write(*avgDownIR,"AvgDownIR_Level"+std::to_string(lev)+"_step"+std::to_string(m_nstep));
//VisMF::Write(advData->Forcing[lev],"ChemForcing_Level"+std::to_string(lev)+"_step"+std::to_string(m_nstep));
advanceChemistry(lev, m_dt, advData->Forcing[lev], avgDownIR.get());
} else {
advanceChemistry(lev, m_dt, advData->Forcing[lev]);
}
//VisMF::Write(m_leveldatareact[lev]->I_R,"FinalIR_Level"+std::to_string(lev)+"_step"+std::to_string(m_nstep));
}
}

Expand All @@ -44,6 +41,8 @@ void PeleLM::advanceChemistry(int lev,
const Real &a_dt,
MultiFab &a_extForcing)
{
BL_PROFILE("PeleLM::advanceChemistry_Lev"+std::to_string(lev)+"()");

auto ldataOld_p = getLevelDataPtr(lev,AmrOldTime);
auto ldataNew_p = getLevelDataPtr(lev,AmrNewTime);
auto ldataR_p = getLevelDataReactPtr(lev);
Expand Down Expand Up @@ -186,6 +185,7 @@ void PeleLM::advanceChemistry(int lev,
MultiFab &a_extForcing,
MultiFab *a_avgDownIR)
{
BL_PROFILE("PeleLM::advanceChemistry_Lev"+std::to_string(lev)+"()");
AMREX_ASSERT(a_avgDownIR != nullptr);

auto ldataOld_p = getLevelDataPtr(lev,AmrOldTime);
Expand Down
12 changes: 12 additions & 0 deletions Source/PeleLMRegrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ void PeleLM::MakeNewLevelFromCoarse( int lev,
if (m_verbose > 0) {
Print() << " Making new level " << lev << " from coarse\n";
if (m_verbose > 2) {
auto const dx = geom[lev].CellSizeArray();
Real vol = AMREX_D_TERM(dx[0],*dx[1],*dx[2]);
amrex::Print() << " with " << ba.numPts() << " cells,"
<< " over " << ba.numPts() * vol / geom[0].ProbSize() * 100 << "% of the domain \n";
}
if (m_verbose > 3) {
amrex::Print() << " with BoxArray " << ba << std::endl;
}
}
Expand Down Expand Up @@ -96,6 +102,12 @@ void PeleLM::RemakeLevel( int lev,
if (m_verbose > 0) {
Print() << " Remaking level " << lev << "\n";
if (m_verbose > 2) {
auto const dx = geom[lev].CellSizeArray();
Real vol = AMREX_D_TERM(dx[0],*dx[1],*dx[2]);
amrex::Print() << " with " << ba.numPts() << " cells,"
<< " over " << ba.numPts() * vol / geom[0].ProbSize() * 100 << "% of the domain \n";
}
if (m_verbose > 3) {
amrex::Print() << " with BoxArray " << ba << std::endl;
}
}
Expand Down
13 changes: 13 additions & 0 deletions Source/PeleLMSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <AMReX_ParmParse.H>
#include <PeleLMDeriveFunc.H>
#include "PelePhysics.H"
#include <AMReX_buildInfo.H>
#ifdef PLM_USE_EFIELD
#include "EOS_Extension.H"
#endif
Expand All @@ -23,6 +24,18 @@ void PeleLM::Setup() {
sundials::MemoryHelper::Initialize();
#endif

// Print build info to screen
const char* githash1 = buildInfoGetGitHash(1);
const char* githash2 = buildInfoGetGitHash(2);
const char* githash3 = buildInfoGetGitHash(3);
const char* githash4 = buildInfoGetGitHash(4);
amrex::Print() << "\n ================= Build infos =================\n";
amrex::Print() << " PeleLMeX git hash: " << githash1 << "\n";
amrex::Print() << " AMReX git hash: " << githash2 << "\n";
amrex::Print() << " PelePhysics git hash: " << githash3 << "\n";
amrex::Print() << " AMReX-Hydro git hash: " << githash4 << "\n";
amrex::Print() << " ===============================================\n";

// Read PeleLM parameters
readParameters();

Expand Down
2 changes: 1 addition & 1 deletion Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int main(int argc, char* argv[]) {
}

// timer for profiling
BL_PROFILE_VAR("main()", main);
BL_PROFILE_VAR("PeleLM::main()", main);

// wallclock time
const Real strt_total = ParallelDescriptor::second();
Expand Down