.. _install-dependencies: Dependencies ============ WarpX depends on the following popular third party software. Please see installation instructions below. - a mature `C++17 `__ compiler, e.g., GCC 9.1+, Clang 7, NVCC 11.0, MSVC 19.15 or newer - `CMake 3.24.0+ `__ - `Git 2.18+ `__ - `AMReX `__: we automatically download and compile a copy of AMReX - `PICSAR `__: we automatically download and compile a copy of PICSAR and for Python bindings: - `pyAMReX `__: we automatically download and compile a copy of pyAMReX - `pybind11 `__: we automatically download and compile a copy of pybind11 Optional dependencies include: - `MPI 3.0+ `__: for multi-node and/or multi-GPU execution - for on-node accelerated compute *one of either*: - `OpenMP 3.1+ `__: for threaded CPU execution or - `CUDA Toolkit 11.7+ `__: for Nvidia GPU support (see `matching host-compilers `__) or - `ROCm 5.2+ (5.5+ recommended) `__: for AMD GPU support - `oneAPI `__: for Intel GPU support - `FFTW3 `__: for spectral solver (PSATD or IGF) support when running on CPU or SYCL - also needs the ``pkg-config`` tool on Unix - `BLAS++ `__ and `LAPACK++ `__: for spectral solver (PSATD) support in RZ geometry - `Boost 1.66.0+ `__: for QED lookup tables generation support - `openPMD-api 0.16.1+ `__: we automatically download and compile a copy of openPMD-api for openPMD I/O support - see `optional I/O backends `__, i.e., ADIOS2 and/or HDF5 - `Ascent 0.8.0+ `__: for in situ 3D visualization - `SENSEI 4.0.0+ `__: for in situ analysis and visualization - `CCache `__: to speed up rebuilds (For CUDA support, needs version 3.7.9+ and 4.2+ is recommended) - `Ninja `__: for faster parallel compiles - `Python 3.9+ `__ - `mpi4py `__ - `numpy `__ - `periodictable `__ - `picmistandard `__ - `lasy `__ - see our ``requirements.txt`` file for compatible versions If you are on a high-performance computing (HPC) system, then :ref:`please see our separate HPC documentation `. For all other systems, we recommend to use a **package dependency manager**: Pick *one* of the installation methods below to install all dependencies for WarpX development in a consistent manner. Conda-Forge (Linux/macOS/Windows) --------------------------------- `Conda-Forge `__ is a repository for cross-compatible, user-level packages. .. tip:: We recommend to deactivate that conda self-activates its ``base`` environment. This `avoids interference with the system and other package managers `__. .. code-block:: bash conda config --set auto_activate_base false In order to make sure that the conda configuration uses ``conda-forge`` as the only channel, which will help avoid issues with blocked ``defaults`` or ``anaconda`` repositories, please set the following configurations: .. code-block:: bash conda config --add channels conda-forge conda config --set channel_priority strict .. tab-set:: .. tab-item:: With MPI (only Linux/macOS) .. code-block:: bash conda create -n warpx-cpu-mpich-dev -c conda-forge blaspp boost ccache cmake compilers git lapackpp "openpmd-api=*=mpi_mpich*" openpmd-viewer packaging pytest python python-build make numpy pandas scipy setuptools yt "fftw=*=mpi_mpich*" pkg-config matplotlib mamba mpich mpi4py ninja pip virtualenv wheel conda activate warpx-cpu-mpich-dev # compile WarpX with -DWarpX_MPI=ON # for pip, use: export WARPX_MPI=ON .. tab-item:: Without MPI .. code-block:: bash conda create -n warpx-cpu-dev -c conda-forge blaspp boost ccache cmake compilers git lapackpp openpmd-api openpmd-viewer packaging pytest python python-build make numpy pandas scipy setuptools yt fftw pkg-config matplotlib mamba ninja pip virtualenv wheel conda activate warpx-cpu-dev # compile WarpX with -DWarpX_MPI=OFF # for pip, use: export WARPX_MPI=OFF For OpenMP support, you will further need: .. tab-set:: .. tab-item:: Linux .. code-block:: bash mamba install -c conda-forge libgomp .. tab-item:: macOS or Windows .. code-block:: bash mamba install -c conda-forge llvm-openmp For Nvidia CUDA GPU support, you will need to have `a recent CUDA driver installed `__ or you can lower the CUDA version of `the Nvidia cuda package `__ and `conda-forge to match your drivers `__ and then add these packages: .. code-block:: bash mamba install -c nvidia -c conda-forge cuda cuda-nvtx-dev cupy More info for `CUDA-enabled ML packages `__. Spack (Linux/macOS) ------------------- `Spack `__ is a user-level package manager. It is primarily written for Linux, with slightly less support for macOS, and future support for Windows. First, download a `WarpX Spack desktop development environment `__ of your choice. For most desktop developments, pick the OpenMP environment for CPUs unless you have a supported GPU. * **Debian/Ubuntu** Linux: * OpenMP: ``system=ubuntu; compute=openmp`` (CPUs) * CUDA: ``system=ubuntu; compute=cuda`` (Nvidia GPUs) * ROCm: ``system=ubuntu; compute=rocm`` (AMD GPUs) * SYCL: *todo* (Intel GPUs) * **macOS**: first, prepare with ``brew install gpg2; brew install gcc`` * OpenMP: ``system=macos; compute=openmp`` If you already `installed Spack `__, we recommend to activate its `binary caches `__ for faster builds: .. code-block:: bash spack mirror add rolling https://binaries.spack.io/develop spack buildcache keys --install --trust Now install the WarpX dependencies in a new WarpX development environment: .. code-block:: bash # download environment file curl -sLO https://raw.githubusercontent.com/BLAST-WarpX/warpx/development/Tools/machines/desktop/spack-${system}-${compute}.yaml # create new development environment spack env create warpx-${compute}-dev spack-${system}-${compute}.yaml spack env activate warpx-${compute}-dev # installation spack install python3 -m pip install jupyter matplotlib numpy openpmd-api openpmd-viewer pandas scipy virtualenv yt In new terminal sessions, re-activate the environment with .. code-block:: bash spack env activate warpx-openmp-dev again. Replace ``openmp`` with the equivalent you chose. Compile WarpX with ``-DWarpX_MPI=ON``. For ``pip``, use ``export WARPX_MPI=ON``. Brew (macOS/Linux) ------------------ `Homebrew (Brew) `__ is a user-level package manager primarily for `Apple macOS `__, but also supports Linux. .. code-block:: bash brew update brew tap openpmd/openpmd brew install adios2 # for openPMD brew install ccache brew install cmake brew install fftw # for PSATD 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 If you also want to compile with PSATD in RZ, you need to manually install BLAS++ and LAPACK++: .. code-block:: bash sudo mkdir -p /usr/local/bin/ sudo curl -L -o /usr/local/bin/cmake-easyinstall https://raw.githubusercontent.com/ax3l/cmake-easyinstall/main/cmake-easyinstall sudo chmod a+x /usr/local/bin/cmake-easyinstall cmake-easyinstall --prefix=/usr/local git+https://github.com/icl-utk-edu/blaspp.git \ -Duse_openmp=OFF -Dbuild_tests=OFF -DCMAKE_VERBOSE_MAKEFILE=ON cmake-easyinstall --prefix=/usr/local git+https://github.com/icl-utk-edu/lapackpp.git \ -Duse_cmake_find_lapack=ON -Dbuild_tests=OFF -DCMAKE_VERBOSE_MAKEFILE=ON Compile WarpX with ``-DWarpX_MPI=ON``. For ``pip``, use ``export WARPX_MPI=ON``. APT (Debian/Ubuntu Linux) ------------------------- The `Advanced Package Tool (APT) `__ is a system-level package manager on Debian-based Linux distributions, including Ubuntu. .. tab-set:: .. tab-item:: With MPI (only Linux/macOS) .. code-block:: bash sudo apt update sudo apt install build-essential ccache cmake g++ git libfftw3-mpi-dev libfftw3-dev libhdf5-openmpi-dev libopenmpi-dev pkg-config python3 python3-dev python3-matplotlib python3-mpi4py python3-numpy python3-pandas python3-pip python3-scipy python3-venv # optional: # for CUDA, either install # https://developer.nvidia.com/cuda-downloads (preferred) # or, if your Debian/Ubuntu is new enough, use the packages # sudo apt install nvidia-cuda-dev libcub-dev # compile WarpX with -DWarpX_MPI=ON # for pip, use: export WARPX_MPI=ON .. tab-item:: Without MPI .. code-block:: bash sudo apt update sudo apt install build-essential ccache cmake g++ git libfftw3-dev libfftw3-dev libhdf5-dev pkg-config python3 python3-dev python3-matplotlib python3-numpy python3-pandas python3-pip python3-scipy python3-venv # optional: # for CUDA, either install # https://developer.nvidia.com/cuda-downloads (preferred) # or, if your Debian/Ubuntu is new enough, use the packages # sudo apt install nvidia-cuda-dev libcub-dev # compile WarpX with -DWarpX_MPI=OFF # for pip, use: export WARPX_MPI=OFF