Skip to content

Commit

Permalink
Remove Lightning Kokkos plugin (#974)
Browse files Browse the repository at this point in the history
**Context:** Lightning Kokkos plugin has been migrated to Lightning. We
can remove its code from Catalyst then. But this PR in Lightning must be
approved first:
PennyLaneAI/pennylane-lightning#837

**Description of the Change:** Remove plugin from code and from the list
of provided plugins.

**Benefits:** Remove duplicated functionality.

[sc-69450]

---------

Co-authored-by: David Ittah <[email protected]>
  • Loading branch information
rauletorresc and dime10 authored Aug 8, 2024
1 parent 377388b commit f82d2ca
Show file tree
Hide file tree
Showing 20 changed files with 27 additions and 918 deletions.
10 changes: 10 additions & 0 deletions .dep-versions
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,14 @@ llvm=3a8316216807d64a586b971f51695e23883331f7
enzyme=v0.0.130

# Always remove custom PL/LQ versions before release.

# For a custom PL version, update the package version here and at
# 'doc/requirements.txt
pennylane=0.38.0.dev11

# For a custom LQ/LK version, update the package version here and at
# 'doc/requirements.txt'. Also, update the 'LIGHTNING_GIT_TAG' at
# 'runtime/Makefile' and at all GitHub workflows, using the exact
# commit hash corresponding to the merged PR that implements the
# desired feature.
lightning=0.38.0-dev26
5 changes: 1 addition & 4 deletions .github/workflows/build-wheel-linux-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,8 @@ jobs:
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$GITHUB_WORKSPACE/runtime-build/lib \
-DPYTHON_EXECUTABLE=$(which python${{ matrix.python_version }}) \
-Dpybind11_DIR=$(python${{ matrix.python_version }} -c "import pybind11; print(pybind11.get_cmake_dir())") \
-DENABLE_LIGHTNING_KOKKOS=ON \
-DENABLE_LAPACK=OFF \
-DLIGHTNING_GIT_TAG=latest_release \
-DKokkos_ENABLE_SERIAL=ON \
-DKokkos_ENABLE_OPENMP=ON \
-DLIGHTNING_GIT_TAG=8f517d24c71c6c7765f5c1bf29b0264b951de96a \
-DENABLE_WARNINGS=OFF \
-DENABLE_OPENQASM=ON \
-DENABLE_OPENMP=OFF \
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/build-wheel-macos-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,8 @@ jobs:
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$GITHUB_WORKSPACE/runtime-build/lib \
-DPYTHON_EXECUTABLE=$(which python${{ matrix.python_version }}) \
-Dpybind11_DIR=$(python${{ matrix.python_version }} -c "import pybind11; print(pybind11.get_cmake_dir())") \
-DENABLE_LIGHTNING_KOKKOS=ON \
-DLIGHTNING_GIT_TAG=latest_release \
-DLIGHTNING_GIT_TAG=8f517d24c71c6c7765f5c1bf29b0264b951de96a \
-DENABLE_LAPACK=OFF \
-DKokkos_ENABLE_SERIAL=ON \
-DKokkos_ENABLE_OPENMP=ON \
-DKokkos_ENABLE_COMPLEX_ALIGN=OFF \
-DENABLE_WARNINGS=OFF \
-DENABLE_OPENQASM=ON \
-DENABLE_OPENMP=OFF \
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/build-wheel-macos-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,8 @@ jobs:
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$GITHUB_WORKSPACE/runtime-build/lib \
-DPYTHON_EXECUTABLE=$(which python${{ matrix.python_version }}) \
-Dpybind11_DIR=$(python${{ matrix.python_version }} -c "import pybind11; print(pybind11.get_cmake_dir())") \
-DLIGHTNING_GIT_TAG=latest_release \
-DENABLE_LIGHTNING_KOKKOS=ON \
-DLIGHTNING_GIT_TAG=8f517d24c71c6c7765f5c1bf29b0264b951de96a \
-DENABLE_LAPACK=OFF \
-DKokkos_ENABLE_SERIAL=ON \
-DKokkos_ENABLE_OPENMP=OFF \
-DKokkos_ENABLE_COMPLEX_ALIGN=OFF \
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
-DENABLE_WARNINGS=OFF \
-DENABLE_OPENQASM=ON \
-DENABLE_OPENMP=OFF \
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/check-catalyst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@ jobs:
C_COMPILER=$(which ${{ needs.constants.outputs[format('c_compiler.{0}', matrix.compiler)] }}) \
CXX_COMPILER=$(which ${{ needs.constants.outputs[format('cxx_compiler.{0}', matrix.compiler)] }}) \
COMPILER_LAUNCHER="" \
ENABLE_LIGHTNING_KOKKOS=OFF \
ENABLE_OPENQASM=OFF \
ENABLE_ASAN=ON \
make test-runtime
Expand All @@ -645,7 +644,6 @@ jobs:
C_COMPILER=$(which ${{ needs.constants.outputs[format('c_compiler.{0}', matrix.compiler)] }}) \
CXX_COMPILER=$(which ${{ needs.constants.outputs[format('cxx_compiler.{0}', matrix.compiler)] }}) \
COMPILER_LAUNCHER="" \
ENABLE_LIGHTNING_KOKKOS=OFF \
ENABLE_ASAN=ON \
make test-runtime
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/check-pl-compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ jobs:
CXX_COMPILER=$(which g++ }}) \
RT_BUILD_DIR="$(pwd)/runtime-build" \
LIGHTNING_GIT_TAG_VALUE=latest_release \
ENABLE_LIGHTNING_KOKKOS=ON \
ENABLE_OPENQASM=ON \
make runtime
Expand All @@ -134,7 +133,6 @@ jobs:
CXX_COMPILER=$(which g++ }}) \
RT_BUILD_DIR="$(pwd)/runtime-build" \
LIGHTNING_GIT_TAG_VALUE=v0.37.0_rc \
ENABLE_LIGHTNING_KOKKOS=ON \
ENABLE_OPENQASM=ON \
make runtime
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/scripts/linux_arm64/rh8/build_catalyst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,8 @@ cmake -S runtime -B runtime-build -G Ninja \
-DPYTHON_INCLUDE_DIR=/opt/_internal/cpython-${PYTHON_VERSION}.${PYTHON_SUBVERSION}/include/python${PYTHON_VERSION} \
-DPYTHON_LIBRARY=/opt/_internal/cpython-${PYTHON_VERSION}.${PYTHON_SUBVERSION}/lib \
-Dpybind11_DIR=/opt/_internal/cpython-${PYTHON_VERSION}.${PYTHON_SUBVERSION}/lib/python${PYTHON_VERSION}/site-packages/pybind11/share/cmake/pybind11 \
-DENABLE_LIGHTNING_KOKKOS=ON \
-DLIGHTNING_GIT_TAG=latest_release \
-DLIGHTNING_GIT_TAG=8f517d24c71c6c7765f5c1bf29b0264b951de96a \
-DENABLE_LAPACK=OFF \
-DKokkos_ENABLE_SERIAL=ON \
-DKokkos_ENABLE_OPENMP=ON \
-DKokkos_ENABLE_COMPLEX_ALIGN=OFF \
-DENABLE_WARNINGS=OFF \
-DENABLE_OPENQASM=ON \
-DENABLE_OPENMP=OFF \
Expand Down
3 changes: 3 additions & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@
(only `global` value is supported to date.)
[(#946)](https://github.com/PennyLaneAI/catalyst/pull/946)

* Catalyst's implementation of Lightning Kokkos plugin has been removed in favor of Lightning's one.
[(#974)](https://github.com/PennyLaneAI/catalyst/pull/974)

<h3>Contributors</h3>

This release contains contributions from (in alphabetical order):
Expand Down
2 changes: 1 addition & 1 deletion doc/dev/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ them, but using the ``test-runtime`` target instead:

.. code-block:: console
make test-runtime ENABLE_LIGHTNING_KOKKOS=ON ENABLE_OPENQASM=ON
make test-runtime ENABLE_OPENQASM=ON
.. note::

Expand Down
4 changes: 2 additions & 2 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ lxml_html_clean

# Pre-install PL development wheels
--extra-index-url https://test.pypi.org/simple/
pennylane-lightning-kokkos==0.37.0
pennylane-lightning==0.37.0
pennylane-lightning-kokkos==0.38.0-dev26
pennylane-lightning==0.38.0-dev26
pennylane==0.38.0.dev11
1 change: 0 additions & 1 deletion frontend/catalyst/device/qjit_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
# for the following backend devices:
SUPPORTED_RT_DEVICES = {
"lightning.qubit": ("LightningSimulator", "librtd_lightning"),
"lightning.kokkos": ("LightningKokkosSimulator", "librtd_lightning"),
"braket.aws.qubit": ("OpenQasmDevice", "librtd_openqasm"),
"braket.local.qubit": ("OpenQasmDevice", "librtd_openqasm"),
}
Expand Down
11 changes: 2 additions & 9 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ option(ENABLE_ADDRESS_SANITIZER "Enable address sanitizer" OFF)
option(RUNTIME_CLANG_TIDY "Enable Clang Tidy" OFF)

option(ENABLE_LIGHTNING "Build Lightning backend device" ON)
option(ENABLE_LIGHTNING_KOKKOS "Build Lightning-Kokkos backend device" OFF)
option(ENABLE_OPENQASM "Build OpenQasm backend device" OFF)

set(CMAKE_VERBOSE_MAKEFILE ON)
Expand Down Expand Up @@ -79,20 +78,14 @@ if(RUNTIME_ENABLE_WARNINGS)
endif()

message(STATUS "ENABLE_LIGHTNING is ${ENABLE_LIGHTNING}.")
message(STATUS "ENABLE_LIGHTNING_KOKKOS is ${ENABLE_LIGHTNING_KOKKOS}.")
message(STATUS "ENABLE_OPENQASM is ${ENABLE_OPENQASM}.")

set(devices_list)
list(APPEND devices_list rtd_dummy)

if(ENABLE_LIGHTNING OR ENABLE_LIGHTNING_KOKKOS)
if(ENABLE_LIGHTNING)
list(APPEND devices_list pennylane_lightning rtd_lightning)
if(ENABLE_LIGHTNING)
list(APPEND backend_includes "${PROJECT_SOURCE_DIR}/lib/backend/lightning/lightning_dynamic")
endif()
if(ENABLE_LIGHTNING_KOKKOS)
list(APPEND backend_includes "${PROJECT_SOURCE_DIR}/lib/backend/lightning/lightning_kokkos")
endif()
list(APPEND backend_includes "${PROJECT_SOURCE_DIR}/lib/backend/lightning/lightning_dynamic")
endif()

if(ENABLE_OPENQASM)
Expand Down
8 changes: 1 addition & 7 deletions runtime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ENABLE_LIGHTNING?=ON
ENABLE_LIGHTNING_KOKKOS?=ON
ENABLE_OPENQASM?=ON
ENABLE_ASAN?=OFF
LIGHTNING_GIT_TAG_VALUE?=latest_release
LIGHTNING_GIT_TAG_VALUE?=8f517d24c71c6c7765f5c1bf29b0264b951de96a
ENABLE_LAPACK?=OFF

BUILD_TARGETS := rt_capi rtd_dummy
Expand All @@ -23,9 +23,6 @@ TEST_TARGETS := ""
ifeq ($(ENABLE_LIGHTNING), ON)
BUILD_TARGETS += rtd_lightning
TEST_TARGETS += runner_tests_lightning
else ifeq ($(ENABLE_LIGHTNING_KOKKOS), ON)
BUILD_TARGETS += rtd_lightning
TEST_TARGETS += runner_tests_lightning
endif

ifeq ($(ENABLE_OPENQASM), ON)
Expand All @@ -34,7 +31,6 @@ ifeq ($(ENABLE_OPENQASM), ON)
endif

LIGHTNING_ENABLE_OPENMP?=OFF
KOKKOS_ENABLE_OPENMP?=ON

coverage: CODE_COVERAGE=ON
coverage: BUILD_TYPE=Debug
Expand Down Expand Up @@ -75,10 +71,8 @@ configure:
-DCMAKE_C_COMPILER_LAUNCHER=$(COMPILER_LAUNCHER) \
-DCMAKE_CXX_COMPILER_LAUNCHER=$(COMPILER_LAUNCHER) \
-DENABLE_LIGHTNING=$(ENABLE_LIGHTNING) \
-DENABLE_LIGHTNING_KOKKOS=$(ENABLE_LIGHTNING_KOKKOS) \
-DENABLE_OPENQASM=$(ENABLE_OPENQASM) \
-DENABLE_OPENMP=$(LIGHTNING_ENABLE_OPENMP) \
-DKokkos_ENABLE_OPENMP=$(KOKKOS_ENABLE_OPENMP) \
-DENABLE_CODE_COVERAGE=$(CODE_COVERAGE) \
-DRUNTIME_ENABLE_WARNINGS=$(ENABLE_WARNINGS) \
-DENABLE_WARNINGS=OFF \
Expand Down
17 changes: 1 addition & 16 deletions runtime/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,8 @@ Installation

By default, the runtime builds all supported backend devices.
You can build the runtime with custom devices from the list of Backend Devices.
You can use ``ENABLE_LIGHTNING_KOKKOS=OFF`` to disable building the runtime with
`lightning.kokkos <https://docs.pennylane.ai/projects/lightning/en/stable/lightning_kokkos/device.html>`_:

.. code-block:: console
make runtime ENABLE_LIGHTNING_KOKKOS=OFF
Lightning-Kokkos provides support for other Kokkos backends including OpenMP, HIP and CUDA.
Please refer to `the installation guideline <https://docs.pennylane.ai/projects/lightning/en/stable/lightning_kokkos/installation.html>`_ for the requirements.
You can further use the ``CMAKE_ARGS`` flag to issue any additional compiler arguments or override the preset ones in the make commands.
To build the runtime with the ``Kokkos::OpenMP`` backend execution space:

.. code-block:: console
make runtime CMAKE_ARGS="-DKokkos_ENABLE_OPENMP=ON"
You can also use ``ENABLE_OPENQASM=OFF`` to disable building the runtime with `Amazon-Braket-OpenQasm <https://aws.amazon.com/braket/>`_:
You can use ``ENABLE_OPENQASM=OFF`` to disable building the runtime with `Amazon-Braket-OpenQasm <https://aws.amazon.com/braket/>`_:

.. code-block:: console
Expand Down
2 changes: 1 addition & 1 deletion runtime/lib/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_subdirectory(dummy)
configure_file(dummy/dummy_device.toml dummy_device.toml)
if(ENABLE_LIGHTNING OR ENABLE_LIGHTNING_KOKKOS)
if(ENABLE_LIGHTNING)
add_subdirectory(lightning)
endif()
if(ENABLE_OPENQASM)
Expand Down
11 changes: 1 addition & 10 deletions runtime/lib/backend/lightning/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,8 @@ else()
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # build with -fPIC

if(ENABLE_LIGHTNING AND ENABLE_LIGHTNING_KOKKOS)
set(PL_BACKEND "lightning_qubit;lightning_kokkos" CACHE STRING "PennyLane Lightning backend")
elseif(ENABLE_LIGHTNING)
if(ENABLE_LIGHTNING)
set(PL_BACKEND "lightning_qubit" CACHE STRING "PennyLane Lightning backend")
elseif(ENABLE_LIGHTNING_KOKKOS)
set(PL_BACKEND "lightning_kokkos" CACHE STRING "PennyLane Lightning backend")
endif()
set(ENABLE_PYTHON OFF CACHE BOOL "Enable compilation of the Python module")

Expand All @@ -65,11 +61,6 @@ if(ENABLE_LIGHTNING)
lightning_dynamic/LightningSimulator.cpp
)
endif()
if(ENABLE_LIGHTNING_KOKKOS)
list(APPEND src_files
lightning_kokkos/LightningKokkosSimulator.cpp
)
endif()

add_library(rtd_lightning SHARED ${src_files})
add_dependencies(rtd_lightning pennylane_lightning)
Expand Down
Loading

0 comments on commit f82d2ca

Please sign in to comment.