Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/development' into dashboard/sp…
Browse files Browse the repository at this point in the history
…ace_charge_configuration
  • Loading branch information
proy30 committed Oct 21, 2024
2 parents 32f011d + c26d849 commit 2ddadf9
Show file tree
Hide file tree
Showing 133 changed files with 2,417 additions and 394 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,29 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.x'

- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install --yes cmake openmpi-bin libfftw3-dev libfftw3-mpi-dev libopenmpi-dev libhdf5-openmpi-dev
python -m pip install --upgrade pip
python -m pip install --upgrade pipx
python -m pip install --upgrade wheel
python -m pip install --upgrade cmake
export CMAKE="$HOME/.local/bin/cmake" && echo "CMAKE=$CMAKE" >> $GITHUB_ENV
python -m pip install --upgrade numpy
python -m pip install --upgrade mpi4py
python -m pip install --upgrade pytest
python -m pip install --upgrade cmake
python -m pipx install cmake
- name: Configure (C++)
if: ${{ matrix.language == 'cpp' }}
run: |
$CMAKE -S . -B build -DImpactX_FFT=ON -DImpactX_PYTHON=OFF
cmake -S . -B build -DImpactX_FFT=ON -DImpactX_PYTHON=OFF
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand All @@ -64,7 +70,7 @@ jobs:
- name: Build (C++)
if: ${{ matrix.language == 'cpp' }}
run: |
$CMAKE --build build -j 4
cmake --build build -j 4
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
Expand Down
25 changes: 9 additions & 16 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ jobs:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: TRUE
steps:
- uses: actions/checkout@v4
- name: install dependencies
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.x'
- name: install brew dependencies
run: |
set +e
brew unlink gcc
brew update
brew install --overwrite python
brew install adios2
brew install ccache
brew install cmake
Expand All @@ -32,19 +35,15 @@ jobs:
brew install ninja
brew install open-mpi
brew install pkg-config
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade virtualenv
python3 -m venv py-venv
source py-venv/bin/activate
set -e
- name: install pip dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build packaging setuptools wheel pytest
python3 -m pip install --upgrade -r requirements_mpi.txt
python3 -m pip install --upgrade -r src/python/impactx/dashboard/requirements.txt
python3 -m pip install --upgrade -r examples/requirements.txt
python3 -m pip install --upgrade -r tests/python/requirements.txt
set -e
python3 -m pip install --upgrade pipx
python3 -m pipx install openPMD-validator
- name: CCache Cache
Expand All @@ -65,29 +64,23 @@ jobs:
export CCACHE_SLOPPINESS=time_macros
ccache -z
source py-venv/bin/activate
cmake -S . -B build \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DImpactX_FFT=ON \
-DImpactX_PYTHON=ON \
-DPython_EXECUTABLE=$(which python3)
-DImpactX_PYTHON=ON
cmake --build build -j 3
du -hs ~/Library/Caches/ccache
ccache -s
- name: run tests
run: |
source py-venv/bin/activate
ctest --test-dir build --output-on-failure -E pytest.AMReX
- name: run installed python module
run: |
cmake --build build --target pip_install
source py-venv/bin/activate
python3 examples/fodo/run_fodo.py
- name: run installed app
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
Expand Down Expand Up @@ -66,7 +66,7 @@ repos:
# Python: Ruff linter & formatter
# https://docs.astral.sh/ruff/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
rev: v0.6.9
hooks:
# Run the linter
- id: ruff
Expand All @@ -86,7 +86,7 @@ repos:

# Checks the manifest for missing files (native support)
- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
rev: "0.50"
hooks:
- id: check-manifest
# This is a slow hook, so only run this if --hook-stage manual is passed
Expand Down
14 changes: 9 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Preamble ####################################################################
#
cmake_minimum_required(VERSION 3.24.0)
project(ImpactX VERSION 24.09)
project(ImpactX VERSION 24.10)

include(${ImpactX_SOURCE_DIR}/cmake/ImpactXFunctions.cmake)

Expand Down Expand Up @@ -136,7 +136,7 @@ impactx_make_third_party_includes_system(WarpX::ablastr_3d ablastr_3d)

# Python
if(ImpactX_PYTHON)
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED)

# default installation directories: Python
impactx_set_default_install_dirs_python()
Expand Down Expand Up @@ -394,9 +394,9 @@ install(CODE "file(CREATE_LINK
#
if(ImpactX_PYTHON)
set(PY_PIP_OPTIONS "-v" CACHE STRING
"Additional parameters to pass to `pip`")
"Additional parameters to pass to `pip` as ; separated list")
set(PY_PIP_INSTALL_OPTIONS "" CACHE STRING
"Additional parameters to pass to `pip install`")
"Additional parameters to pass to `pip install` as ; separated list")

# add a prefix to custom targets so we do not collide if used as a subproject
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
Expand All @@ -412,7 +412,8 @@ if(ImpactX_PYTHON)
${CMAKE_COMMAND} -E rm -f -r impactx-whl
COMMAND
${CMAKE_COMMAND} -E env PYIMPACTX_LIBDIR=$<TARGET_FILE_DIR:pyImpactX>
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} wheel --no-build-isolation --no-deps --wheel-dir=impactx-whl ${ImpactX_SOURCE_DIR}
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} wheel --no-build-isolation --no-deps --wheel-dir=impactx-whl "${ImpactX_SOURCE_DIR}"
COMMAND_EXPAND_LISTS VERBATIM
WORKING_DIRECTORY
${ImpactX_BINARY_DIR}
DEPENDS
Expand All @@ -427,6 +428,7 @@ if(ImpactX_PYTHON)
endif()
add_custom_target(${ImpactX_CUSTOM_TARGET_PREFIX}pip_install_requirements
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} install ${PY_PIP_INSTALL_OPTIONS} -r "${ImpactX_SOURCE_DIR}/${pyImpactX_REQUIREMENT_FILE}"
COMMAND_EXPAND_LISTS VERBATIM
WORKING_DIRECTORY
${ImpactX_BINARY_DIR}
)
Expand All @@ -444,6 +446,7 @@ if(ImpactX_PYTHON)
add_custom_target(${ImpactX_CUSTOM_TARGET_PREFIX}pip_install
${CMAKE_COMMAND} -E env IMPACTX_MPI=${ImpactX_MPI}
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} install --force-reinstall --no-index --no-deps ${PY_PIP_INSTALL_OPTIONS} --find-links=impactx-whl impactx
COMMAND_EXPAND_LISTS VERBATIM
WORKING_DIRECTORY
${ImpactX_BINARY_DIR}
DEPENDS
Expand All @@ -456,6 +459,7 @@ if(ImpactX_PYTHON)
add_custom_target(${ImpactX_CUSTOM_TARGET_PREFIX}pip_install_nodeps
${CMAKE_COMMAND} -E env IMPACTX_MPI=${ImpactX_MPI}
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} install --force-reinstall --no-index --no-deps ${PY_PIP_INSTALL_OPTIONS} --find-links=impactx-whl impactx
COMMAND_EXPAND_LISTS VERBATIM
WORKING_DIRECTORY
${ImpactX_BINARY_DIR}
DEPENDS
Expand Down
6 changes: 3 additions & 3 deletions cmake/dependencies/ABLASTR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ macro(find_ablastr)
set(COMPONENT_DIM 3D)
set(COMPONENT_PRECISION ${ImpactX_PRECISION} P${ImpactX_PRECISION})

find_package(ABLASTR 24.09 CONFIG REQUIRED COMPONENTS ${COMPONENT_DIM})
find_package(ABLASTR 24.10 CONFIG REQUIRED COMPONENTS ${COMPONENT_DIM})
message(STATUS "ABLASTR: Found version '${ABLASTR_VERSION}'")
endif()

Expand Down Expand Up @@ -161,15 +161,15 @@ set(ImpactX_openpmd_src ""
set(ImpactX_ablastr_repo "https://github.com/ECP-WarpX/WarpX.git"
CACHE STRING
"Repository URI to pull and build ABLASTR from if(ImpactX_ablastr_internal)")
set(ImpactX_ablastr_branch "d1a338e90ed1ad7ac2f010f47409aa48a2265c88"
set(ImpactX_ablastr_branch "24.10"
CACHE STRING
"Repository branch for ImpactX_ablastr_repo if(ImpactX_ablastr_internal)")

# AMReX is transitively pulled through ABLASTR
set(ImpactX_amrex_repo "https://github.com/AMReX-Codes/amrex.git"
CACHE STRING
"Repository URI to pull and build AMReX from if(ImpactX_amrex_internal)")
set(ImpactX_amrex_branch ""
set(ImpactX_amrex_branch "e64ffef57a7608d1d60f9abe738cc634e9c1272e"
CACHE STRING
"Repository branch for ImpactX_amrex_repo if(ImpactX_amrex_internal)")

Expand Down
4 changes: 2 additions & 2 deletions cmake/dependencies/pyAMReX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function(find_pyamrex)
endif()
elseif(NOT ImpactX_pyamrex_internal)
# TODO: MPI control
find_package(pyAMReX 24.09 CONFIG REQUIRED)
find_package(pyAMReX 24.10 CONFIG REQUIRED)
message(STATUS "pyAMReX: Found version '${pyAMReX_VERSION}'")
endif()
endfunction()
Expand All @@ -74,7 +74,7 @@ option(ImpactX_pyamrex_internal "Download & build pyAMReX" ON)
set(ImpactX_pyamrex_repo "https://github.com/AMReX-Codes/pyamrex.git"
CACHE STRING
"Repository URI to pull and build pyamrex from if(ImpactX_pyamrex_internal)")
set(ImpactX_pyamrex_branch "1c66690f83244196c5655293f1381303a7d1589d"
set(ImpactX_pyamrex_branch "8742a79c29b7db30c7287c8e33109c0d8be1277a"
CACHE STRING
"Repository branch for ImpactX_pyamrex_repo if(ImpactX_pyamrex_internal)")

Expand Down
5 changes: 5 additions & 0 deletions cmake/dependencies/pybind11.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ function(find_pybind11)
message(STATUS "pybind11 repository: ${ImpactX_pybind11_repo} (${ImpactX_pybind11_branch})")
include(FetchContent)
endif()

# rely on our find_package(Python ...) call
# https://pybind11.readthedocs.io/en/stable/compiling.html#modules-with-cmake
set(PYBIND11_FINDPYTHON ON)

if(ImpactX_pybind11_internal OR ImpactX_pybind11_src)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)

Expand Down
16 changes: 13 additions & 3 deletions docs/source/acknowledge_us.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,20 @@ If your project leads to a scientific publication, please consider citing the pa
Further ImpactX References
**************************

- Sandberg R T, Lehe R, Mitchell C E, Garten M, Myers A, Qiang J, Vay J-L and Huebl A.
- Mitchell C, Formenti A, Huebl A, Vay J-L, Qiang J, Garten M, Lehe R.
**ImpactX Space Charge Modeling of High Intensity Linacs with Mesh Refinement**.
32nd Linear Accelerator Conference (LINAC'24), TUPB090, p. 505, 2024.
`DOI:10.18429/JACoW-LINAC2024-TUPB090 <https://doi.org/10.18429/JACoW-LINAC2024-TUPB090>`__

- Mitchell C, Formenti A, Huebl A, Vay J-L, Qiang J, Garten M, Lehe R, Sandberg R.
**ImpactX Space Charge Modeling of High Intensity Linacs with Mesh Refinement**.
15th International Particle Accelerator Physics Conference (IPAC'24), WEPR65, p. 2653, 2024.
`DOI:10.18429/JACoW-IPAC2024-WEPR65 <https://doi.org/10.18429/JACoW-IPAC2024-WEPR65>`__

- Sandberg R T, Lehe R, Mitchell C E, Garten M, Myers A, Qiang J, Vay J-L, Huebl A.
**Synthesizing Particle-in-Cell Simulations Through Learning and GPU Computing for Hybrid Particle Accelerator Beamlines**.
Proc. of Platform for Advanced Scientific Computing (PASC'24), *submitted*, 2024.
`arXiv:2402.17248 <http://arxiv.org/abs/2402.17248>`__
Proc. of Platform for Advanced Scientific Computing (PASC'24), *PASC24 Best Paper Award*, 2024.
`DOI:10.1145/3659914.3659937 <https://doi.org/10.1145/3659914.3659937>`__

- Mitchell C E, Huebl A, Qiang J, Lehe R, Garten M, Sandberg R T, Vay J-L.
**ImpactX Modeling of Benchmark Tests for Space Charge Validation**.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
# built documents.
#
# The short X.Y version.
version = "24.09"
version = "24.10"
# The full version, including alpha/beta/rc tags.
release = "24.09"
release = "24.10"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
7 changes: 6 additions & 1 deletion docs/source/dataanalysis/dataanalysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ The code writes out the values in an ASCII file prefixed ``reduced_beam_characte
* ``sig_px``, ``sig_py``, ``sig_pt``
Standard deviation of the particle momentum deviations (energy difference for ``pt``) normalized by the magnitude of the reference particle momentum (unit: dimensionless)
* ``emittance_x``, ``emittance_y``, ``emittance_t``
Normalized rms beam emittance (unit: meter)
Unnormalized rms beam emittances (unit: meter)
* ``alpha_x``, ``alpha_y``, ``alpha_t``
Courant-Snyder (Twiss) alpha (unit: dimensionless). Transverse Twiss functions are calculated after removing correlations with particle energy.
* ``beta_x``, ``beta_y``, ``beta_t``
Expand All @@ -93,6 +93,11 @@ The code writes out the values in an ASCII file prefixed ``reduced_beam_characte
Horizontal and vertical dispersion (unit: meter)
* ``dispersion_px``, ``dispersion_py``
Derivative of horizontal and vertical dispersion (unit: dimensionless)
* ``emittance_xn``, ``emittance_yn``, ``emittance_tn``
Normalized rms beam emittances (unit: meter)
* ``emittance_1``, ``emittance_2``, ``emittance_3``
Normalized rms beam eigenemittances (aka mode emittances) (unit: meter)
These three diagnostics are written optionally if the flag eigenemittances = True.
* ``charge``
Total beam charge (unit: Coulomb)

Expand Down
4 changes: 2 additions & 2 deletions docs/source/install/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ CMake Option Default & Values Des
``ImpactX_PRECISION`` SINGLE/**DOUBLE** Floating point precision (single/double)
``ImpactX_PYTHON`` ON/**OFF** Python bindings
``Python_EXECUTABLE`` (newest found) Path to Python executable
``PY_PIP_OPTIONS`` ``-v`` Additional options for ``pip``, e.g., ``-vvv``
``PY_PIP_INSTALL_OPTIONS`` Additional options for ``pip install``, e.g., ``--user``
``PY_PIP_OPTIONS`` ``-v`` Additional options for ``pip``, e.g., ``-vvv;-q``
``PY_PIP_INSTALL_OPTIONS`` Additional options for ``pip install``, e.g., ``--user;-q``
=============================== ============================================ ===========================================================

ImpactX can be configured in further detail with options from AMReX, which are `documented in the AMReX manual <https://amrex-codes.github.io/amrex/docs_html/BuildingAMReX.html#customization-options>`_.
Expand Down
12 changes: 12 additions & 0 deletions docs/source/usage/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Single Particle Dynamics
examples/achromatic_spectrometer/README.rst
examples/fodo_programmable/README.rst
examples/dogleg/README.rst
examples/coupled_optics/README.rst


Collective Effects
------------------
Expand Down Expand Up @@ -70,6 +72,16 @@ Beam Distributions

examples/distgen/README


Channels & Rings
----------------

.. toctree::
:maxdepth: 1

examples/fodo_channel/README.rst


Lattice Design & Optimization
-----------------------------

Expand Down
15 changes: 13 additions & 2 deletions docs/source/usage/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ Lattice Elements

* ``<element_name>.xmax`` (``float``, in meters) maximum value of the horizontal coordinate
* ``<element_name>.ymax`` (``float``, in meters) maximum value of the vertical coordinate
* ``<element_name>.repeat_x`` (``float``, in meters) horizontal period for repeated aperture masking (inactive by default)
* ``<element_name>.repeat_y`` (``float``, in meters) vertical period for repeated aperture masking (inactive by default)
* ``<element_name>.shape`` (``string``) shape of the aperture boundary: ``rectangular`` (default) or ``elliptical``
* ``<element_name>.dx`` (``float``, in meters) horizontal translation error
* ``<element_name>.dy`` (``float``, in meters) vertical translation error
Expand Down Expand Up @@ -449,6 +451,11 @@ Lattice Elements
openPMD `iteration encoding <https://openpmd-api.readthedocs.io/en/0.14.0/usage/concepts.html#iteration-and-series>`__: (v)ariable based, (f)ile based, (g)roup based (default)
variable based is an `experimental feature with ADIOS2 <https://openpmd-api.readthedocs.io/en/0.14.0/backends/adios2.html#experimental-new-adios2-schema>`__.

* ``<element_name>.period_sample_intervals`` (``int``, default value: ``1``)

for periodic lattice, only output every Nth period (turn).
By default, diagnostics are returned every cycle.

* ``<element_name>.nonlinear_lens_invariants`` (``boolean``, default value: ``false``)

Compute and output the invariants H and I within the nonlinear magnetic insert element (see: ``nonlinear_lens``).
Expand Down Expand Up @@ -683,8 +690,8 @@ Diagnostics and output
This option is ignored for the openPMD output elements (remove them from the lattice to disable).

* ``diag.slice_step_diagnostics`` (``boolean``, optional, default: ``false``)
By default, diagnostics is performed at the beginning and end of the simulation.
Enabling this flag will write diagnostics every step and slice step
By default, diagnostics are computed and written at the beginning and end of the simulation.
Enabling this flag will write diagnostics at every step and slice step.

* ``diag.file_min_digits`` (``integer``, optional, default: ``6``)
The minimum number of digits used for the step number appended to the diagnostic file names.
Expand All @@ -694,6 +701,10 @@ Diagnostics and output
Diagnostics for particles lost in apertures, stored as ``diags/openPMD/particles_lost.*`` at the end of the simulation.
See the ``beam_monitor`` element for backend values.

* ``diag.eigenemittances`` (``boolean``, optional, default: ``false``)
If this flag is enabled, the 3 eigenemittances of the 6D beam distribution are computed and written as diagnostics.
This flag is disabled by default to reduce computational cost.


.. _running-cpp-parameters-diagnostics-insitu:

Expand Down
Loading

0 comments on commit 2ddadf9

Please sign in to comment.