Skip to content

Commit 563813b

Browse files
roelof-groenewaldax3lpeterscherpelz
authored
Add XplaneEmitter and ZCylinderEmitter (#132)
* CI: mpi4py breaking setuptools API (BLAST-WarpX#2713) setuptools keeps breaking its API, which currently breaks `mpi4py` installs. Until a new mpi4py release is cut, this will serve as a work-around * Regression Testing: Use Mainline & CMake (BLAST-WarpX#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) * Add x and r emitters (#131) * CI: mpi4py breaking setuptools API setuptools keeps breaking its API, which currently breaks `mpi4py` installs. Until a new mpi4py release is cut, this will serve as a work-around * added XPlaneEmitter and CI test for it * circleCI fix for mpi4py issue with new setuptools * try number 2 for fixing circleCI * try number 3 to fix circleCI * added ZCylinderEmitter and CI test for it * allow Dirichlet BCs in r when r_min != 0 with ES RZ simulations * added example file for a cylindrical vacuum TEC * allow either Dirichlet or Neumann BCs at rmax when rmin == 0 * temporary change to show that CI tests pass after changes to ES solver * added CI test of EB InfCylinderZ * changed default BC at rmax to Neumann for RZ simulations created from the setup_store * update changelog and version number plus first round of suggested changes from code review * Apply suggestions from code review Co-authored-by: Peter Scherpelz <[email protected]> * further requested review changes * change xsign and rsign to xdir and rdir * missed API change updates * Update bounds handling XPlaneEmitter Co-authored-by: Peter Scherpelz <[email protected]> * changed InfCylinderZ to CylinderZ and added optional z limits * Apply suggestions from code review Co-authored-by: Peter Scherpelz <[email protected]> Co-authored-by: Axel Huebl <[email protected]> Co-authored-by: Peter Scherpelz <[email protected]> Co-authored-by: Axel Huebl <[email protected]> Co-authored-by: Peter Scherpelz <[email protected]>
2 parents a41953c + e624a77 commit 563813b

File tree

27 files changed

+1197
-129
lines changed

27 files changed

+1197
-129
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

.circleci/export_vars.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ export WARPX_QED=OFF
88
export WARPX_EB=ON
99
export CC=$(which clang)
1010
export CXX=$(which clang++)
11+
12+
export SETUPTOOLS_USE_DISTUTILS=stdlib

.github/workflows/cuda.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ jobs:
1818
env:
1919
CXXFLAGS: "-Werror"
2020
CMAKE_GENERATOR: Ninja
21+
# setuptools/mp4py work-around, see
22+
# https://github.com/mpi4py/mpi4py/pull/159
23+
# https://github.com/mpi4py/mpi4py/issues/157#issuecomment-1001022274
24+
SETUPTOOLS_USE_DISTUTILS: stdlib
2125
steps:
2226
- uses: actions/checkout@v2
2327
- name: install dependencies
@@ -60,9 +64,13 @@ jobs:
6064
name: [email protected] NVCC/NVC++ Release [tests]
6165
runs-on: ubuntu-20.04
6266
if: github.event.pull_request.draft == false
63-
# For NVHPC, Ninja is slower than the default:
64-
#env:
65-
# CMAKE_GENERATOR: Ninja
67+
env:
68+
# For NVHPC, Ninja is slower than the default:
69+
#CMAKE_GENERATOR: Ninja
70+
# setuptools/mp4py work-around, see
71+
# https://github.com/mpi4py/mpi4py/pull/159
72+
# https://github.com/mpi4py/mpi4py/issues/157#issuecomment-1001022274
73+
SETUPTOOLS_USE_DISTUTILS: stdlib
6674
steps:
6775
- uses: actions/checkout@v2
6876
- name: Dependencies

.github/workflows/macos.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ concurrency:
77
cancel-in-progress: true
88

99
jobs:
10-
build_gcc9:
10+
build_appleclang:
1111
name: AppleClang
1212
runs-on: macos-latest
1313
if: github.event.pull_request.draft == false
1414
env:
1515
CXXFLAGS: "-Werror -Wno-error=pass-failed"
16-
# For macOS, Ninja is slower than the default:
17-
# CMAKE_GENERATOR: Ninja
16+
# For macOS, Ninja is slower than the default:
17+
#CMAKE_GENERATOR: Ninja
18+
# setuptools/mp4py work-around, see
19+
# https://github.com/mpi4py/mpi4py/pull/159
20+
# https://github.com/mpi4py/mpi4py/issues/157#issuecomment-1001022274
21+
SETUPTOOLS_USE_DISTUTILS: stdlib
1822
steps:
1923
- uses: actions/checkout@v2
2024
- name: install dependencies

.github/workflows/ubuntu.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,13 @@ jobs:
5959
name: Clang pywarpx
6060
runs-on: ubuntu-20.04
6161
if: github.event.pull_request.draft == false
62-
# On CI for this test, Ninja is slower than the default:
63-
#env:
64-
# CMAKE_GENERATOR: Ninja
62+
env:
63+
# On CI for this test, Ninja is slower than the default:
64+
#CMAKE_GENERATOR: Ninja
65+
# setuptools/mp4py work-around, see
66+
# https://github.com/mpi4py/mpi4py/pull/159
67+
# https://github.com/mpi4py/mpi4py/issues/157#issuecomment-1001022274
68+
SETUPTOOLS_USE_DISTUTILS: stdlib
6569
steps:
6670
- uses: actions/checkout@v2
6771
- name: install dependencies

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 :

Python/pywarpx/_libwarpx.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,10 @@ def get_boundary_number(self, boundary):
315315
'''
316316
if self.geometry_dim == '3d':
317317
dimensions = {'x' : 0, 'y' : 1, 'z' : 2}
318-
elif self.geometry_dim == '2d':
318+
elif self.geometry_dim == '2d' or self.geometry_dim == 'rz':
319319
dimensions = {'x' : 0, 'z' : 1}
320320
elif self.geometry_dim == '1d':
321321
dimensions = {'z' : 0}
322-
elif self.geometry_dim == 'rz':
323-
dimensions = {'r': 0, 'z': 1}
324322
else:
325323
raise RuntimeError(f"Unknown simulation geometry: {self.geometry_dim}")
326324

@@ -337,7 +335,7 @@ def get_boundary_number(self, boundary):
337335
else:
338336
if self.geometry_dim == '3d':
339337
boundary_num = 6
340-
elif self.geometry_dim == '2d':
338+
elif self.geometry_dim == '2d' or self.geometry_dim == 'rz':
341339
boundary_num = 4
342340
elif self.geometry_dim == '1d':
343341
boundary_num = 2

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)