Skip to content

Commit

Permalink
Fix a bug in Tutorials/GPU/CNS (AMReX-Codes#1245)
Browse files Browse the repository at this point in the history
Fix a bug in deriving velocity and a number of warnings for
Tutorials/GPU/CNS.
  • Loading branch information
WeiqunZhang authored and dwillcox committed Oct 3, 2020
1 parent 5350770 commit f323b7f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 21 deletions.
4 changes: 3 additions & 1 deletion Src/Base/AMReX_FBI.H
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,7 @@ FabArray<FAB>::FB_pack_send_buffer_cuda_graph (const FB& TheFB, int scomp, int n

dptr += (tag.sbox.numPts() * ncomp * sizeof(value_type));
}
amrex::ignore_unused(send_size);
BL_ASSERT(dptr <= send_data[j] + send_size[j]);
}
}
Expand All @@ -999,7 +1000,7 @@ FabArray<FAB>::FB_unpack_recv_buffer_cuda_graph (const FB& TheFB, int dcomp, int
Vector<char*> const& recv_data,
Vector<std::size_t> const& recv_size,
Vector<CopyComTagsContainer const*> const& recv_cctc,
bool is_thread_safe)
bool /*is_thread_safe*/)
{
const int N_rcvs = recv_cctc.size();
if (N_rcvs == 0) return;
Expand All @@ -1018,6 +1019,7 @@ FabArray<FAB>::FB_unpack_recv_buffer_cuda_graph (const FB& TheFB, int dcomp, int
dptr += tag.dbox.numPts() * ncomp * sizeof(value_type);
launches++;
}
amrex::ignore_unused(recv_size);
BL_ASSERT(dptr <= recv_data[k] + recv_size[k]);
}
}
Expand Down
10 changes: 5 additions & 5 deletions Tutorials/GPU/CNS/Exec/RT/cns_prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
#include <AMReX_ParmParse.H>

extern "C" {
void amrex_probinit (const int* init,
const int* name,
const int* namelen,
const amrex_real* problo,
const amrex_real* probhi)
void amrex_probinit (const int* /*init*/,
const int* /*name*/,
const int* /*namelen*/,
const amrex_real* /*problo*/,
const amrex_real* /*probhi*/)
{
// could read parmparse parameters here
}
Expand Down
10 changes: 5 additions & 5 deletions Tutorials/GPU/CNS/Exec/Sod/cns_prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#include "CNS.H"

extern "C" {
void amrex_probinit (const int* init,
const int* name,
const int* namelen,
const amrex_real* problo,
const amrex_real* probhi)
void amrex_probinit (const int* /*init*/,
const int* /*name*/,
const int* /*namelen*/,
const amrex_real* /*problo*/,
const amrex_real* /*probhi*/)
{
amrex::ParmParse pp("prob");

Expand Down
16 changes: 8 additions & 8 deletions Tutorials/GPU/CNS/Source/CNS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ CNS::initData ()

void
CNS::computeInitialDt (int finest_level,
int sub_cycle,
int /*sub_cycle*/,
Vector<int>& n_cycle,
const Vector<IntVect>& ref_ratio,
const Vector<IntVect>& /*ref_ratio*/,
Vector<Real>& dt_level,
Real stop_time)
{
Expand Down Expand Up @@ -144,9 +144,9 @@ CNS::computeInitialDt (int finest_level,

void
CNS::computeNewDt (int finest_level,
int sub_cycle,
int /*sub_cycle*/,
Vector<int>& n_cycle,
const Vector<IntVect>& ref_ratio,
const Vector<IntVect>& /*ref_ratio*/,
Vector<Real>& dt_min,
Vector<Real>& dt_level,
Real stop_time,
Expand Down Expand Up @@ -218,12 +218,12 @@ CNS::computeNewDt (int finest_level,
}

void
CNS::post_regrid (int lbase, int new_finest)
CNS::post_regrid (int /*lbase*/, int /*new_finest*/)
{
}

void
CNS::post_timestep (int iteration)
CNS::post_timestep (int /*iteration*/)
{
BL_PROFILE("post_timestep");

Expand All @@ -239,7 +239,7 @@ CNS::post_timestep (int iteration)
}

void
CNS::postCoarseTimeStep (Real time)
CNS::postCoarseTimeStep (Real /*time*/)
{
BL_PROFILE("postCoarseTimeStep()");

Expand Down Expand Up @@ -290,7 +290,7 @@ CNS::post_restart ()
}

void
CNS::errorEst (TagBoxArray& tags, int, int, Real time, int, int)
CNS::errorEst (TagBoxArray& tags, int, int, Real /*time*/, int, int)
{
BL_PROFILE("CNS::errorEst()");

Expand Down
2 changes: 1 addition & 1 deletion Tutorials/GPU/CNS/Source/CNS_advance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using namespace amrex;

Real
CNS::advance (Real time, Real dt, int iteration, int ncycle)
CNS::advance (Real time, Real dt, int /*iteration*/, int /*ncycle*/)
{
BL_PROFILE("CNS::advance()");

Expand Down
2 changes: 1 addition & 1 deletion Tutorials/GPU/CNS/Source/CNS_derive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ void cns_dervel (const Box& bx, FArrayBox& velfab, int dcomp, int /*ncomp*/,
amrex::ParallelFor(bx,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
vel(i,j,k,dcomp) = vel(i,j,k,1)/vel(i,j,k,0);
vel(i,j,k,dcomp) = dat(i,j,k,1)/dat(i,j,k,0);
});
}

0 comments on commit f323b7f

Please sign in to comment.