Lightning-AMDGPU installation

Install Lightning-AMDGPU from source

Lightning-AMDGPU is an instantiation of the Lighting-Kokkos device, specifically for AMD GPUs using the HIP backend. For building Lightning-Kokkos for targets other than AMD GPUs, please refer to the Lightning-Kokkos installation page.

The installation instruction here is specifically for AMD MI300 GPU (GFX942); for other architecture, please refer to the Kokkos wiki for the correct flag.

Note

Lightning-Kokkos and Lightning-AMDGPU are tested with Kokkos version 4.5.00

Install Lightning-AMDGPU

Note

  • An AMD compiler hipcc or amdclang from the ROCm software stack is required.

  • -DCMAKE_PREFIX_PATH="/opt/rocm" enables CMake to properly discover the rocthrust library

git clone https://github.com/PennyLaneAI/pennylane-lightning.git
cd pennylane-lightning
python -m pip install --group base
pip install git+https://github.com/PennyLaneAI/pennylane.git@main

# First Install Lightning-Qubit
PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py
python -m pip install . -vv

# Install Lightning-AMDGPU
PL_BACKEND="lightning_amdgpu" python scripts/configure_pyproject_toml.py
export CMAKE_ARGS="-DCMAKE_CXX_COMPILER=hipcc \
                   -DKokkos_ENABLE_HIP=ON \
                   -DKokkos_ARCH_AMD_GFX942=ON \
                   -DCMAKE_PREFIX_PATH=/opt/rocm"
python -m pip install . -vv

Install Lightning-AMDGPU with MPI

Note

To build Lightning-AMDGPU with MPI support, please consult the Lightning-Kokkos installation guide at Lightning-Kokkos installation and Lightning-Kokkos installation on HPC.