Skip to content

Commit

Permalink
add a compiler warning CI (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored May 17, 2024
1 parent 1655a05 commit 74e11b5
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/compiler-warnings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "compiler warnings"

on: [pull_request]

concurrency:
group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
compiler_warnings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get submodules
run: |
git submodule update --init
cd external/Microphysics
git fetch; git checkout development
cd ../amrex
git fetch; git checkout development
cd ../..
- name: Install dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get -qq -y install curl g++>=9.3.0
- name: Compile wdconvect
run: |
cd Exec/science/wdconvect
make USE_MPI=FALSE USE_OMP=FALSE DEBUG=TRUE WARN_ALL=TRUE WARN_ERROR=TRUE -j 4
- name: Compile reacting_bubble
run: |
cd Exec/test_problems/reacting_bubble
make USE_MPI=FALSE USE_OMP=FALSE DEBUG=TRUE DIM=2 WARN_ALL=TRUE WARN_ERROR=TRUE -j 4
8 changes: 8 additions & 0 deletions Exec/test_problems/reacting_bubble/MaestroInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ void Perturb(const Real p0_init, const Real* s0, Real* perturbations,
// initializes data on a specific level
void Maestro::InitLevelData(const int lev, const Real time, const MFIter& mfi,
const Array4<Real> scal, const Array4<Real> vel) {

amrex::ignore_unused(time);

// timer for profiling
BL_PROFILE_VAR("Maestro::InitLevelData()", InitLevelData);

Expand Down Expand Up @@ -91,6 +94,9 @@ void Maestro::InitLevelData(const int lev, const Real time, const MFIter& mfi,

void Maestro::InitLevelDataSphr(const int lev, const Real time, MultiFab& scal,
MultiFab& vel) {

amrex::ignore_unused(time);

// timer for profiling
BL_PROFILE_VAR("Maestro::InitLevelDataSphr()", InitLevelDataSphr);

Expand Down Expand Up @@ -282,6 +288,8 @@ void Perturb(const Real p0_init, const Real* s0, Real* perturbations,
const Real x, const Real y, const Real z) {
Real t0 = s0[Temp];

amrex::ignore_unused(z);

#if (AMREX_SPACEDIM == 2)

Real x1 = 5.0e7;
Expand Down
6 changes: 6 additions & 0 deletions Exec/test_problems/reacting_bubble/MaestroTagging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ void Maestro::RetagArray(const Box& bx, const int lev) {

void Maestro::TagBoxes(TagBoxArray& tags, const MFIter& mfi, const int lev,
const Real time) {

amrex::ignore_unused(time);

// timer for profiling
BL_PROFILE_VAR("Maestro::TagBoxes()", TagBoxes);

Expand All @@ -45,6 +48,9 @@ void Maestro::TagBoxes(TagBoxArray& tags, const MFIter& mfi, const int lev,

void Maestro::StateError(TagBoxArray& tags, const MultiFab& state_mf,
const MFIter& mfi, const int lev, const Real time) {

amrex::ignore_unused(time);

// timer for profiling
BL_PROFILE_VAR("Maestro::StateError()", StateError);

Expand Down
10 changes: 10 additions & 0 deletions Source/MaestroDiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ void Maestro::DiagFile(const int step, const Real t_in,
if (spherical) {
#if (AMREX_SPACEDIM == 3)
// is it one of the 8 zones surrounding the center?
#ifdef _OPENMP
#pragma omp critical
#endif
if (std::abs(x - center[0]) < dx[0] &&
std::abs(y - center[1]) < dx[1] &&
std::abs(z - center[2]) < dx[2]) {
Expand Down Expand Up @@ -213,7 +215,9 @@ void Maestro::DiagFile(const int step, const Real t_in,
amrex::Math::powi<2>(u(i, j, k, 2) + 0.5 * (w0macz(i, j, k) + w0macz(i, j, k + 1))));

// max T, location, and velocity at that location (including w0)
#ifdef _OPENMP
#pragma omp critical
#endif
if (scal(i, j, k, Temp) > T_max_local) {
T_max_local = scal(i, j, k, Temp);
coord_Tmax_local[0] = x;
Expand All @@ -228,7 +232,9 @@ void Maestro::DiagFile(const int step, const Real t_in,
}

// max enuc
#ifdef _OPENMP
#pragma omp critical
#endif
if (rho_Hnuc_arr(i, j, k) / scal(i, j, k, Rho) > enuc_max_local) {
enuc_max_local = rho_Hnuc_arr(i, j, k) / scal(i, j, k, Rho);
coord_enucmax_local[0] = x;
Expand All @@ -255,7 +261,9 @@ void Maestro::DiagFile(const int step, const Real t_in,
#endif

// max T, location, and velocity at that location (including w0)
#ifdef _OPENMP
#pragma omp critical
#endif
if (scal(i, j, k, Temp) > T_max_local) {
T_max_local = scal(i, j, k, Temp);
coord_Tmax_local[0] = x;
Expand All @@ -275,7 +283,9 @@ void Maestro::DiagFile(const int step, const Real t_in,
}

// max enuc
#ifdef _OPENMP
#pragma omp critical
#endif
if (rho_Hnuc_arr(i, j, k) / scal(i, j, k, Rho) > enuc_max_local) {
enuc_max_local = rho_Hnuc_arr(i, j, k) / scal(i, j, k, Rho);
coord_enucmax_local[0] = x;
Expand Down

0 comments on commit 74e11b5

Please sign in to comment.