Skip to content

Commit 5f8f8c8

Browse files
authored
Regression Testing: Use Mainline & CMake (#2556)
* Regression testing: Use mainline * Update WarpX-tests.ini - Add `cmakeSetupOpts =` - Add `-DWarpX_DIMS`: Not an AMReX convention, so we cannot rely on `dim = ...` - Skip building unneeded tools - Add `install_pip` target: Calling `python -m pip wheel .` and install re-using the build directory. This is mainly for our CI Python regression scrips, users and package managers should just use `python -m pip wheel .` and `... install *whl` directly. * LaserInjectionFromTXYEFile: General Exe Generalize executable globber in script * Docs: Update Regression Testing (CMake) * Azure: Ninja Builds (CMake)
1 parent 7583728 commit 5f8f8c8

File tree

8 files changed

+237
-58
lines changed

8 files changed

+237
-58
lines changed

.azure-pipelines.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
BLASPP_HOME: '/usr/local'
1414
CEI_SUDO: 'sudo'
1515
CEI_TMP: '/tmp/cei'
16+
CMAKE_GENERATOR: 'Ninja'
1617
FFTW_HOME: '/usr'
1718
LAPACKPP_HOME: '/usr/local'
1819
OMP_NUM_THREADS: 1
@@ -75,7 +76,8 @@ jobs:
7576
set -eu -o pipefail
7677
cat /proc/cpuinfo | grep "model name" | sort -u
7778
df -h
78-
sudo apt install -y ccache curl gcc gfortran git g++ openmpi-bin libopenmpi-dev \
79+
sudo apt install -y ccache curl gcc gfortran git g++ ninja-build \
80+
openmpi-bin libopenmpi-dev \
7981
libfftw3-dev libfftw3-mpi-dev libhdf5-openmpi-dev pkg-config make \
8082
python3 python3-pip python3-venv python3-setuptools libblas-dev liblapack-dev
8183
ccache --set-config=max_size=10.0G

CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,25 @@ endif()
391391
#)
392392

393393

394+
# CI Helper ###################################################################
395+
#
396+
397+
# calling `python -m pip wheel .` and install re-using the build directory
398+
# note: this is mainly for our CI Python regression scripts, users and package
399+
# managers should just use `python -m pip wheel .` and `... install *whl`
400+
# directly
401+
set(PYINSTALLOPTIONS "" CACHE STRING "Additional parameters to pass to `pip install`")
402+
add_custom_target(install_pip
403+
${CMAKE_COMMAND} -E env PYWARPX_LIB_DIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} python3 -m pip wheel -v --use-feature=in-tree-build ${WarpX_SOURCE_DIR}
404+
COMMAND
405+
python3 -m pip install --force-reinstall -v ${PYINSTALLOPTIONS} ${CMAKE_BINARY_DIR}/*whl
406+
WORKING_DIRECTORY
407+
${CMAKE_BINARY_DIR}
408+
DEPENDS
409+
shared
410+
)
411+
412+
394413
# Tests #######################################################################
395414
#
396415

Docs/source/developers/testing.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,12 @@ There are three steps to follow to add a new automated test (illustrated here fo
8989
runtime_params = warpx.do_dynamic_scheduling=0 algo.maxwell_solver=yee
9090
dim = 2
9191
addToCompileString =
92+
cmakeSetupOpts = -DWarpX_DIMS=2
9293
restartTest = 0
9394
useMPI = 1
9495
numprocs = 2
9596
useOMP = 1
96-
numthreads = 2
97+
numthreads = 1
9798
compileTest = 0
9899
doVis = 0
99100
analysisRoutine = Examples/Tests/PML/analysis_pml_yee.py
@@ -104,8 +105,14 @@ If you re-use an existing input file, you can add arguments to ``runtime_params`
104105

105106
If you added ``analysisRoutine = Examples/analysis_default_regression.py``, then run the new test case locally and add the :ref:`checksum <developers-checksum>` file for the expected output.
106107

108+
.. note::
109+
110+
We run those tests on our continuous integration services, which at the moment only have 2 virtual CPU cores.
111+
Thus, make sure that the product of ``numprocs`` and ``numthreads`` for a test is ``<=2``.
112+
113+
107114
Useful tool for plotfile comparison: ``fcompare``
108-
--------------------------------------------------
115+
-------------------------------------------------
109116

110117
AMReX provides ``fcompare``, an executable that takes two ``plotfiles`` as input and returns the absolute and relative difference for each field between these two plotfiles. For some changes in the code, it is very convenient to run the same input file with an old and your current version, and ``fcompare`` the plotfiles at the same iteration. To use it:
111118

Examples/Modules/laser_injection_from_file/analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def launch_analysis(executable):
218218

219219

220220
def main() :
221-
executables = glob.glob("main2d*")
221+
executables = glob.glob("*.ex")
222222
if len(executables) == 1 :
223223
launch_analysis(executables[0])
224224
else :

Regression/WarpX-GPU-tests.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ purge_output = 1
1919
MAKE = make
2020
numMakeJobs = 8
2121

22+
# We build by default a few tools for output comparison.
23+
# The build time for those can be skipped if they are not needed.
24+
ftools =
25+
2226
# Control the build of the particle_compare tool.
2327
# Needed for test particle_tolerance option.
2428
use_ctools = 0

0 commit comments

Comments
 (0)