Skip to content

Commit

Permalink
Add CMake flag WarpX_TEST_FPETRAP
Browse files Browse the repository at this point in the history
  • Loading branch information
EZoni committed Aug 30, 2024
1 parent 0a3cd9a commit d4d58eb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
6 changes: 5 additions & 1 deletion .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ jobs:
df -h
# configure
export AMReX_CMAKE_FLAGS="-DAMReX_ASSERTIONS=ON -DAMReX_TESTING=ON"
cmake -S . -B build ${AMReX_CMAKE_FLAGS} ${WARPX_CMAKE_FLAGS} -DWarpX_TEST_CLEANUP=ON
cmake -S . -B build \
${AMReX_CMAKE_FLAGS} \
${WARPX_CMAKE_FLAGS} \
-DWarpX_TEST_CLEANUP=ON \
-DWarpX_TEST_FPETRAP=ON
# build
cmake --build build -j 2
# run tests (exclude pytest.AMReX when running Python tests)
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ option(WarpX_QED_TOOLS "Build external tool to generate QED lookup tables (r
option(WarpX_TEST_CLEANUP "Clean up CI test directories" OFF)
mark_as_advanced(WarpX_TEST_CLEANUP)

# Advanced option to run CI tests with FPE-trapping runtime parameters
option(WarpX_TEST_FPETRAP "Run CI tests with FPE-trapping runtime parameters" OFF)
mark_as_advanced(WarpX_TEST_FPETRAP)

set(WarpX_DIMS_VALUES 1 2 3 RZ)
set(WarpX_DIMS 3 CACHE STRING "Simulation dimensionality <1;2;3;RZ>")
list(REMOVE_DUPLICATES WarpX_DIMS)
Expand Down
21 changes: 14 additions & 7 deletions Examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function(add_warpx_test
)

# set Python executable
set(THIS_Python_EXE)
set(THIS_Python_EXE) # FIXME unsetting a variable can expose a cache variable that was previously hidden
if(python)
set(THIS_Python_EXE ${Python_EXECUTABLE})
endif()
Expand All @@ -138,25 +138,32 @@ function(add_warpx_test
# FIXME Use helper function to handle Windows exceptions
set_property(TEST ${name}.run APPEND PROPERTY ENVIRONMENT "PYTHONPATH=${PYTHONPATH}:${CMAKE_PYTHON_OUTPUT_DIRECTORY}")
else()
# TODO Use these for Python tests too
set(runtime_params
"amrex.abort_on_unused_inputs = 1"
"amrex.fpe_trap_invalid = 1"
"amrex.fpe_trap_overflow = 1"
"amrex.fpe_trap_zero = 1"
"amrex.throw_exception = 1"
"warpx.always_warn_immediately = 1"
# FIXME should come before input file
#"warpx.abort_on_warning_threshold = low"
"warpx.do_dynamic_scheduling = 0"
"warpx.serialize_initial_conditions = 1"
# FIXME should go before input file
#"warpx.abort_on_warning_threshold = low"
)
set(runtime_params_fpetrap "")
if(WarpX_TEST_FPETRAP)
set(runtime_params_fpetrap
"amrex.fpe_trap_invalid = 1"
"amrex.fpe_trap_overflow = 1"
"amrex.fpe_trap_zero = 1"
)
endif()
add_test(
NAME ${name}.run
COMMAND
${THIS_MPI_TEST_EXE}
$<TARGET_FILE:app_${SD}>
${INPUTS_FILE}
${runtime_params}
${runtime_params_fpetrap}
${INPUTS_ARGS}
WORKING_DIRECTORY ${THIS_WORKING_DIR}
)
Expand All @@ -165,7 +172,7 @@ function(add_warpx_test
# run all tests with 1 OpenMP thread by default
set_property(TEST ${name}.run APPEND PROPERTY ENVIRONMENT "OMP_NUM_THREADS=1")

set(THIS_Python_SCRIPT_EXE)
set(THIS_Python_SCRIPT_EXE) # FIXME unsetting a variable can expose a cache variable that was previously hidden
if(python OR WIN32)
set(THIS_Python_SCRIPT_EXE ${Python_EXECUTABLE})
endif()
Expand Down

0 comments on commit d4d58eb

Please sign in to comment.