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

WARN_ALL #1176

Merged
merged 2 commits into from
Jul 23, 2020
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
5 changes: 5 additions & 0 deletions Docs/sphinx_documentation/source/BuildingAMReX.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ list of important variables.
+------------+-------------------------------------+--------------------+
| USE_RPATH | TRUE or FALSE | FALSE |
+------------+-------------------------------------+--------------------+
| WARN_ALL | TRUE or FALSE | TRUE for DEBUG |
| | | FALSE otherwise |
+------------+-------------------------------------+--------------------+

.. raw:: latex

Expand Down Expand Up @@ -109,6 +112,8 @@ If enabled, the library path at link time will be saved as a
When disabled, dynamic library paths could be provided via ``export LD_LIBRARY_PATH``
hints at runtime.

For GCC and Clang, the variable ``WARN_ALL`` controls the compiler's warning options.

After defining these make variables, a number of files, ``Make.defs,
Make.package`` and ``Make.rules``, are included in the GNUmakefile. AMReX-based
applications do not need to include all directories in AMReX; an application
Expand Down
4 changes: 4 additions & 0 deletions Src/AmrCore/AMReX_Cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class InBox
public:
explicit InBox (const Box& b) noexcept : m_box(b) {}

// You might see compiler warning on this is never referenced.
// The compiler is wrong.
bool operator() (const IntVect& iv) const noexcept
{
return m_box.contains(iv);
Expand Down Expand Up @@ -247,6 +249,8 @@ class Cut
public:
Cut (const IntVect& cut, int dir) : m_cut(cut), m_dir(dir) {}

// You might see compiler warning on this is never referenced.
// The compiler is wrong.
bool operator() (const IntVect& iv) const
{
return iv[m_dir] < m_cut[m_dir];
Expand Down
2 changes: 1 addition & 1 deletion Src/AmrCore/AMReX_FluxRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ FluxRegister::FineSetVal (int dir,
int destcomp,
int numcomp,
Real val,
RunOn runon) noexcept
RunOn /*runon*/) noexcept
{
Gpu::LaunchSafeGuard lsg(false); // xxxxx gpu todo

Expand Down
4 changes: 2 additions & 2 deletions Src/AmrCore/AMReX_Interp_3D_C.H
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace amrex {
AMREX_GPU_HOST
inline
Vector<Real>
ccinterp_compute_voff (Box const& cbx, IntVect const& ratio, Geometry const& cgeom,
Geometry const& fgeom) noexcept
ccinterp_compute_voff (Box const& cbx, IntVect const& ratio, Geometry const& /*cgeom*/,
Geometry const& /*fgeom*/) noexcept
{
const Box& fbx = amrex::refine(cbx,ratio);
const auto& flen = amrex::length(fbx);
Expand Down
20 changes: 10 additions & 10 deletions Src/Base/AMReX_BCUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ namespace amrex

namespace {

void dummy_cpu_fill_extdir (Box const& bx, Array4<Real> const& dest,
const int dcomp, const int numcomp,
GeometryData const& geom, const Real time,
const BCRec* bcr, const int bcomp,
const int orig_comp)
void dummy_cpu_fill_extdir (Box const& /*bx*/, Array4<Real> const& /*dest*/,
const int /*dcomp*/, const int /*numcomp*/,
GeometryData const& /*geom*/, const Real /*time*/,
const BCRec* /*bcr*/, const int /*bcomp*/,
const int /*orig_comp*/)
{
// do something for external Dirichlet (BCType::ext_dir) if there are
}

struct dummy_gpu_fill_extdir
{
AMREX_GPU_DEVICE
void operator() (const IntVect& iv, Array4<Real> const& dest,
const int dcomp, const int numcomp,
GeometryData const& geom, const Real time,
const BCRec* bcr, const int bcomp,
const int orig_comp) const
void operator() (const IntVect& /*iv*/, Array4<Real> const& /*dest*/,
const int /*dcomp*/, const int /*numcomp*/,
GeometryData const& /*geom*/, const Real /*time*/,
const BCRec* /*bcr*/, const int /*bcomp*/,
const int /*orig_comp*/) const
{
// do something for external Dirichlet (BCType::ext_dir) if there are
}
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_BaseFab.H
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public:
}

//! Returns bytes used in the Box for those components
std::size_t nBytes (const Box& bx, int start_comp, int ncomps) const noexcept
std::size_t nBytes (const Box& bx, int ncomps) const noexcept
{ return bx.numPts() * sizeof(T) * ncomps; }

//! Returns the number of components
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_CArena.H
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public:
void PrintUsage (std::string const& name) const;

//! The default memory hunk size to grab from the heap.
enum { DefaultHunkSize = 1024*1024*8 };
constexpr static std::size_t DefaultHunkSize = 1024*1024*8;

protected:
//! The nodes in our free list and block list.
Expand Down
4 changes: 4 additions & 0 deletions Src/Base/AMReX_CoordSys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ CoordSys::SetDLogA (FArrayBox& a_dlogafab,
const Box& region,
int dir) const
{
amrex::ignore_unused(dir);

AMREX_ASSERT(ok);
AMREX_ASSERT(region.cellCentered());

Expand Down Expand Up @@ -491,6 +493,7 @@ CoordSys::Volume (const Real xlo[AMREX_SPACEDIM],
Real
CoordSys::AreaLo (const IntVect& point, int dir) const noexcept
{
amrex::ignore_unused(point);
#if (AMREX_SPACEDIM==2)
Real xlo[AMREX_SPACEDIM];
switch (c_sys)
Expand Down Expand Up @@ -526,6 +529,7 @@ CoordSys::AreaLo (const IntVect& point, int dir) const noexcept
Real
CoordSys::AreaHi (const IntVect& point, int dir) const noexcept
{
amrex::ignore_unused(point);
#if (AMREX_SPACEDIM==2)
Real xhi[AMREX_SPACEDIM];
switch (c_sys)
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_EArena.H
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public:
std::size_t free_space_available () const noexcept;

//! The default memory hunk size to grab from the heap.
enum { DefaultHunkSize = 1024*1024*8 };
constexpr static std::size_t DefaultHunkSize = 1024*1024*8;

protected:

Expand Down
8 changes: 4 additions & 4 deletions Src/Base/AMReX_FArrayBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ FABio::read_header (std::istream& is,
FABio*
FABio::read_header (std::istream& is,
FArrayBox& f,
int compIndex,
int /*compIndex*/,
int& nCompAvailable)
{
// BL_PROFILE("FArrayBox::read_header_is_i");
Expand Down Expand Up @@ -718,9 +718,9 @@ FABio_ascii::skip (std::istream& is,
}

void
FABio_ascii::skip (std::istream& is,
FArrayBox& f,
int nCompToSkip) const
FABio_ascii::skip (std::istream& /*is*/,
FArrayBox& /*f*/,
int /*nCompToSkip*/) const
{
amrex::Error("FABio_ascii::skip(..., int nCompToSkip) not implemented");
}
Expand Down
8 changes: 8 additions & 0 deletions Src/Base/AMReX_FBI.H
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,8 @@ FabArray<FAB>::pack_send_buffer_gpu (FabArray<FAB> const& src, int scomp, int nc
Vector<std::size_t> const& send_size,
Vector<CopyComTagsContainer const*> const& send_cctc)
{
amrex::ignore_unused(send_size);

const int N_snds = send_data.size();
if (N_snds == 0) return;

Expand Down Expand Up @@ -1124,6 +1126,8 @@ FabArray<FAB>::unpack_recv_buffer_gpu (FabArray<FAB>& dst, int dcomp, int ncomp,
Vector<CopyComTagsContainer const*> const& recv_cctc,
CpOp op, bool is_thread_safe)
{
amrex::ignore_unused(recv_size);

const int N_rcvs = recv_cctc.size();
if (N_rcvs == 0) return;

Expand Down Expand Up @@ -1211,6 +1215,8 @@ FabArray<FAB>::pack_send_buffer_cpu (FabArray<FAB> const& src, int scomp, int nc
Vector<std::size_t> const& send_size,
Vector<CopyComTagsContainer const*> const& send_cctc)
{
amrex::ignore_unused(send_size);

const int N_snds = send_data.size();
if (N_snds == 0) return;

Expand Down Expand Up @@ -1248,6 +1254,8 @@ FabArray<FAB>::unpack_recv_buffer_cpu (FabArray<FAB>& dst, int dcomp, int ncomp,
Vector<CopyComTagsContainer const*> const& recv_cctc,
CpOp op, bool is_thread_safe)
{
amrex::ignore_unused(recv_size);

const int N_rcvs = recv_cctc.size();
if (N_rcvs == 0) return;

Expand Down
11 changes: 5 additions & 6 deletions Src/Base/AMReX_FabArray.H
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
namespace amrex {

template <typename T, typename std::enable_if<!IsBaseFab<T>::value,int>::type = 0>
Long nBytesOwned (T const& t) noexcept { return 0; }
Long nBytesOwned (T const&) noexcept { return 0; }

template <typename T>
Long nBytesOwned (BaseFab<T> const& fab) noexcept { return fab.nBytesOwned(); }
Expand Down Expand Up @@ -837,7 +837,6 @@ private:
Vector<std::size_t>& recv_size,
Vector<int>& recv_from,
Vector<MPI_Request>& recv_reqs,
int icomp,
int ncomp,
int SeqNum);

Expand Down Expand Up @@ -2003,8 +2002,8 @@ FabArray<FAB>::setVal (value_type val, const CommMetaData& thecmd, int scomp, in
#ifdef AMREX_USE_GPU
if (Gpu::inLaunchRegion())
{
CMD_local_setVal_gpu(val, thecmd, 0, ncomp);
CMD_remote_setVal_gpu(val, thecmd, 0, ncomp);
CMD_local_setVal_gpu(val, thecmd, scomp, ncomp);
CMD_remote_setVal_gpu(val, thecmd, scomp, ncomp);
}
else
#endif
Expand All @@ -2017,7 +2016,7 @@ FabArray<FAB>::setVal (value_type val, const CommMetaData& thecmd, int scomp, in
#endif
for (int i = 0; i < N_locs; ++i) {
const CopyComTag& tag = LocTags[i];
(*this)[tag.dstIndex].template setVal<RunOn::Host>(val, tag.dbox, 0, ncomp);
(*this)[tag.dstIndex].template setVal<RunOn::Host>(val, tag.dbox, scomp, ncomp);
}

for (auto it = RcvTags.begin(); it != RcvTags.end(); ++it) {
Expand All @@ -2027,7 +2026,7 @@ FabArray<FAB>::setVal (value_type val, const CommMetaData& thecmd, int scomp, in
#endif
for (int i = 0; i < N; ++i) {
const CopyComTag& tag = it->second[i];
(*this)[tag.dstIndex].template setVal<RunOn::Host>(val, tag.dbox, 0, ncomp);
(*this)[tag.dstIndex].template setVal<RunOn::Host>(val, tag.dbox, scomp, ncomp);
}
}
}
Expand Down
9 changes: 8 additions & 1 deletion Src/Base/AMReX_FabArrayBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ FabArrayBase::CPC::CPC (const BoxArray& ba, const IntVect& ng,
void
FabArrayBase::flushCPC (bool no_assertion) const
{
amrex::ignore_unused(no_assertion);
BL_ASSERT(no_assertion || getBDKey() == m_bdkey);

std::vector<CPCacheIter> others;
Expand Down Expand Up @@ -1010,6 +1011,7 @@ FabArrayBase::FB::~FB ()
void
FabArrayBase::flushFB (bool no_assertion) const
{
amrex::ignore_unused(no_assertion);
BL_ASSERT(no_assertion || getBDKey() == m_bdkey);
std::pair<FBCacheIter,FBCacheIter> er_it = m_TheFBCache.equal_range(m_bdkey);
for (FBCacheIter it = er_it.first; it != er_it.second; ++it)
Expand Down Expand Up @@ -1090,7 +1092,8 @@ FabArrayBase::FPinfo::FPinfo (const FabArrayBase& srcfa,
m_dstng (dstng),
m_coarsener(coarsener.clone()),
m_nuse (0)
{
{
amrex::ignore_unused(cdomain,index_space);
BL_PROFILE("FPinfo::FPinfo()");
const BoxArray& srcba = srcfa.boxArray();
const BoxArray& dstba = dstfa.boxArray();
Expand Down Expand Up @@ -1215,6 +1218,7 @@ FabArrayBase::TheFPinfo (const FabArrayBase& srcfa,
void
FabArrayBase::flushFPinfo (bool no_assertion)
{
amrex::ignore_unused(no_assertion);
BL_ASSERT(no_assertion || getBDKey() == m_bdkey);

std::vector<FPinfoCacheIter> others;
Expand Down Expand Up @@ -1374,6 +1378,7 @@ FabArrayBase::TheCFinfo (const FabArrayBase& finefa,
void
FabArrayBase::flushCFinfo (bool no_assertion)
{
amrex::ignore_unused(no_assertion);
BL_ASSERT(no_assertion || getBDKey() == m_bdkey);
auto er_it = m_TheCrseFineCache.equal_range(m_bdkey);
for (auto it = er_it.first; it != er_it.second; ++it)
Expand Down Expand Up @@ -1554,6 +1559,7 @@ FabArrayBase::buildTileArray (const IntVect& tileSize, TileArray& ta) const
void
FabArrayBase::flushTileArray (const IntVect& tileSize, bool no_assertion) const
{
amrex::ignore_unused(no_assertion);
BL_ASSERT(no_assertion || getBDKey() == m_bdkey);

TACache& tao = m_TheTileArrayCache;
Expand Down Expand Up @@ -1658,6 +1664,7 @@ FabArrayBase::WaitForAsyncSends (int N_snds,
Vector<char*>& send_data,
Vector<MPI_Status>& stats)
{
amrex::ignore_unused(send_data);
#ifdef BL_USE_MPI
BL_ASSERT(N_snds > 0);

Expand Down
11 changes: 5 additions & 6 deletions Src/Base/AMReX_FabArrayCommI.H
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ FabArray<FAB>::FBEP_nowait (int scomp, int ncomp, const IntVect& nghost,
if (N_rcvs > 0) {
PostRcvs(*TheFB.m_RcvTags, fb_the_recv_data,
fb_recv_data, fb_recv_size, fb_recv_from, fb_recv_reqs,
scomp, ncomp, SeqNum);
ncomp, SeqNum);
fb_recv_stat.resize(N_rcvs);
}

Expand Down Expand Up @@ -118,7 +118,7 @@ FabArray<FAB>::FBEP_nowait (int scomp, int ncomp, const IntVect& nghost,
std::size_t nbytes = 0;
for (auto const& cct : kv.second)
{
nbytes += (*this)[cct.srcIndex].nBytes(cct.sbox,scomp,ncomp);
nbytes += (*this)[cct.srcIndex].nBytes(cct.sbox,ncomp);
}

std::size_t acd = ParallelDescriptor::alignof_comm_data(nbytes);
Expand Down Expand Up @@ -439,7 +439,7 @@ FabArray<FAB>::ParallelCopy (const FabArray<FAB>& src,
int actual_n_rcvs = 0;
if (N_rcvs > 0) {
PostRcvs(*thecpc.m_RcvTags, the_recv_data,
recv_data, recv_size, recv_from, recv_reqs, SC, NC, SeqNum);
recv_data, recv_size, recv_from, recv_reqs, NC, SeqNum);
actual_n_rcvs = N_rcvs - std::count(recv_size.begin(), recv_size.end(), 0);
}

Expand Down Expand Up @@ -471,7 +471,7 @@ FabArray<FAB>::ParallelCopy (const FabArray<FAB>& src,
std::size_t nbytes = 0;
for (auto const& cct : kv.second)
{
nbytes += src[cct.srcIndex].nBytes(cct.sbox,SC,NC);
nbytes += src[cct.srcIndex].nBytes(cct.sbox,NC);
}

std::size_t acd = ParallelDescriptor::alignof_comm_data(nbytes);
Expand Down Expand Up @@ -701,7 +701,6 @@ FabArray<FAB>::PostRcvs (const MapOfCopyComTagContainers& m_RcvTags,
Vector<std::size_t>& recv_size,
Vector<int>& recv_from,
Vector<MPI_Request>& recv_reqs,
int icomp,
int ncomp,
int SeqNum)
{
Expand All @@ -717,7 +716,7 @@ FabArray<FAB>::PostRcvs (const MapOfCopyComTagContainers& m_RcvTags,
std::size_t nbytes = 0;
for (auto const& cct : kv.second)
{
nbytes += (*this)[cct.dstIndex].nBytes(cct.dbox,icomp,ncomp);
nbytes += (*this)[cct.dstIndex].nBytes(cct.dbox,ncomp);
}

std::size_t acd = ParallelDescriptor::alignof_comm_data(nbytes);
Expand Down
8 changes: 6 additions & 2 deletions Src/Base/AMReX_FabArrayUtility.H
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,8 @@ prefetchToHost (FabArray<FAB> const& fa, const bool synchronous = true)
fa.prefetchToHost(mfi);
}
}
#else
amrex::ignore_unused(fa,synchronous);
#endif
}

Expand All @@ -1642,6 +1644,8 @@ prefetchToDevice (FabArray<FAB> const& fa, const bool synchronous = true)
fa.prefetchToDevice(mfi);
}
}
#else
amrex::ignore_unused(fa,synchronous);
#endif
}

Expand Down Expand Up @@ -1689,7 +1693,7 @@ dtoh_memcpy (FabArray<FAB>& dst, FabArray<FAB> const& src,
for (MFIter mfi(dst); mfi.isValid(); ++mfi) {
void* pdst = dst[mfi].dataPtr(dcomp);
void const* psrc = src[mfi].dataPtr(scomp);
Gpu::dtoh_memcpy_async(pdst, psrc, dst[mfi].nBytes(mfi.fabbox(), dcomp, ncomp));
Gpu::dtoh_memcpy_async(pdst, psrc, dst[mfi].nBytes(mfi.fabbox(), ncomp));
}
#else
Copy(dst, src, scomp, dcomp, ncomp, dst.nGrowVect());
Expand All @@ -1714,7 +1718,7 @@ htod_memcpy (FabArray<FAB>& dst, FabArray<FAB> const& src,
for (MFIter mfi(dst); mfi.isValid(); ++mfi) {
void* pdst = dst[mfi].dataPtr(dcomp);
void const* psrc = src[mfi].dataPtr(scomp);
Gpu::htod_memcpy_async(pdst, psrc, dst[mfi].nBytes(mfi.fabbox(), dcomp, ncomp));
Gpu::htod_memcpy_async(pdst, psrc, dst[mfi].nBytes(mfi.fabbox(), ncomp));
}
#else
Copy(dst, src, scomp, dcomp, ncomp, dst.nGrowVect());
Expand Down
Loading