Skip to content

Conversation

@josephleekl
Copy link
Contributor

@josephleekl josephleekl commented Dec 16, 2025

Before submitting

Please complete the following checklist when submitting a PR:

  • All new features must include a unit test.
    If you've fixed a bug or added code that should be tested, add a test to the
    tests directory!

  • All new functions and code must be clearly commented and documented.
    If you do make documentation changes, make sure that the docs build and
    render correctly by running make docs.

  • Ensure that the test suite passes, by running make test.

  • Add a new entry to the .github/CHANGELOG.md file, summarizing the
    change, and including a link back to the PR.

  • Ensure that code is properly formatted by running make format.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


To build wheel with podman on local machine without AMDGPU:

cd pennylane-lightning
git checkout kokkos-5.0 # this branch
podman run --rm -it -v "$(pwd):/io:Z" quay.io/pypa/manylinux_2_28_x86_64 /bin/bash


printf "[ROCm]\nname=ROCm\nbaseurl=https://repo.radeon.com/rocm/rhel8/7.0.3/main\nenabled=1\ngpgcheck=0" > /etc/yum.repos.d/rocm.repo

dnf clean all
dnf update -y
dnf install -y cmake ninja-build
dnf install -y git wget rocm-dev hipcc hip-devel
source /opt/rh/gcc-toolset-14/enable
dnf install -y rocthrust-devel rocprim-devel

export PATH=/opt/python/cp312-cp312/bin:$PATH

cd /root
git clone --branch "5.0.0" https://github.com/kokkos/kokkos.git
mkdir -p /root/Kokkos_install/rocm
cd kokkos

export KOKKOS_INSTALL_PATH=/root/Kokkos_install/rocm
cmake -S . -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=$KOKKOS_INSTALL_PATH \
    -DCMAKE_CXX_STANDARD=20 \
    -DCMAKE_CXX_COMPILER=hipcc \
    -DCMAKE_CXX_FLAGS="--gcc-toolchain=/opt/rh/gcc-toolset-14/root/usr" \
    -DCMAKE_EXE_LINKER_FLAGS="--gcc-toolchain=/opt/rh/gcc-toolset-14/root/usr" \
    -DCMAKE_SHARED_LINKER_FLAGS="--gcc-toolchain=/opt/rh/gcc-toolset-14/root/usr" \
    -DCMAKE_PREFIX_PATH="/opt/rocm" \
    -DBUILD_SHARED_LIBS:BOOL=ON \
    -DBUILD_TESTING:BOOL=ON \
    -DKokkos_ENABLE_SERIAL:BOOL=ON \
    -DKokkos_ENABLE_HIP:BOOL=ON \
    -DKokkos_ARCH_AMD_GFX942:BOOL=ON \
    -DKokkos_ENABLE_OPENMPTARGET=OFF \
    -DKokkos_ENABLE_COMPLEX_ALIGN:BOOL=OFF \
    -DKokkos_ENABLE_EXAMPLES:BOOL=OFF \
    -DKokkos_ENABLE_TESTS:BOOL=OFF \
    -DKokkos_ENABLE_LIBDL:BOOL=OFF
cmake --build build && cmake --install build

cd /io
cp -r $KOKKOS_INSTALL_PATH ./Kokkos/
python -m pip install setuptools wheel tomli cmake ninja
pip install -r requirements.txt


PL_BACKEND="lightning_amdgpu" python scripts/configure_pyproject_toml.py
CMAKE_ARGS="-DCMAKE_CXX_COMPILER=hipcc -DCMAKE_C_COMPILER=hipcc \
    -DCMAKE_CXX_FLAGS='--gcc-toolchain=/opt/rh/gcc-toolset-14/root/usr' \
    -DCMAKE_EXE_LINKER_FLAGS='--gcc-toolchain=/opt/rh/gcc-toolset-14/root/usr' \
    -DCMAKE_SHARED_LINKER_FLAGS='--gcc-toolchain=/opt/rh/gcc-toolset-14/root/usr' \
            -DKokkos_Core_DIR=${KOKKOS_INSTALL_PATH} \
            -DCMAKE_PREFIX_PATH=/opt/rocm" \
            python -m build --wheel --no-isolation

To compile on AMDGPU Dev Cloud:

apt install cmake ninja-build

wget https://github.com/kokkos/kokkos/archive/refs/tags/5.0.0.tar.gz
tar xvf 5.0.0.tar.gz 
cd kokkos-5.0.0/
export KOKKOS_INSTALL_PATH=$HOME/kokkos-install/5.0.0/GFX942
mkdir -p ${KOKKOS_INSTALL_PATH}
cmake -S . -B build -G Ninja     -DCMAKE_BUILD_TYPE=Release     -DCMAKE_INSTALL_PREFIX=${KOKKOS_INSTALL_PATH}     -DCMAKE_CXX_STANDARD=20     -DCMAKE_CXX_COMPILER=hipcc     -DCMAKE_PREFIX_PATH="/opt/rocm"     -DBUILD_SHARED_LIBS:BOOL=ON     -DBUILD_TESTING:BOOL=OFF     -DKokkos_ENABLE_SERIAL:BOOL=ON     -DKokkos_ENABLE_HIP:BOOL=ON     -DKokkos_ARCH_AMD_GFX942:BOOL=ON     -DKokkos_ENABLE_COMPLEX_ALIGN:BOOL=OFF     -DKokkos_ENABLE_EXAMPLES:BOOL=OFF     -DKokkos_ENABLE_TESTS:BOOL=OFF     -DKokkos_ENABLE_LIBDL:BOOL=OFF
cmake --build build && cmake --install build

export CMAKE_PREFIX_PATH=:"${KOKKOS_INSTALL_PATH}":/opt/rocm:$CMAKE_PREFIX_PATH


cd pennylane-lightning
git checkout kokkos-5.0
# turn off `ENABLE_WARNINGS` in Makefile
build_options="-DCMAKE_CXX_COMPILER=hipcc" PL_BACKEND="lightning_kokkos" make test-cpp

The cpp tests should pass.

Context:

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit .github/CHANGELOG.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.28%. Comparing base (d34d902) to head (7d02917).

Files with missing lines Patch % Lines
...lightning_kokkos/measurements/MeasuresFunctors.hpp 50.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1308      +/-   ##
==========================================
- Coverage   95.84%   91.28%   -4.57%     
==========================================
  Files         243      184      -59     
  Lines       40695    27813   -12882     
==========================================
- Hits        39005    25389   -13616     
- Misses       1690     2424     +734     
Flag Coverage Δ
unit_tests 91.28% <85.00%> (-4.57%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maliasadi maliasadi added ci:build_wheels Activate wheel building. ci:use-gpu-runner Enable usage of GPU runner for this Pull Request labels Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:build_wheels Activate wheel building. ci:use-gpu-runner Enable usage of GPU runner for this Pull Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants