Skip to content
VLASIFY™
TutorialPlasma & PIC simulation

WarpX installation guide: Conda, Spack and CMake builds for CPU and GPU

Updated · Scientifically reviewed by Dinkar Mishra, PhD on

Short answer

For a quick CPU installation, use Conda: conda create -n warpx -c conda-forge warpx. For GPU clusters, build from source with CMake (or Spack) against the site's compilers, MPI and CUDA/HIP/SYCL toolchain, choosing the backend with -DWarpX_COMPUTE and the geometries with -DWarpX_DIMS. Executables appear in build/bin; verify by running an official example and checking its output and GPU utilisation.

Who this is for

Researchers and research software engineers installing the WarpX PIC code on workstations, university clusters or national supercomputers.

Software

WarpX current release (see docs)CMake version required by the releaseCUDA / ROCm / oneAPI for GPU builds

Prerequisites

  • Linux or macOS. On Windows, use WSL2.
  • For Conda: Miniforge or Anaconda.
  • For source builds: a C++17 compiler, CMake, MPI, and, for GPUs, the CUDA, ROCm (HIP) or oneAPI (SYCL) toolkit. On clusters these come from module load.
  • Optional but recommended: FFTW (for spectral solvers and some boundaries) and HDF5 or ADIOS2 with openPMD for output.

Option A: Conda (quickest, CPU)

conda create -n warpx -c conda-forge warpx
conda activate warpx

This installs pre-built executables and Python bindings. It is ideal for tutorials, small 1D/2D runs and testing input files before moving to a cluster.

Option B: CMake from source (clusters and GPUs)

git clone https://github.com/BLAST-WarpX/warpx.git
cd warpx

# Configure: choose the compute backend and the geometries to build
cmake -S . -B build \
  -DWarpX_COMPUTE=CUDA \
  -DWarpX_DIMS="1;2;RZ;3" \
  -DWarpX_MPI=ON

# Compile in parallel
cmake --build build -j 8
ls build/bin/

Common choices for WarpX_COMPUTE are OMP (CPU with OpenMP), CUDA (NVIDIA), HIP (AMD) and SYCL (Intel). Add -DWarpX_PYTHON=ON to build the Python interface. The CMake page of the WarpX documentation lists all options, including FFT and openPMD support, precision and QED.

On a supported supercomputer, start from the machine-specific page in the WarpX documentation. It lists the exact modules and environment variables.

Option C: Spack

spack install warpx +mpi
spack load warpx

Spack resolves dependencies for your system and can target GPUs through variants. Run spack info warpx to see the variants that your Spack version offers.

Verify

  1. Executables exist. You should see names such as warpx.3d... in build/bin (source builds) or on your PATH (Conda).

  2. Run an official example. The repository’s Examples/ directory contains input files, for instance for laser-driven acceleration. Copy one into a work directory and run it:

    mpirun -np 2 ./build/bin/warpx.3d inputs_file

    Replace warpx.3d with the exact executable name from build/bin, and inputs_file with the example’s input file name.

  3. Check output and performance. WarpX prints the step number and timing per step. A diags/ directory appears with the requested diagnostics. For GPU builds, nvidia-smi (or rocm-smi) should show one process per GPU while the run is active.

Troubleshooting

  • CMake cannot find CUDA or MPI: load the modules first (module load cuda openmpi), and make sure nvcc and mpicc are on PATH. Then delete the build directory and configure again. CMake caches failed checks.
  • Out of memory when compiling: reduce parallelism, for example cmake --build build -j 4. GPU builds of several geometries use a lot of memory.
  • The run uses the CPU although you built for GPUs: check the executable name and the start-up output, and make sure you launch with one MPI rank per GPU.
  • Errors only at scale: the MPI or GPU-aware MPI settings do not match the system. Follow your machine’s page in the WarpX documentation, or contact your HPC centre.

Assumptions and limitations

  • Option names reflect the WarpX documentation at the time of writing. WarpX is actively developed, so check the docs for the release you install.
  • Conda builds are convenient but not tuned for HPC interconnects or GPUs.
  • A successful build does not validate your physics setup. Run convergence checks; see PIC convergence testing.

Frequently asked questions

Should I install WarpX with Conda, Spack or CMake?+

Conda is the fastest way to get a working CPU build for learning and small runs. On clusters and supercomputers, build with CMake or Spack against the system MPI and GPU toolchain. Pre-built Conda binaries do not use the vendor-optimised MPI or GPUs of an HPC system.

Why are there several executables (warpx.1d, warpx.2d, warpx.3d, warpx.rz)?+

Geometry is a compile-time choice in WarpX. The -DWarpX_DIMS option lists which geometries to build, and each produces its own executable (and Python module, if enabled).

Can I drive WarpX from Python?+

Yes. Building with -DWarpX_PYTHON=ON produces the pywarpx package, which lets you define simulations and interact with them from Python scripts. The Conda package also includes Python bindings.

My cluster is listed in the WarpX documentation. Should I follow that?+

Yes. The WarpX documentation contains machine-specific build instructions (modules, compilers, job scripts) for many HPC systems. They are usually the most reliable starting point.

References

  1. WarpX documentation · WarpX developers
  2. WarpX: installation for users (Conda, Spack, Brew, pip) · WarpX documentation
  3. WarpX: building from source with CMake · WarpX documentation
  4. WarpX source code · GitHub

Want this set up and verified for you?

We install, configure and validate scientific software on your workstation, cluster or cloud, and train your team to run it.

Services listed on this page are available today. Products marked “early access” or “in development” on our platform page are not yet generally available.

Spotted an error or an outdated command? Tell us. We correct verified issues promptly.

Related guides

How Vlasify can help

Get a Quote