Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: ImpactX_FFT #638

Merged
merged 4 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ impactx_set_default_install_dirs()
#
include(CMakeDependentOption)
option(ImpactX_APP "Build the ImpactX executable application" ON)
option(ImpactX_FFT "FFT-based solvers (IGF Space Charge, CSR)" OFF)
option(ImpactX_MPI "Multi-node support (message-passing)" ON)
option(ImpactX_OPENPMD "openPMD I/O (HDF5, ADIOS)" ON)
option(ImpactX_PYTHON "Python bindings" OFF)
Expand Down Expand Up @@ -106,6 +107,10 @@ option(ImpactX_PYTHON_IPO
ON
)

if(ImpactX_FFT)
set(ABLASTR_FFT ON CACHE STRING "FFT-based solvers" FORCE)
endif()

# this defined the variable BUILD_TESTING which is ON by default
include(CTest)

Expand Down Expand Up @@ -285,6 +290,9 @@ impactx_set_binary_name()

# Defines #####################################################################
#
if(ImpactX_FFT)
target_compile_definitions(lib PUBLIC ImpactX_USE_FFT)
endif()
if(ImpactX_OPENPMD)
target_compile_definitions(lib PUBLIC ImpactX_USE_OPENPMD)
endif()
Expand Down
1 change: 1 addition & 0 deletions cmake/ImpactXFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ function(impactx_print_summary)
#message(" ASCENT: ${ImpactX_ASCENT}")
message(" COMPUTE: ${ImpactX_COMPUTE}")
message(" IPO/LTO: ${ImpactX_IPO}")
message(" FFT: ${ImpactX_FFT}")
message(" LIB: ${LIB_TYPE}")
message(" MPI: ${ImpactX_MPI}")
if(MPI)
Expand Down
1 change: 1 addition & 0 deletions docs/source/install/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ CMake Option Default & Values Des
``CMAKE_VERBOSE_MAKEFILE`` ON/**OFF** Print all compiler commands to the terminal during build
``ImpactX_APP`` **ON**/OFF Build the ImpactX executable application
``ImpactX_COMPUTE`` NOACC/**OMP**/CUDA/SYCL/HIP On-node, accelerated computing backend
``ImpactX_FFT`` ON/**OFF** FFT-based solvers (IGF Space Charge, CSR, ...)
``ImpactX_IPO`` ON/**OFF** Compile ImpactX with interprocedural optimization (aka LTO)
``ImpactX_MPI`` **ON**/OFF Multi-node support (message-passing)
``ImpactX_MPI_THREAD_MULTIPLE`` **ON**/OFF MPI thread-multiple support, i.e. for ``async_io``
Expand Down
13 changes: 9 additions & 4 deletions docs/source/install/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Optional dependencies include:
- `OpenMP 3.1+ <https://www.openmp.org>`__: for threaded CPU execution or
- `CUDA Toolkit 11.0+ (11.3+ recommended) <https://developer.nvidia.com/cuda-downloads>`__: for Nvidia GPU support (see `matching host-compilers <https://gist.github.com/ax3l/9489132>`_) or
- `ROCm 5.2+ (5.5+ recommended) <https://gpuopen.com/learn/amd-lab-notes/amd-lab-notes-rocm-installation-readme/>`__: for AMD GPU support
- `FFTW3 <http://www.fftw.org>`__: for algorithms such as IGF space charge solver or CSR when running on CPU or with SYCL

- also needs the ``pkg-config`` tool on Unix
- `openPMD-api 0.15.2+ <https://github.com/openPMD/openPMD-api>`__: we automatically download and compile a copy of openPMD-api for openPMD I/O support

- see `optional I/O backends <https://github.com/openPMD/openPMD-api#dependencies>`__
Expand Down Expand Up @@ -67,7 +70,7 @@ Conda (Linux/macOS/Windows)

.. code-block:: bash

conda create -n impactx-cpu-mpich-dev -c conda-forge blaspp boost ccache cmake compilers git lapackpp "openpmd-api=*=mpi_mpich*" python numpy pandas quantiphy scipy yt pkg-config matplotlib mamba ninja mpich pip virtualenv
conda create -n impactx-cpu-mpich-dev -c conda-forge blaspp boost ccache cmake compilers git lapackpp "openpmd-api=*=mpi_mpich*" python numpy pandas quantiphy scipy yt "fftw=*=mpi_mpich*" pkg-config matplotlib mamba ninja mpich pip virtualenv
conda activate impactx-cpu-mpich-dev

# compile ImpactX with -DImpactX_MPI=ON
Expand All @@ -77,7 +80,7 @@ Conda (Linux/macOS/Windows)

.. code-block:: bash

conda create -n impactx-cpu-dev -c conda-forge blaspp boost ccache cmake compilers git lapackpp openpmd-api python numpy pandas quantiphy scipy yt pkg-config matplotlib mamba ninja pip virtualenv
conda create -n impactx-cpu-dev -c conda-forge blaspp boost ccache cmake compilers git lapackpp openpmd-api python numpy pandas quantiphy scipy yt fftw pkg-config matplotlib mamba ninja pip virtualenv
conda activate impactx-cpu-dev

# compile ImpactX with -DImpactX_MPI=OFF
Expand Down Expand Up @@ -166,11 +169,13 @@ Brew (macOS/Linux)
brew install adios2 # for openPMD
brew install ccache
brew install cmake
brew install fftw # for IGF, CSR
brew install git
brew install hdf5-mpi # for openPMD
brew install libomp
brew unlink gcc
brew link --force libomp
brew install pkg-config # for fftw
brew install open-mpi
brew install openblas # for PSATD in RZ
brew install openpmd-api # for openPMD
Expand Down Expand Up @@ -204,7 +209,7 @@ The `Advanced Package Tool (APT) <https://en.wikipedia.org/wiki/APT_(software)>`
.. code-block:: bash

sudo apt update
sudo apt install build-essential ccache cmake g++ git libhdf5-openmpi-dev libopenmpi-dev pkg-config python3 python3-matplotlib python3-numpy python3-pandas python3-pip python3-scipy python3-venv
sudo apt install build-essential ccache cmake g++ git libfftw3-mpi-dev libfftw3-dev libhdf5-openmpi-dev libopenmpi-dev pkg-config python3 python3-matplotlib python3-numpy python3-pandas python3-pip python3-scipy python3-venv

# optional:
# for CUDA, either install
Expand All @@ -220,7 +225,7 @@ The `Advanced Package Tool (APT) <https://en.wikipedia.org/wiki/APT_(software)>`
.. code-block:: bash

sudo apt update
sudo apt install build-essential ccache cmake g++ git libhdf5-dev pkg-config python3 python3-matplotlib python3-numpy python3-pandas python3-pip python3-scipy python3-venv
sudo apt install build-essential ccache cmake g++ git libfftw3-dev libfftw3-dev libhdf5-dev pkg-config python3 python3-matplotlib python3-numpy python3-pandas python3-pip python3-scipy python3-venv

# optional:
# for CUDA, either install
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def build_extension(self, ext):
"-DPython_EXECUTABLE=" + sys.executable,
## variants
"-DImpactX_COMPUTE=" + ImpactX_COMPUTE,
"-DImpactX_FFT:BOOL=" + ImpactX_FFT,
"-DImpactX_MPI:BOOL=" + ImpactX_MPI,
"-DImpactX_PRECISION=" + ImpactX_PRECISION,
#'-DImpactX_PARTICLES_PRECISION=' + ImpactX_PARTICLES_PRECISION,
Expand Down Expand Up @@ -161,6 +162,7 @@ def build_extension(self, ext):
# ... build ImpactX libraries with CMake
# note: changed default for SHARED, MPI, TESTING and EXAMPLES
ImpactX_COMPUTE = os.environ.get("IMPACTX_COMPUTE", "OMP")
ImpactX_FFT = os.environ.get("IMPACTX_FFT", "OFF")
ImpactX_MPI = os.environ.get("IMPACTX_MPI", "OFF")
ImpactX_PRECISION = os.environ.get("IMPACTX_PRECISION", "DOUBLE")
# already prepared as a list 1;2;3
Expand Down
Loading