Skip to content

Commit

Permalink
cleaning up comments and some reorganizing
Browse files Browse the repository at this point in the history
  • Loading branch information
mukul1992 committed Jun 27, 2023
1 parent d29b951 commit cf37d78
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 59 deletions.
58 changes: 25 additions & 33 deletions Src/Base/AMReX_Arena.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ Arena::Initialize ()
BL_ASSERT(the_managed_arena == nullptr || the_managed_arena == The_BArena());
BL_ASSERT(the_pinned_arena == nullptr);
BL_ASSERT(the_cpu_arena == nullptr || the_cpu_arena == The_BArena());
BL_ASSERT(the_comms_arena == nullptr || the_comms_arena == The_BArena());

#ifdef AMREX_USE_GPU
#ifdef AMREX_USE_SYCL
Expand Down Expand Up @@ -366,15 +367,6 @@ Arena::Initialize ()
(the_pinned_arena_release_threshold));
the_pinned_arena->registerForProfiling("Pinned Memory");

/*
if (!(the_arena->isDevice())) {
the_comms_arena = the_device_arena;
} else {
the_comms_arena = new CArena(0, ArenaInfo{}.SetDeviceMemory().SetReleaseThreshold
(the_comms_arena_release_threshold));
the_comms_arena->registerForProfiling("Comms Memory");
} */

#ifdef AMREX_USE_GPU
if (ParallelDescriptor::UseGpuAwareMpi()) {
if (!(the_arena->isDevice())) {
Expand Down Expand Up @@ -471,19 +463,19 @@ Arena::PrintUsage ()
p->PrintUsage("The Managed Arena");
}
}
if (The_Comms_Arena() && The_Comms_Arena() != The_Device_Arena()
&& The_Comms_Arena() != The_Pinned_Arena()) {
auto* p = dynamic_cast<CArena*>(The_Comms_Arena());
if (p) {
p->PrintUsage("The Comms Arena");
}
}
if (The_Pinned_Arena()) {
auto* p = dynamic_cast<CArena*>(The_Pinned_Arena());
if (p) {
p->PrintUsage("The Pinned Arena");
}
}
if (The_Comms_Arena() && The_Comms_Arena() != The_Device_Arena()
&& The_Comms_Arena() != The_Pinned_Arena()) {
auto* p = dynamic_cast<CArena*>(The_Comms_Arena());
if (p) {
p->PrintUsage("The Comms Arena");
}
}
}

void
Expand Down Expand Up @@ -523,19 +515,19 @@ Arena::PrintUsageToFiles (const std::string& filename, const std::string& messag
p->PrintUsage(ofs, "The Managed Arena", " ");
}
}
if (The_Comms_Arena() && The_Comms_Arena() != The_Device_Arena()
&& The_Comms_Arena() != The_Pinned_Arena()) {
auto* p = dynamic_cast<CArena*>(The_Comms_Arena());
if (p) {
p->PrintUsage(ofs, "The Comms Arena", " ");
}
}
if (The_Pinned_Arena()) {
auto* p = dynamic_cast<CArena*>(The_Pinned_Arena());
if (p) {
p->PrintUsage(ofs, "The Pinned Arena", " ");
}
}
if (The_Comms_Arena() && The_Comms_Arena() != The_Device_Arena()
&& The_Comms_Arena() != The_Pinned_Arena()) {
auto* p = dynamic_cast<CArena*>(The_Comms_Arena());
if (p) {
p->PrintUsage(ofs, "The Comms Arena", " ");
}
}

ofs << "\n";
}
Expand Down Expand Up @@ -638,16 +630,6 @@ The_Managed_Arena ()
}
}

Arena*
The_Comms_Arena ()
{
if (the_comms_arena) {
return the_comms_arena;
} else {
return The_Null_Arena();
}
}

Arena*
The_Pinned_Arena ()
{
Expand All @@ -668,4 +650,14 @@ The_Cpu_Arena ()
}
}

Arena*
The_Comms_Arena ()
{
if (the_comms_arena) {
return the_comms_arena;
} else {
return The_Null_Arena();
}
}

}
2 changes: 0 additions & 2 deletions Src/Base/AMReX_FabArrayBase.H
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,6 @@ bool CheckRcvStats (Vector<MPI_Status>& recv_stats, const Vector<std::size_t>& r

std::ostream& operator<< (std::ostream& os, const FabArrayBase::BDKey& id);

//Arena* The_FA_Arena ();

}

#endif
24 changes: 0 additions & 24 deletions Src/Base/AMReX_FabArrayBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ std::vector<std::string> FabArrayBase::m_region_tag;

namespace
{
//Arena* the_fa_arena = nullptr;
bool initialized = false;
}

Expand Down Expand Up @@ -123,19 +122,6 @@ FabArrayBase::Initialize ()
MaxComp = 1;
}

/*
#ifdef AMREX_USE_GPU
if (ParallelDescriptor::UseGpuAwareMpi()) {
// the_fa_arena = The_Device_Arena();
the_fa_arena = The_Comms_Arena();
} else {
the_fa_arena = The_Pinned_Arena();
}
#else
the_fa_arena = The_Cpu_Arena();
#endif
*/

amrex::ExecOnFinalize(FabArrayBase::Finalize);

#ifdef AMREX_MEM_PROFILING
Expand All @@ -162,14 +148,6 @@ FabArrayBase::Initialize ()
#endif
}

/*
Arena*
The_FA_Arena ()
{
return the_fa_arena;
}
*/

FabArrayBase::FabArrayBase (const BoxArray& bxs,
const DistributionMapping& dm,
int nvar,
Expand Down Expand Up @@ -2250,8 +2228,6 @@ FabArrayBase::Finalize ()

m_FA_stats = FabArrayStats();

//the_fa_arena = nullptr;

initialized = false;
}

Expand Down

0 comments on commit cf37d78

Please sign in to comment.