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

fix more warnings and add CI for building 3d with configure #1184

Merged
merged 9 commits into from
Jul 24, 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
22 changes: 18 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ jobs:

# Build 1D libamrex with configure
configure-1d:
name: GNU@7.5 C++17 Release [configure 1D]
name: GNU@7.5 Release [configure 1D]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -196,14 +196,28 @@ jobs:

# Build 2D libamrex with configure
configure-2d:
name: GNU@7.5 C++17 Release [configure 2D]
name: Clang@6.0 NOMPI Release [configure 2D]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Dependencies
run: .github/workflows/dependencies/dependencies_clang6.sh
- name: Build & Install
run: |
./configure --dim 2 --with-fortran no --comp llvm --with-mpi no
make -j2 WARN_ALL=TRUE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you also want to add this to the 1D case above? :)

Copy link
Member

@ax3l ax3l Jul 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another idea: we can add -Werror in CI through XTRA flags to check PRs do not introduce warnings for selected compilers :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are too many warnings in 1D we need to fix. :( We do not fully support 1D. So in many places we just have a function with empty body. As for -Werror, we still have some warnings. One we get rid of them, we can add that to a few CI tests.

make install

# Build 3D libamrex with configure
configure-3d:
name: GNU@7.5 Release [configure 3D]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Dependencies
run: .github/workflows/dependencies/dependencies.sh
- name: Build & Install
run: |
./configure --dim 2
make -j2
./configure --dim 3 --enable-eb yes --enable-xsdk-defaults yes
make -j2 WARN_ALL=TRUE
make install
16 changes: 8 additions & 8 deletions Src/Amr/AMReX_Amr.H
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,14 @@ protected:
Real stop_time);

// pure virtural function in AmrCore
virtual void MakeNewLevelFromScratch (int lev, Real time, const BoxArray& ba, const DistributionMapping& dm) override
{ amrex::Abort("How did we get her!"); }
virtual void MakeNewLevelFromCoarse (int lev, Real time, const BoxArray& ba, const DistributionMapping& dm) override
{ amrex::Abort("How did we get her!"); }
virtual void RemakeLevel (int lev, Real time, const BoxArray& ba, const DistributionMapping& dm) override
{ amrex::Abort("How did we get her!"); }
virtual void ClearLevel (int lev) override
{ amrex::Abort("How did we get her!"); }
virtual void MakeNewLevelFromScratch (int /*lev*/, Real /*time*/, const BoxArray& /*ba*/, const DistributionMapping& /*dm*/) override
{ amrex::Abort("How did we get here!"); }
virtual void MakeNewLevelFromCoarse (int /*lev*/, Real /*time*/, const BoxArray& /*ba*/, const DistributionMapping& /*dm*/) override
{ amrex::Abort("How did we get here!"); }
virtual void RemakeLevel (int /*lev*/, Real /*time*/, const BoxArray& /*ba*/, const DistributionMapping& /*dm*/) override
{ amrex::Abort("How did we get here!"); }
virtual void ClearLevel (int /*lev*/) override
{ amrex::Abort("How did we get here!"); }

//! Whether to write a plotfile now
bool writePlotNow () noexcept;
Expand Down
4 changes: 3 additions & 1 deletion Src/Amr/AMReX_Amr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ Amr::initialInit (Real strt_time,

void
Amr::InitializeInit(Real strt_time,
Real stop_time,
Real /*stop_time*/,
const BoxArray* lev0_grids,
const Vector<int>* pmap)
{
Expand Down Expand Up @@ -2743,6 +2743,8 @@ Amr::defBaseLevel (Real strt_time,
const BoxArray* lev0_grids,
const Vector<int>* pmap)
{
amrex::ignore_unused(pmap);

BL_PROFILE("Amr::defBaseLevel()");
// Just initialize this here for the heck of it
which_level_being_advanced = -1;
Expand Down
8 changes: 4 additions & 4 deletions Src/Amr/AMReX_AmrLevel.H
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ public:
* Unlike writePlotFile, this is NOT a pure virtual function
* so implementation by derived classes is optional.
*/
virtual void writeSmallPlotFile (const std::string& dir,
std::ostream& os,
VisMF::How how = VisMF::NFiles) {};
virtual void writeSmallPlotFile (const std::string& /*dir*/,
std::ostream& /*os*/,
VisMF::How /*how*/ = VisMF::NFiles) {};
//! Write current state to checkpoint file.
virtual void checkPoint (const std::string& dir,
std::ostream& os,
Expand Down Expand Up @@ -380,7 +380,7 @@ public:

#ifdef AMREX_PARTICLES
//! This function can be called from the parent
virtual void particle_redistribute (int lbase = 0, bool a_init = false) {;}
virtual void particle_redistribute (int /*lbase*/ = 0, bool /*a_init*/ = false) {;}
#endif

static void FillPatch (AmrLevel& amrlevel,
Expand Down
34 changes: 17 additions & 17 deletions Src/Amr/AMReX_AmrLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ AmrLevel::postCoarseTimeStep (Real time)
}

void
AmrLevel::set_preferred_boundary_values (MultiFab& S,
int state_index,
int scomp,
int dcomp,
int ncomp,
Real time) const
AmrLevel::set_preferred_boundary_values (MultiFab& /*S*/,
int /*state_index*/,
int /*scomp*/,
int /*dcomp*/,
int /*ncomp*/,
Real /*time*/) const
{}

DeriveList&
Expand All @@ -68,8 +68,8 @@ AmrLevel::get_derive_lst () noexcept
}

void
AmrLevel::manual_tags_placement (TagBoxArray& tags,
const Vector<IntVect>& bf_lev)
AmrLevel::manual_tags_placement (TagBoxArray& /*tags*/,
const Vector<IntVect>& /*bf_lev*/)
{}

AmrLevel::AmrLevel () noexcept
Expand Down Expand Up @@ -362,15 +362,15 @@ AmrLevel::writePlotFile (const std::string& dir,


void
AmrLevel::writePlotFilePre (const std::string& dir,
std::ostream& os)
AmrLevel::writePlotFilePre (const std::string& /*dir*/,
std::ostream& /*os*/)
{
}


void
AmrLevel::writePlotFilePost (const std::string& dir,
std::ostream& os)
AmrLevel::writePlotFilePost (const std::string& /*dir*/,
std::ostream& /*os*/)
{
}

Expand Down Expand Up @@ -448,7 +448,7 @@ AmrLevel::restart (Amr& papa,
}

void
AmrLevel::set_state_in_checkpoint (Vector<int>& state_in_checkpoint)
AmrLevel::set_state_in_checkpoint (Vector<int>& /*state_in_checkpoint*/)
{
amrex::Error("Class derived AmrLevel has to handle this!");
}
Expand Down Expand Up @@ -537,16 +537,16 @@ AmrLevel::checkPoint (const std::string& dir,


void
AmrLevel::checkPointPre (const std::string& dir,
std::ostream& os)
AmrLevel::checkPointPre (const std::string& /*dir*/,
std::ostream& /*os*/)
{
BL_PROFILE("AmrLevel::checkPointPre()");
}


void
AmrLevel::checkPointPost (const std::string& dir,
std::ostream& os)
AmrLevel::checkPointPost (const std::string& /*dir*/,
std::ostream& /*os*/)
{
BL_PROFILE("AmrLevel::checkPointPost()");
}
Expand Down
4 changes: 2 additions & 2 deletions Src/Amr/AMReX_StateDescriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ StateDescriptor::BndryFunc::clone () const
StateDescriptor::BndryFunc::~BndryFunc () {}

bool
StateDescriptor::bf_thread_safety (const int* lo,const int* hi,
const int* dom_lo, const int* dom_hi,
StateDescriptor::bf_thread_safety (const int* /*lo*/,const int* /*hi*/,
const int* /*dom_lo*/, const int* /*dom_hi*/,
const int* bc, int ng)
{
bool thread_safe = true;
Expand Down
2 changes: 1 addition & 1 deletion Src/AmrCore/AMReX_FillPatchUtil.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace amrex
template <typename FAB>
struct NullInterpHook
{
void operator() (FAB& fab, const Box& bx, int icomp, int ncomp) const {}
void operator() (FAB& /*fab*/, const Box& /*bx*/, int /*icomp*/, int /*ncomp*/) const {}
};

template <typename Interp>
Expand Down
27 changes: 17 additions & 10 deletions Src/AmrCore/AMReX_Interpolater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ CellBilinear::interp (const FArrayBox& crse,
Vector<BCRec> const& /*bcr*/,
int actual_comp,
int actual_state,
RunOn runon)
RunOn /*runon*/)
{
BL_PROFILE("CellBilinear::interp()");
//
Expand Down Expand Up @@ -471,8 +471,13 @@ CellQuadratic::interp (const FArrayBox& crse,
Vector<BCRec> const& bcr,
int actual_comp,
int actual_state,
RunOn runon)
RunOn /*runon*/)
{
#if (AMREX_SPACEDIM == 1)
amrex::ignore_unused(crse,crse_comp,fine,fine_comp,ncomp,fine_region,
ratio,crse_geom,fine_geom,bcr,actual_comp,actual_state);
amrex::Abort("1D CellQuadratic::interp not supported");
#else
BL_PROFILE("CellQuadratic::interp()");
BL_ASSERT(bcr.size() >= ncomp);
//
Expand Down Expand Up @@ -543,8 +548,6 @@ CellQuadratic::interp (const FArrayBox& crse,
Vector<int> bc = GetBCArray(bcr);
const int* ratioV = ratio.getVect();

#if (AMREX_SPACEDIM > 1)

amrex_cqinterp (fdat,AMREX_ARLIM(flo),AMREX_ARLIM(fhi),
AMREX_ARLIM(fblo), AMREX_ARLIM(fbhi),
&ncomp,AMREX_D_DECL(&ratioV[0],&ratioV[1],&ratioV[2]),
Expand Down Expand Up @@ -638,8 +641,8 @@ CellConservativeProtected::interp (const FArrayBox& crse,
const Geometry& crse_geom,
const Geometry& fine_geom,
Vector<BCRec> const& bcr,
int actual_comp,
int actual_state,
int /*actual_comp*/,
int /*actual_state*/,
RunOn runon)
{
BL_PROFILE("CellConservativeProtected::interp()");
Expand Down Expand Up @@ -702,8 +705,14 @@ CellConservativeProtected::protect (const FArrayBox& crse,
const Geometry& crse_geom,
const Geometry& fine_geom,
Vector<BCRec>& bcr,
RunOn runon)
RunOn /*runon*/)
{
#if (AMREX_SPACEDIM > 1)
amrex::ignore_unused(crse,crse_comp,fine,fine_comp,fine_state,
state_comp,ncomp,fine_region,ratio,
crse_geom,fine_geom,bcr);
amrex::Abort("1D CellConservativeProtected::protect not supported");
#else
BL_PROFILE("CellConservativeProtected::protect()");
BL_ASSERT(bcr.size() >= ncomp);

Expand Down Expand Up @@ -767,8 +776,6 @@ CellConservativeProtected::protect (const FArrayBox& crse,
Vector<int> bc = GetBCArray(bcr);
const int* ratioV = ratio.getVect();

#if (AMREX_SPACEDIM > 1)

amrex_protect_interp (fdat,AMREX_ARLIM(flo),AMREX_ARLIM(fhi),
fblo, fbhi,
cdat,AMREX_ARLIM(clo),AMREX_ARLIM(chi),
Expand Down Expand Up @@ -822,7 +829,7 @@ CellConservativeQuartic::interp (const FArrayBox& crse,
Vector<BCRec> const& bcr,
int actual_comp,
int actual_state,
RunOn runon)
RunOn /*runon*/)
{
BL_PROFILE("CellConservativeQuartic::interp()");
BL_ASSERT(bcr.size() >= ncomp);
Expand Down
1 change: 1 addition & 0 deletions Src/AmrCore/AMReX_TagBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ TagBox::buffer (const IntVect& nbuff, const IntVect& nwid) noexcept
const int* lo = domain.loVect();
TagType* d = dataPtr();

amrex::ignore_unused(len);
#define OFF(i,j,k,lo,len) AMREX_D_TERM(i-lo[0], +(j-lo[1])*len[0] , +(k-lo[2])*len[0]*len[1])

for (int k = klo; k <= khi; k++)
Expand Down
5 changes: 5 additions & 0 deletions Src/Base/AMReX.H
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ namespace amrex
void ExecOnFinalize (PTR_TO_VOID_FUNC);
void ExecOnInitialize (PTR_TO_VOID_FUNC);

//! This shuts up the compiler about unused variables
template <class... Ts>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void ignore_unused (const Ts&...) {}

//! Print out message to cerr and exit via amrex::Abort().
void Error (const std::string& msg);
namespace detail { void Error_host_doit (const char * msg); }
Expand Down
12 changes: 6 additions & 6 deletions Src/Base/AMReX_Array4.H
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ namespace amrex {
struct Array4
{
T* AMREX_RESTRICT p;
Long jstride;
Long kstride;
Long nstride;
Dim3 begin;
Dim3 end; // end is hi + 1
int ncomp;
Long jstride = 0;
Long kstride = 0;
Long nstride = 0;
Dim3 begin{1,1,1};
Dim3 end{0,0,0}; // end is hi + 1
int ncomp=0;

AMREX_GPU_HOST_DEVICE
constexpr Array4 () noexcept : p(nullptr) {}
Expand Down
10 changes: 5 additions & 5 deletions Src/Base/AMReX_BLProfiler.H
Original file line number Diff line number Diff line change
Expand Up @@ -525,17 +525,17 @@ namespace amrex {
class BLProfiler
{
public:
explicit BLProfiler(const std::string &funcname) { }
explicit BLProfiler(const std::string &/*funcname*/) { }
static void Initialize() { }
static void InitParams() { }
static void Finalize() { }
static void WriteStats(std::ostream &os) { }
static void WriteStats(std::ostream &/*os*/) { }
static void WriteCommStats() { }
void start() { }
void stop() { }
static void InitParams(const Real ptl, const bool writeall,
const bool writefabs) { }
static void AddStep(const int snum) { }
static void InitParams(const Real /*ptl*/, const bool /*writeall*/,
const bool /*writefabs*/) { }
static void AddStep(const int /*snum*/) { }
};

}
Expand Down
8 changes: 4 additions & 4 deletions Src/Base/AMReX_BLProfiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1658,28 +1658,28 @@ namespace amrex {

BL_FORT_PROC_DECL(BL_PROFFORTFUNCSTART_CPP,bl_proffortfuncstart_cpp)
(
const int istr[], const int *NSTR
const int /*istr*/[], const int * /*NSTR*/
)
{
}

BL_FORT_PROC_DECL(BL_PROFFORTFUNCSTOP_CPP,bl_proffortfuncstop_cpp)
(
const int istr[], const int *NSTR
const int /*istr*/[], const int * /*NSTR*/
)
{
}

BL_FORT_PROC_DECL(BL_PROFFORTFUNCSTART_CPP_INT,bl_proffortfuncstart_cpp_int)
(
int i
int /*i*/
)
{
}

BL_FORT_PROC_DECL(BL_PROFFORTFUNCSTOP_CPP_INT,bl_proffortfuncstop_cpp_int)
(
int i
int /*i*/
)
{
}
Expand Down
Loading