Skip to main content

PennyLane-Lightning-Kokkos plugin

Project description

The PennyLane-Lightning-Kokkos plugin extends the Pennylane-Lightning state-vector simulator written in C++, and offloads to the Kokkos library for accelerated circuit simulation.

PennyLane is a cross-platform Python library for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations.

Installation

cmake -Bbuild -DKokkos_ENABLE_OPENMP=On -DPLKOKKOS_BUILD_TESTS=On -G Ninja
cmake --build ./build

You can install the python interface with:

python setup.py build_ext --backend="OPENMP"
python setup.py bdist_wheel
pip install ./dist/PennyLane*.whl --force-reinstall

or for an editable pip installation with:

BACKEND="OPENMP" python -m pip install -e .

Supported backend options are “SERIAL”, “OPENMP”, “THREADS”, “HIP” and “CUDA”. For “HIP” and “CUDA”, the appropriate software stacks are required to enable compilation and subsequent use. For explicit targeting of a given supported architecture, the environment variable ARCH can also be specified which directly sets the -DKokkos_ARCH_{…}=ON build option. Note that “THREADS” backend is not recommended since Kokkos does not guarantee its safety.

Testing

To test with the ROCm stack using a manylinux2014 container we must first mount the repository into the container:

docker run -v `pwd`:/io -it quay.io/pypa/manylinux2014_x86_64 bash

Next, within the container, we install the ROCm software stack:

yum install -y https://repo.radeon.com/amdgpu-install/21.40.2/rhel/7.9/amdgpu-install-21.40.2.40502-1.el7.noarch.rpm
amdgpu-install --usecase=hiplibsdk,rocm --no-dkms

We next build the test-suite, with a given AMD GPU target in mind, as listed here.

cd /io
export PATH=$PATH:/opt/rocm/bin/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib
export CXX=/opt/rocm/hip/bin/hipcc
cmake -Bbuild -DCMAKE_CXX_COMPILER=/opt/rocm/hip/bin/hipcc -DKokkos_ENABLE_HIP=on -DPLKOKKOS_BUILD_TESTS=On -DKokkos_ARCH_VEGA90A=ON
cmake --build ./build --verbose

We may now leave the container, and run the built test-suite on a machine with access to the targetted GPU.

For a system with access to the ROCm stack outside of a manylinux container, an editable pip installation can be built and installed as:

BACKEND="HIP" ARCH="VEGA90A" python -m pip install -e .

Support

If you are having issues, please let us know by posting the issue on our Github issue tracker, or by asking a question in the forum.

License

The PennyLane-Lightning-Kokkos plugin is free and open source, released under the Apache License, Version 2.0. The PennyLane-Lightning-Kokkos plugin makes use of the Kokkos library, which is held to their own respective licenses.

Acknowledgements

The PennyLane Lightning Kokkos plugin makes use of the following libraries and tools, which are under their own respective licenses:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PennyLane-Lightning-Kokkos-0.30.0.tar.gz (21.8 kB view hashes)

Uploaded Source

Built Distributions

PennyLane_Lightning_Kokkos-0.30.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (807.8 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

PennyLane_Lightning_Kokkos-0.30.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (807.9 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

PennyLane_Lightning_Kokkos-0.30.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (807.7 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

PennyLane_Lightning_Kokkos-0.30.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (807.0 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page