Skip to content

Commit

Permalink
More warning checking in CI (#1687)
Browse files Browse the repository at this point in the history
* add more warn checking for soem workflows

* more ci warning capture

* fix a bunch of warnings

* partial fix for hip removing shadowed lambda captures

* don't do warnings check for windows
  • Loading branch information
baperry2 authored Jul 16, 2024
1 parent 2ffbc69 commit 9abf6e0
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 40 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/cuda-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,21 @@ jobs:
-DERF_ENABLE_MPI:BOOL=ON \
-DERF_ENABLE_CUDA:BOOL=ON \
-DERF_ENABLE_REGRESSION_TESTS_ONLY:BOOL=ON .
cmake --build build-${{matrix.cuda_pkg}} -- -j $(nproc)
cmake --build build-${{matrix.cuda_pkg}} -- -j $(nproc) \
2>&1 | tee -a ${{runner.workspace}}/build-${{matrix.cuda_pkg}}-output.txt;
ccache -s
du -hs ~/.cache/ccache
- name: Report
run: |
egrep "warning:|error:" ${{runner.workspace}}/build-${{matrix.cuda_pkg}}-output.txt \
| egrep -v "Submodules/amrex" | egrep -v "lto-wrapper: warning:" | sort | uniq \
| awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > ${{runner.workspace}}/build-${{matrix.cuda_pkg}}-output-warnings.txt
cat ${{runner.workspace}}/build-${{matrix.cuda_pkg}}-output-warnings.txt
export return=$(tail -n 1 ${{runner.workspace}}/build-${{matrix.cuda_pkg}}-output-warnings.txt | awk '{print $2}')
exit ${return}
save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,21 @@ jobs:
export CCACHE_MAXSIZE=300M
ccache -z
cmake --build ${{runner.workspace}}/ERF/build --parallel 2 --verbose
cmake --build ${{runner.workspace}}/ERF/build --parallel 2 --verbose \
2>&1 | tee -a ${{runner.workspace}}/build-output.txt;
ccache -s
du -hs ~/.cache/ccache
- name: Report
run: |
egrep "warning:|error:" ${{runner.workspace}}/build-output.txt \
| egrep -v "Submodules/amrex" | egrep -v "lto-wrapper: warning:" | sort | uniq \
| awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > ${{runner.workspace}}/build-output-warnings.txt
cat ${{runner.workspace}}/build-output-warnings.txt
export return=$(tail -n 1 ${{runner.workspace}}/build-output-warnings.txt | awk '{print $2}')
exit ${return}
- name: CMake Tests # see file ERF/Tests/CTestList.cmake
run: |
ctest -L regression -VV
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/hip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,20 @@ jobs:
pushd ${{runner.workspace}}/ERF/build-${{matrix.os}};
# make -j ${{env.NPROCS}};
make -j 2;
make -j 2 2>&1 | tee -a ${{runner.workspace}}/build-${{matrix.os}}-output.txt;
ccache -s
du -hs ~/.cache/ccache
- name: Report
run: |
egrep "warning:|error:" ${{runner.workspace}}/build-${{matrix.os}}-output.txt \
| egrep -v "Submodules/amrex" | egrep -v "lto-wrapper: warning:" | sort | uniq \
| awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > ${{runner.workspace}}/build-${{matrix.os}}-output-warnings.txt
cat ${{runner.workspace}}/build-${{matrix.os}}-output-warnings.txt
export return=$(tail -n 1 ${{runner.workspace}}/build-${{matrix.os}}-output-warnings.txt | awk '{print $2}')
exit ${return}
# - name: Regression Tests
# run: |
# ctest -L regression -VV
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,21 @@ jobs:
export CCACHE_SLOPPINESS=time_macros
ccache -z
cmake --build ${{runner.workspace}}/ERF/build --parallel 2 --verbose
cmake --build ${{runner.workspace}}/ERF/build --parallel 2 --verbose \
2>&1 | tee -a ${{runner.workspace}}/build-output.txt;
du -hs ~/Library/Caches/ccache
ccache -s
- name: Report
run: |
egrep "warning:|error:" ${{runner.workspace}}/build-output.txt \
| egrep -v "Submodules/amrex" | egrep -v "lto-wrapper: warning:" | sort | uniq \
| awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > ${{runner.workspace}}/build-output-warnings.txt
cat ${{runner.workspace}}/build-output-warnings.txt
export return=$(tail -n 1 ${{runner.workspace}}/build-output-warnings.txt | awk '{print $2}')
exit ${return}
- name: CMake Tests # see file ERF/Tests/CTestList.cmake
run: |
ctest -L regression -VV
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/sycl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,20 @@ jobs:
-DCMAKE_C_COMPILER=$(which icx) \
-DCMAKE_CXX_COMPILER=$(which icpx) \
-DCMAKE_CXX_STANDARD=17
make -j 2
make -j 2 2>&1 | tee -a ${{runner.workspace}}/build-output.txt;
ccache -s
du -hs ~/.cache/ccache
- name: Report
run: |
egrep "warning:|error:" ${{runner.workspace}}/build-output.txt \
| egrep -v "Submodules/amrex" | egrep -v "lto-wrapper: warning:" | sort | uniq \
| awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > ${{runner.workspace}}/build-output-warnings.txt
cat ${{runner.workspace}}/build-output-warnings.txt
export return=$(tail -n 1 ${{runner.workspace}}/build-output-warnings.txt | awk '{print $2}')
exit ${return}
save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
Expand Down
58 changes: 29 additions & 29 deletions Exec/ABL/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Problem::init_custom_pert(
}
}

ParallelForRNG(bx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept {
ParallelForRNG(bx, [=, d_parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept {
// Geometry
const Real* prob_lo = geomdata.ProbLo();
const Real* prob_hi = geomdata.ProbHi();
Expand All @@ -115,36 +115,36 @@ Problem::init_custom_pert(
const Real r = std::sqrt((x-xc)*(x-xc) + (y-yc)*(y-yc) + (z-zc)*(z-zc));

// Add temperature perturbations
if ((z <= parms.pert_ref_height) && (parms.T_0_Pert_Mag != 0.0)) {
if ((z <= d_parms.pert_ref_height) && (d_parms.T_0_Pert_Mag != 0.0)) {
Real rand_double = amrex::Random(engine); // Between 0.0 and 1.0
state_pert(i, j, k, RhoTheta_comp) = (rand_double*2.0 - 1.0)*parms.T_0_Pert_Mag;
if (!parms.pert_rhotheta) {
state_pert(i, j, k, RhoTheta_comp) = (rand_double*2.0 - 1.0)*d_parms.T_0_Pert_Mag;
if (!d_parms.pert_rhotheta) {
// we're perturbing theta, not rho*theta
state_pert(i, j, k, RhoTheta_comp) *= r_hse(i,j,k);
}
}

// Set scalar = A_0*exp(-10r^2), where r is distance from center of domain
state_pert(i, j, k, RhoScalar_comp) = parms.A_0 * exp(-10.*r*r);
state_pert(i, j, k, RhoScalar_comp) = d_parms.A_0 * exp(-10.*r*r);

// Set an initial value for SGS KE
if (state_pert.nComp() > RhoKE_comp) {
// Deardorff
state_pert(i, j, k, RhoKE_comp) = r_hse(i,j,k) * parms.KE_0;
if (parms.KE_decay_height > 0) {
state_pert(i, j, k, RhoKE_comp) = r_hse(i,j,k) * d_parms.KE_0;
if (d_parms.KE_decay_height > 0) {
// scale initial SGS kinetic energy with height
state_pert(i, j, k, RhoKE_comp) *= max(
std::pow(1 - min(z/parms.KE_decay_height,1.0), parms.KE_decay_order),
std::pow(1 - min(z/d_parms.KE_decay_height,1.0), d_parms.KE_decay_order),
1e-12);
}
}
if (state_pert.nComp() > RhoQKE_comp) {
// PBL
state_pert(i, j, k, RhoQKE_comp) = r_hse(i,j,k) * parms.QKE_0;
if (parms.KE_decay_height > 0) {
state_pert(i, j, k, RhoQKE_comp) = r_hse(i,j,k) * d_parms.QKE_0;
if (d_parms.KE_decay_height > 0) {
// scale initial SGS kinetic energy with height
state_pert(i, j, k, RhoQKE_comp) *= max(
std::pow(1 - min(z/parms.KE_decay_height,1.0), parms.KE_decay_order),
std::pow(1 - min(z/d_parms.KE_decay_height,1.0), d_parms.KE_decay_order),
1e-12);
}
}
Expand All @@ -156,7 +156,7 @@ Problem::init_custom_pert(
});

// Set the x-velocity
ParallelForRNG(xbx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept {
ParallelForRNG(xbx, [=, d_parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept {
const Real* prob_lo = geomdata.ProbLo();
const Real* dx = geomdata.CellSize();
const Real y = prob_lo[1] + (j + 0.5) * dx[1];
Expand All @@ -165,24 +165,24 @@ Problem::init_custom_pert(
: prob_lo[2] + (k + 0.5) * dx[2];

// Set the x-velocity
x_vel_pert(i, j, k) = parms.U_0;
if ((z <= parms.pert_ref_height) && (parms.U_0_Pert_Mag != 0.0))
x_vel_pert(i, j, k) = d_parms.U_0;
if ((z <= d_parms.pert_ref_height) && (d_parms.U_0_Pert_Mag != 0.0))
{
Real rand_double = amrex::Random(engine); // Between 0.0 and 1.0
Real x_vel_prime = (rand_double*2.0 - 1.0)*parms.U_0_Pert_Mag;
Real x_vel_prime = (rand_double*2.0 - 1.0)*d_parms.U_0_Pert_Mag;
x_vel_pert(i, j, k) += x_vel_prime;
}
if (parms.pert_deltaU != 0.0)
if (d_parms.pert_deltaU != 0.0)
{
const amrex::Real yl = y - prob_lo[1];
const amrex::Real zl = z / parms.pert_ref_height;
const amrex::Real zl = z / d_parms.pert_ref_height;
const amrex::Real damp = std::exp(-0.5 * zl * zl);
x_vel_pert(i, j, k) += parms.ufac * damp * z * std::cos(parms.aval * yl);
x_vel_pert(i, j, k) += d_parms.ufac * damp * z * std::cos(d_parms.aval * yl);
}
});

// Set the y-velocity
ParallelForRNG(ybx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept {
ParallelForRNG(ybx, [=, d_parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept {
const Real* prob_lo = geomdata.ProbLo();
const Real* dx = geomdata.CellSize();
const Real x = prob_lo[0] + (i + 0.5) * dx[0];
Expand All @@ -191,24 +191,24 @@ Problem::init_custom_pert(
: prob_lo[2] + (k + 0.5) * dx[2];

// Set the y-velocity
y_vel_pert(i, j, k) = parms.V_0;
if ((z <= parms.pert_ref_height) && (parms.V_0_Pert_Mag != 0.0))
y_vel_pert(i, j, k) = d_parms.V_0;
if ((z <= d_parms.pert_ref_height) && (d_parms.V_0_Pert_Mag != 0.0))
{
Real rand_double = amrex::Random(engine); // Between 0.0 and 1.0
Real y_vel_prime = (rand_double*2.0 - 1.0)*parms.V_0_Pert_Mag;
Real y_vel_prime = (rand_double*2.0 - 1.0)*d_parms.V_0_Pert_Mag;
y_vel_pert(i, j, k) += y_vel_prime;
}
if (parms.pert_deltaV != 0.0)
if (d_parms.pert_deltaV != 0.0)
{
const amrex::Real xl = x - prob_lo[0];
const amrex::Real zl = z / parms.pert_ref_height;
const amrex::Real zl = z / d_parms.pert_ref_height;
const amrex::Real damp = std::exp(-0.5 * zl * zl);
y_vel_pert(i, j, k) += parms.vfac * damp * z * std::cos(parms.bval * xl);
y_vel_pert(i, j, k) += d_parms.vfac * damp * z * std::cos(d_parms.bval * xl);
}
});

// Set the z-velocity
ParallelForRNG(zbx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept {
ParallelForRNG(zbx, [=, d_parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept {
const int dom_lo_z = geomdata.Domain().smallEnd()[2];
const int dom_hi_z = geomdata.Domain().bigEnd()[2];

Expand All @@ -217,11 +217,11 @@ Problem::init_custom_pert(
{
z_vel_pert(i, j, k) = 0.0;
}
else if (parms.W_0_Pert_Mag != 0.0)
else if (d_parms.W_0_Pert_Mag != 0.0)
{
Real rand_double = amrex::Random(engine); // Between 0.0 and 1.0
Real z_vel_prime = (rand_double*2.0 - 1.0)*parms.W_0_Pert_Mag;
z_vel_pert(i, j, k) = parms.W_0 + z_vel_prime;
Real z_vel_prime = (rand_double*2.0 - 1.0)*d_parms.W_0_Pert_Mag;
z_vel_pert(i, j, k) = d_parms.W_0 + z_vel_prime;
}
});
}
3 changes: 3 additions & 0 deletions Exec/RegTests/Bubble/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ Problem::init_custom_pert(
omn = std::max(0.0,std::min(1.0,(T-tbgmin)*a_bg));
} else if(moisture_type == 2) {
omn = 1.0;
} else {
omn = 0.0;
Abort("Bubble/prob.cpp: invalid moisture type specified");
}
Real qn = state_pert(i, j, k, RhoQ2_comp);
state_pert(i, j, k, RhoQ2_comp) = qn * omn;
Expand Down
2 changes: 1 addition & 1 deletion Exec/RegTests/WitchOfAgnesi/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Problem::init_custom_pert (

AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);

amrex::ParallelFor(bx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
{
// Set scalar = 0 everywhere
state_pert(i, j, k, RhoScalar_comp) = 0.0;
Expand Down
1 change: 1 addition & 0 deletions Source/BoundaryConditions/MOSTAverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ MOSTAverage::set_norm_indices_T()
if (z_target > z_lo && z_target < z_hi){
AMREX_ASSERT_WITH_MESSAGE(lk >= d_radius,
"K index must be larger than averaging radius!");
amrex::ignore_unused(d_radius);
k_arr(i,j,k) = lk;
break;
}
Expand Down
3 changes: 0 additions & 3 deletions Source/Microphysics/SAM/Precip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ SAM::Precip (const SolverChoice& sc)

// get the temperature, dentisy, theta, qt and qp from input
for ( MFIter mfi(*(mic_fab_vars[MicVar::tabs]),TilingIfNotGPU()); mfi.isValid(); ++mfi) {
auto rho_array = mic_fab_vars[MicVar::rho]->array(mfi);
auto theta_array = mic_fab_vars[MicVar::theta]->array(mfi);
auto tabs_array = mic_fab_vars[MicVar::tabs]->array(mfi);
auto pres_array = mic_fab_vars[MicVar::pres]->array(mfi);
Expand Down Expand Up @@ -235,5 +234,3 @@ SAM::Precip (const SolverChoice& sc)
});
}
}


4 changes: 2 additions & 2 deletions Source/SourceTerms/ERF_make_sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ void make_sources (int level,
// *****************************************************************************
// Planar averages for subsidence terms
// *****************************************************************************
Table1D<Real> dptr_r_plane, dptr_t_plane, dptr_qv_plane, dptr_qc_plane;
TableData<Real, 1> r_plane_tab, t_plane_tab, qv_plane_tab, qc_plane_tab;
Table1D<Real> dptr_r_plane, dptr_t_plane, dptr_qv_plane;
TableData<Real, 1> r_plane_tab, t_plane_tab, qv_plane_tab;
if (dptr_wbar_sub)
{
// Rho
Expand Down
1 change: 1 addition & 0 deletions Source/prob_common.H
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ public:
}
}
AMREX_ASSERT_WITH_MESSAGE(found, "Location read from terrain file does not match the grid!");
amrex::ignore_unused(found);
z_arr(i,j,klo) = zloc;
});
}
Expand Down

0 comments on commit 9abf6e0

Please sign in to comment.