Skip to content

Commit

Permalink
enable FPE traps in CI (#611)
Browse files Browse the repository at this point in the history
### Description
Enables signal handling and floating-point exception (FPE) traps for
NANs when running the test suite, so it will stop and report an error
when NANs are encountered. (This only works on CPUs.)

In order for this to work, we change the signal handling settings back
to AMReX defaults. We also have to suppress FPEs when importing `numpy`
(see numpy/numpy#20504).

By default, many compilers perform optimizations that assume that
floating-point exceptions are disabled, and will often produce spurious
FPEs for vectorized code (however, this does not affect the results in
any way). There are compiler-specific options to disable this behavior
for Intel and Clang.

Note that `AMReX_FPE=ON` only sets the compiler option `-ftrapv` (or
similar). We instead add the runtime options `amrex.fpe_trap_invalid=1`,
`amrex.fpe_trap_zero=1`, and `amrex.fpe_trap_overflow=1` to the
command-line arguments for each test. These options can also be added to
the input file (or command line) to debug individual problems.

**Depends on:**
* #667
* #668
* #671

### Related issues
Partially resolves #556.

### Checklist
_Before this pull request can be reviewed, all of these tasks should be
completed. Denote completed tasks with an `x` inside the square brackets
`[ ]` in the Markdown source below:_
- [x] I have added a description (see above).
- [x] I have added a link to any related issues see (see above).
- [x] I have read the [Contributing
Guide](https://github.com/quokka-astro/quokka/blob/development/CONTRIBUTING.md).
- [ ] I have added tests for any new physics that this PR adds to the
code.
- [x] I have tested this PR on my local computer and all tests pass.
- [x] I have manually triggered the GPU tests with the magic comment
`/azp run`.
- [x] I have requested a reviewer for this PR.

---------

Co-authored-by: Piyush Sharda <34922596+psharda@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 10, 2024
1 parent fda0b4a commit 14469c0
Show file tree
Hide file tree
Showing 53 changed files with 89 additions and 77 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cmake-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build
env: {CXXFLAGS: "-ffp-exception-behavior=strict"}
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: Build & Install
env: {CXXFLAGS: "-ffp-model=precise -fno-operator-names"}
env: {CXXFLAGS: "-ffp-model=precise -ffp-exception-behavior=strict -fno-operator-names"}
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ option(QUOKKA_PYTHON "Compile with Python support (on/off)" ON)
option(DISABLE_FMAD "Disable fused multiply-add instructions on GPU (on/off)" ON)
option(ENABLE_ASAN "Enable AddressSanitizer and UndefinedBehaviorSanitizer" OFF)
option(ENABLE_HWASAN "Enable HWAddressSanitizer" OFF)
option(ENABLE_TESTS_FPE "Enable floating-point exceptions when running tests" ON)
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF)
option(QUOKKA_OPENPMD "Enable OpenPMD output (on/off)" OFF)

Expand Down
2 changes: 1 addition & 1 deletion src/Advection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_advection)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME ScalarAdvection COMMAND test_advection advection_sawtooth.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME ScalarAdvection COMMAND test_advection advection_sawtooth.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/Advection2D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ if (AMReX_SPACEDIM GREATER_EQUAL 2)
setup_target_for_cuda_compilation(test_advection2d)
endif()

add_test(NAME Advection2D COMMAND test_advection2d advection2d_amr.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME Advection2D COMMAND test_advection2d advection2d_amr.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
endif()
2 changes: 1 addition & 1 deletion src/AdvectionSemiellipse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_advection_se)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME ScalarAdvectionSemiEllipse COMMAND test_advection_se advection_semiellipse.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME ScalarAdvectionSemiEllipse COMMAND test_advection_se advection_semiellipse.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
9 changes: 4 additions & 5 deletions src/AdvectionSimulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,13 @@ template <typename problem_t> void AdvectionSimulation<problem_t>::computeAfterE
{
// compute reference solution
const int ncomp = state_new_cc_[0].nComp();
const int nghost = state_new_cc_[0].nGrow();
amrex::MultiFab state_ref_level0(boxArray(0), DistributionMap(0), ncomp, nghost);
amrex::MultiFab state_ref_level0(boxArray(0), DistributionMap(0), ncomp, 0);
computeReferenceSolution(state_ref_level0, geom[0].CellSizeArray(), geom[0].ProbLoArray(), geom[0].ProbHiArray());

// compute error norm
amrex::MultiFab residual(boxArray(0), DistributionMap(0), ncomp, nghost);
amrex::MultiFab::Copy(residual, state_ref_level0, 0, 0, ncomp, nghost);
amrex::MultiFab::Saxpy(residual, -1., state_new_cc_[0], 0, 0, ncomp, nghost);
amrex::MultiFab residual(boxArray(0), DistributionMap(0), ncomp, 0);
amrex::MultiFab::Copy(residual, state_ref_level0, 0, 0, ncomp, 0);
amrex::MultiFab::Saxpy(residual, -1., state_new_cc_[0], 0, 0, ncomp, 0);

amrex::Real sol_norm = 0.;
amrex::Real err_norm = 0.;
Expand Down
2 changes: 1 addition & 1 deletion src/BinaryOrbitCIC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ if (AMReX_SPACEDIM EQUAL 3)
setup_target_for_cuda_compilation(binary_orbit)
endif()

add_test(NAME BinaryOrbitCIC COMMAND binary_orbit BinaryOrbit.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME BinaryOrbitCIC COMMAND binary_orbit BinaryOrbit.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
endif()
7 changes: 7 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ else()
message(STATUS "Fused multiply-add (FMAD) is *enabled* for device code. Exact direction symmetry will NOT be preserved.")
endif(DISABLE_FMAD)

if(ENABLE_TESTS_FPE)
set(QuokkaTestParams "amrex.fpe_trap_invalid=1 amrex.fpe_trap_overflow=1 amrex.fpe_trap_zero=1")
else()
set(QuokkaTestParams "")
message(STATUS "WARNING: Floating-point exceptions are *DISABLED* when running the test suite.")
endif(ENABLE_TESTS_FPE)

# emit error if warnings are produced
if(WARNINGS_AS_ERRORS)
add_compile_options(-Werror -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-strict-aliasing)
Expand Down
2 changes: 1 addition & 1 deletion src/FCQuantities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_fc_quantities)
endif()

add_test(NAME FCQuantities COMMAND test_fc_quantities fc_hydro_wave.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME FCQuantities COMMAND test_fc_quantities fc_hydro_wave.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/HydroBlast3D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ if (AMReX_SPACEDIM EQUAL 3)
setup_target_for_cuda_compilation(test_hydro3d_blast)
endif()

add_test(NAME HydroBlast3D COMMAND test_hydro3d_blast blast_unigrid_128.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME HydroBlast3D COMMAND test_hydro3d_blast blast_unigrid_128.in ${QuokkaTestParams} ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
endif()
2 changes: 1 addition & 1 deletion src/HydroContact/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_hydro_contact)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME HydroContact COMMAND test_hydro_contact contact_wave.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME HydroContact COMMAND test_hydro_contact contact_wave.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/HydroHighMach/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_hydro_highmach)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME HydroHighMach COMMAND test_hydro_highmach HighMach.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME HydroHighMach COMMAND test_hydro_highmach HighMach.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/HydroLeblanc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_hydro_leblanc)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME HydroLeblanc COMMAND test_hydro_leblanc leblanc.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME HydroLeblanc COMMAND test_hydro_leblanc leblanc.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/HydroQuirk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ if (AMReX_SPACEDIM GREATER_EQUAL 2)
setup_target_for_cuda_compilation(test_quirk)
endif()

add_test(NAME HydroQuirk COMMAND test_quirk quirk.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME HydroQuirk COMMAND test_quirk quirk.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
endif()
2 changes: 1 addition & 1 deletion src/HydroSMS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_hydro_sms)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME HydroSlowMovingShock COMMAND test_hydro_sms SlowMovingShock.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME HydroSlowMovingShock COMMAND test_hydro_sms SlowMovingShock.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/HydroShocktube/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_hydro_shocktube)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME HydroShocktube COMMAND test_hydro_shocktube shocktube.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME HydroShocktube COMMAND test_hydro_shocktube shocktube.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/HydroShocktubeCMA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_hydro_shocktube_cma)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME HydroShocktubeCMA COMMAND test_hydro_shocktube_cma shocktube_cma.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME HydroShocktubeCMA COMMAND test_hydro_shocktube_cma shocktube_cma.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/HydroShuOsher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_hydro_shuosher)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME ShuOsher COMMAND test_hydro_shuosher ShuOsher.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME ShuOsher COMMAND test_hydro_shuosher ShuOsher.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/HydroVacuum/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_hydro_vacuum)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME HydroVacuum COMMAND test_hydro_vacuum vacuum.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME HydroVacuum COMMAND test_hydro_vacuum vacuum.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/HydroWave/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_hydro_wave)
endif()

add_test(NAME HydroWave COMMAND test_hydro_wave hydro_wave.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME HydroWave COMMAND test_hydro_wave hydro_wave.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/NSCBC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_channel_flow)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME ChannelFlow COMMAND test_channel_flow NSCBC_Channel.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME ChannelFlow COMMAND test_channel_flow NSCBC_Channel.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)

if (AMReX_SPACEDIM GREATER_EQUAL 2)
add_executable(test_vortex vortex.cpp ${QuokkaObjSources})
Expand Down
2 changes: 1 addition & 1 deletion src/ODEIntegration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_ode)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME ODEIntegration COMMAND test_ode ODE.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME ODEIntegration COMMAND test_ode ODE.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/PassiveScalar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_scalars)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME PassiveScalar COMMAND test_scalars PassiveScalar.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME PassiveScalar COMMAND test_scalars PassiveScalar.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
6 changes: 3 additions & 3 deletions src/PopIII/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ if (AMReX_SPACEDIM EQUAL 3)
endif()


add_test(NAME ComputePerturbations COMMAND python3 ${CMAKE_SOURCE_DIR}/src/perturbation.py --kmin=2 --kmax=${result} --size=${first_digits} --alpha=1.8 --f_solenoidal=0.66667 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME PopIII COMMAND popiii PopIII.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME ComputePerturbations COMMAND python3 ${CMAKE_SOURCE_DIR}/src/perturbation.py --kmin=2 --kmax=${result} --size=${first_digits} --alpha=1.8 --f_solenoidal=0.66667 ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME PopIII COMMAND popiii PopIII.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
set_tests_properties(ComputePerturbations PROPERTIES FIXTURES_SETUP PopIII_fixture)
set_tests_properties(PopIII PROPERTIES FIXTURES_REQUIRED PopIII_fixture)

# AMR test only works on Setonix because Gadi and avatar do not have enough memory per GPU
# add_test(NAME PopIIIAMR COMMAND popiii popiii_AMR.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
# add_test(NAME PopIIIAMR COMMAND popiii popiii_AMR.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
endif()
2 changes: 1 addition & 1 deletion src/PrimordialChem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_primordial_chem)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME PrimordialChem COMMAND test_primordial_chem primordial_chem.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME PrimordialChem COMMAND test_primordial_chem primordial_chem.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/RadForce/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_radiation_force)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME RadForce COMMAND test_radiation_force RadForce.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME RadForce COMMAND test_radiation_force RadForce.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/RadMarshak/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_radiation_marshak)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME MarshakWave COMMAND test_radiation_marshak Marshak.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME MarshakWave COMMAND test_radiation_marshak Marshak.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/RadMarshakAsymptotic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_radiation_marshak_asymptotic)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME MarshakWaveAsymptoticDiffusion COMMAND test_radiation_marshak_asymptotic MarshakAsymptotic.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME MarshakWaveAsymptoticDiffusion COMMAND test_radiation_marshak_asymptotic MarshakAsymptotic.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/RadMarshakCGS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_radiation_marshak_cgs)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME MarshakWaveCGS COMMAND test_radiation_marshak_cgs MarshakCGS.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME MarshakWaveCGS COMMAND test_radiation_marshak_cgs MarshakCGS.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/RadMatterCoupling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_radiation_matter_coupling)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME MatterEnergyExchange COMMAND test_radiation_matter_coupling energyexchange.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME MatterEnergyExchange COMMAND test_radiation_matter_coupling energyexchange.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/RadMatterCouplingRSLA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_radiation_matter_coupling_rsla)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME MatterEnergyExchangeRSLA COMMAND test_radiation_matter_coupling_rsla MatterEnergyExchangeRSLA.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME MatterEnergyExchangeRSLA COMMAND test_radiation_matter_coupling_rsla MatterEnergyExchangeRSLA.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/RadPulse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_radiation_pulse)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME RadiationPulse COMMAND test_radiation_pulse RadPulse.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME RadiationPulse COMMAND test_radiation_pulse RadPulse.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/RadStreaming/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_radiation_streaming)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME RadiationStreaming COMMAND test_radiation_streaming RadStreaming.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME RadiationStreaming COMMAND test_radiation_streaming RadStreaming.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/RadStreamingY/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ if (AMReX_SPACEDIM GREATER_EQUAL 2)
setup_target_for_cuda_compilation(test_radiation_streaming_y)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME RadiationStreamingY COMMAND test_radiation_streaming_y RadStreamingY.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME RadiationStreamingY COMMAND test_radiation_streaming_y RadStreamingY.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
endif()
2 changes: 1 addition & 1 deletion src/RadSuOlson/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_radiation_SuOlson)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME SuOlsonTest COMMAND test_radiation_SuOlson SuOlson.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME SuOlsonTest COMMAND test_radiation_SuOlson SuOlson.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
6 changes: 6 additions & 0 deletions src/RadSuOlson/test_radiation_SuOlson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ template <> struct RadSystem_Traits<MarshakProblem> {
static constexpr int beta_order = 0;
};

template <> struct quokka::EOS_Traits<MarshakProblem> {
static constexpr double mean_molecular_weight = 1.0;
static constexpr double boltzmann_constant = 1.0;
static constexpr double gamma = 5. / 3.;
};

template <> struct Physics_Traits<MarshakProblem> {
// cell-centred
static constexpr bool is_hydro_enabled = false;
Expand Down
2 changes: 1 addition & 1 deletion src/RadTube/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_radiation_tube)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME RadiationPressureTube COMMAND test_radiation_tube RadTube.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME RadiationPressureTube COMMAND test_radiation_tube RadTube.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
1 change: 1 addition & 0 deletions src/RadTube/test_radiation_tube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ template <> void RadhydroSimulation<TubeProblem>::setInitialConditionsOnGrid(quo
amrex::Real const Pgas = interpolate_value(x, x_ptr, Pgas_ptr, x_size);
amrex::Real const Erad = interpolate_value(x, x_ptr, Erad_ptr, x_size);
amrex::Real const Tgas = Pgas / C::k_B * mu / rho;
AMREX_ASSERT(!std::isnan(rho));

// calculate radEnergyFractions based on the boundary conditions
auto radEnergyFractions = RadSystem<TubeProblem>::ComputePlanckEnergyFractions(radBoundaries_g, Tgas);
Expand Down
2 changes: 1 addition & 1 deletion src/RadhydroPulse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ if (AMReX_SPACEDIM EQUAL 1)
setup_target_for_cuda_compilation(test_radhydro_pulse)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME RadhydroPulse COMMAND test_radhydro_pulse RadhydroPulse.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME RadhydroPulse COMMAND test_radhydro_pulse RadhydroPulse.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
endif()
2 changes: 1 addition & 1 deletion src/RadhydroPulseDyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ if (AMReX_SPACEDIM EQUAL 1)
setup_target_for_cuda_compilation(test_radhydro_pulse_dyn)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME RadhydroPulseDyn COMMAND test_radhydro_pulse_dyn RadhydroPulseDyn.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME RadhydroPulseDyn COMMAND test_radhydro_pulse_dyn RadhydroPulseDyn.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
endif()
2 changes: 1 addition & 1 deletion src/RadhydroPulseGrey/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ if (AMReX_SPACEDIM EQUAL 1)
setup_target_for_cuda_compilation(test_radhydro_pulse_grey)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME RadhydroPulseGrey COMMAND test_radhydro_pulse_grey RadhydroPulseGrey.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME RadhydroPulseGrey COMMAND test_radhydro_pulse_grey RadhydroPulseGrey.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
endif()
2 changes: 1 addition & 1 deletion src/RadhydroPulseMG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_radhydro_pulse_MG)
endif(AMReX_GPU_BACKEND MATCHES "CUDA")

add_test(NAME RadhydroPulseMG COMMAND test_radhydro_pulse_MG RadhydroPulse.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME RadhydroPulseMG COMMAND test_radhydro_pulse_MG RadhydroPulse.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
2 changes: 1 addition & 1 deletion src/RadhydroPulseMGint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ endif(AMReX_GPU_BACKEND MATCHES "CUDA")
# mkdir -p WORK_PATH
# file(MAKE_DIRECTORY ${WORK_PATH})

add_test(NAME RadhydroPulseMGint COMMAND test_radhydro_pulse_MG_int RadhydroPulse.in WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_test(NAME RadhydroPulseMGint COMMAND test_radhydro_pulse_MG_int RadhydroPulse.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
Loading

0 comments on commit 14469c0

Please sign in to comment.