Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the readability of README #851

Merged
merged 49 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
cf182cc
Improve a bit the readme file
LuisAlfredoNu Aug 13, 2024
543fd28
Added rulers to readme
LuisAlfredoNu Aug 13, 2024
cb81590
added version of Kokkos
LuisAlfredoNu Aug 13, 2024
a0ef5a8
fix code block sintax
LuisAlfredoNu Aug 13, 2024
1c8acb1
Added hyperlink to installation sections
LuisAlfredoNu Aug 13, 2024
84a6fae
fix kokkos verion tested
LuisAlfredoNu Aug 13, 2024
a61d4a3
Auto update version from '0.38.0-dev30' to '0.38.0-dev32'
ringo-but-quantum Aug 13, 2024
244f6ef
Merge branch 'master' into kokkosNewAPI_readme
LuisAlfredoNu Aug 13, 2024
f6b86c6
Auto update version from '0.38.0-dev31' to '0.38.0-dev32'
ringo-but-quantum Aug 13, 2024
c941b96
Update README.rst
LuisAlfredoNu Aug 13, 2024
24ebca9
Update README.rst single line for sudo apt update
LuisAlfredoNu Aug 13, 2024
e34c79c
test for the website
LuisAlfredoNu Aug 13, 2024
7fdd437
test for the website
LuisAlfredoNu Aug 13, 2024
eff9056
change console by bash
LuisAlfredoNu Aug 13, 2024
a610df0
changed kokkos version
LuisAlfredoNu Aug 13, 2024
6ebbbb9
added suggestions from review
LuisAlfredoNu Aug 13, 2024
74c5c41
Auto update version from '0.38.0-dev32' to '0.38.0-dev33'
ringo-but-quantum Aug 13, 2024
fbcf68c
update broken links
LuisAlfredoNu Aug 13, 2024
e198e8c
Merge branch 'master' into kokkosNewAPI_readme
LuisAlfredoNu Aug 13, 2024
3b37a47
Auto update version from '0.38.0-dev32' to '0.38.0-dev33'
ringo-but-quantum Aug 13, 2024
97c9ace
remove the splitter
LuisAlfredoNu Aug 14, 2024
ff0e998
expand testing explanation
LuisAlfredoNu Aug 14, 2024
8a50ffd
remove the splitter
LuisAlfredoNu Aug 14, 2024
43b509e
Added the list of CMAKE options
LuisAlfredoNu Aug 14, 2024
9c38557
fix table
LuisAlfredoNu Aug 14, 2024
c7e853f
fix table
LuisAlfredoNu Aug 14, 2024
f95341b
Auto update version from '0.38.0-dev33' to '0.38.0-dev34'
ringo-but-quantum Aug 14, 2024
482d076
fix table
LuisAlfredoNu Aug 14, 2024
1bdd6df
Merge branch 'kokkosNewAPI_readme' of github.com:PennyLaneAI/pennylan…
LuisAlfredoNu Aug 14, 2024
d9b3c54
Move table for CMake optiont to a file
LuisAlfredoNu Aug 14, 2024
281b127
Fix link
LuisAlfredoNu Aug 14, 2024
cc7d0a8
Added the suggestion of Ali
LuisAlfredoNu Aug 14, 2024
bfe2ff5
Change bullet style
LuisAlfredoNu Aug 15, 2024
71ae786
Auto update version from '0.38.0-dev34' to '0.38.0-dev35'
ringo-but-quantum Aug 15, 2024
22b3dc8
remove wrong item in the cmake options list
LuisAlfredoNu Aug 15, 2024
fa40ce1
Merge branch 'kokkosNewAPI_readme' of github.com:PennyLaneAI/pennylan…
LuisAlfredoNu Aug 15, 2024
46f1543
horizontal bullets
LuisAlfredoNu Aug 15, 2024
62d9623
horizontal bullets fix
LuisAlfredoNu Aug 15, 2024
5b3b576
Update pip options
LuisAlfredoNu Aug 16, 2024
4095560
Update commit options
LuisAlfredoNu Aug 16, 2024
61e6cd0
update pip options
LuisAlfredoNu Aug 16, 2024
a9e1905
Fix makefile
LuisAlfredoNu Aug 16, 2024
d9c7b1c
Remove the file propose for CMakeOptions.rst
LuisAlfredoNu Aug 16, 2024
34e3c71
update cmake options
LuisAlfredoNu Aug 16, 2024
f0b0432
Update Makefile
LuisAlfredoNu Aug 16, 2024
838445b
Merge branch 'master' into kokkosNewAPI_readme
LuisAlfredoNu Aug 16, 2024
bfcbf60
Auto update version from '0.38.0-dev34' to '0.38.0-dev35'
ringo-but-quantum Aug 16, 2024
9746de6
installation instructions update
isaacdevlugt Aug 16, 2024
6ca6d57
trigger CIs
LuisAlfredoNu Aug 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 87 additions & 45 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,21 @@ To build Lightning plugins from source you can run

$ PL_BACKEND=${PL_BACKEND} pip install pybind11 pennylane-lightning --no-binary :all:

where ``${PL_BACKEND}`` can be ``lightning_qubit`` (default), ``lightning_gpu`` or ``lightning_kokkos``.
where ``${PL_BACKEND}`` can be

- ``lightning_qubit`` (default),
- ``lightning_gpu``
- ``lightning_kokkos``
- ``lightning_tensor``

LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved
The `pybind11 <https://pybind11.readthedocs.io/en/stable/>`_ library is required to bind the C++ functionality to Python.

A C++ compiler such as ``g++``, ``clang++``, or ``MSVC`` is required.
On Debian-based systems, this can be installed via ``apt``:

.. code-block:: console

$ sudo apt -y update &&
$ sudo apt -y update
$ sudo apt install g++ libomp-dev
LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved

where ``libomp-dev`` is included to also install OpenMP.
Expand All @@ -122,8 +128,8 @@ On MacOS, we recommend using the latest version of ``clang++`` and ``libomp``:

$ brew install llvm libomp

The Lightning-GPU backend has several dependencies (e.g. ``CUDA``, ``custatevec-cu12``, etc.), and hence we recommend referring to Lightning-GPU installation section.
Similarly, for Lightning-Kokkos it is recommended to configure and install Kokkos independently as prescribed in the Lightning-Kokkos installation section.
The Lightning-GPU backend has several dependencies (e.g. ``CUDA``, ``custatevec-cu12``, etc.), and hence we recommend referring to `Lightning-GPU installation`_ section.
LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved
LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved
Similarly, for Lightning-Kokkos it is recommended to configure and install Kokkos independently as prescribed in the `Lightning-Kokkos installation`_ section.
LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved
LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved

Development installation
========================
Expand All @@ -146,6 +152,15 @@ You can also pass ``cmake`` options with ``CMAKE_ARGS`` as follows:
.. code-block:: console

$ CMAKE_ARGS="-DENABLE_OPENMP=OFF -DENABLE_BLAS=OFF" pip install -e . -vv

Supported options are

- ``-DENABLE_WARNINGS:BOOL=ON``
- ``-DENABLE_NATIVE:BOOL=ON`` (for ``-march=native``)
- ``-DENABLE_BLAS:BOOL=ON``
- ``-DENABLE_OPENMP:BOOL=ON``
- ``-DENABLE_CLANG_TIDY:BOOL=ON``
maliasadi marked this conversation as resolved.
Show resolved Hide resolved


Compile MSVC (Windows)
======================
Expand All @@ -172,35 +187,31 @@ Then a common command will work.

Note that OpenMP and BLAS are disabled on this platform.

CMake support
=============

One can also build the plugin using CMake:

.. code-block:: console
Testing
=======

$ cmake -S. -B build
$ cmake --build build
To test that a plugin is working correctly,
LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved

Supported options are
Python Test
^^^^^^^^^^^

- ``-DENABLE_WARNINGS:BOOL=ON``
- ``-DENABLE_NATIVE:BOOL=ON`` (for ``-march=native``)
- ``-DENABLE_BLAS:BOOL=ON``
- ``-DENABLE_OPENMP:BOOL=ON``
- ``-DENABLE_CLANG_TIDY:BOOL=ON``
Test the Python code with:

Testing
=======
.. code-block:: console

To test that a plugin is working correctly, test the Python code with:
$ make test-python device=${PL.DEVICE}
LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: console
where ``${PL.DEVICE}`` differ from ``${PL_BACKEND}`` by replacing the underscore by a dot. And can be

$ make test-python device=${PL_DEVICE}
- ``lightning.qubit`` (default)
- ``lightning.gpu``
- ``lightning.kokkos``
- ``lightning.tensor``

where ``${PL_DEVICE}`` can be ``lightning.qubit`` (default), ``lightning.gpu`` or ``lightning.kokkos``.
These differ from ``${PL_BACKEND}`` by replacing the underscore by a dot.
C++ Test
^^^^^^^^

The C++ code can be tested with

.. code-block:: console
Expand All @@ -211,6 +222,8 @@ The C++ code can be tested with

.. installation_LGPU-start-inclusion-marker-do-not-remove

--------------------------
LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved

Lightning-GPU installation
**************************

Expand Down Expand Up @@ -269,7 +282,7 @@ Then Lightning-GPU with MPI support can then be installed with ``pip``:
.. code-block:: console
LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved

PL_BACKEND="lightning_gpu" python scripts/configure_pyproject_toml.py
CMAKE_ARGS="-DENABLE_MPI=ON" python -m pip install -e .
CMAKE_ARGS="-DENABLE_MPI=ON" python -m pip install -e . -vv
maliasadi marked this conversation as resolved.
Show resolved Hide resolved


Test Lightning-GPU with MPI
Expand All @@ -295,6 +308,8 @@ The C++ code is tested with

.. installation_LKokkos-start-inclusion-marker-do-not-remove

-----------------------------

LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved
Lightning-Kokkos installation
*****************************

Expand All @@ -309,12 +324,26 @@ Install Lightning-Kokkos from source

As Kokkos enables support for many different HPC-targeted hardware platforms, ``lightning.kokkos`` can be built to support any of these platforms when building from source.

Install Kokkos (Optional)
^^^^^^^^^^^^^^^^^^^^^^^^^

We suggest first installing Kokkos with the wanted configuration following the instructions found in the `Kokkos documentation <https://kokkos.github.io/kokkos-core-wiki/building.html>`_.
For example, the following will build Kokkos for NVIDIA A100 cards

Download the `Kokkos code <https://github.com/kokkos/kokkos/releases>`_. Lightning Kokkos was tested with Kokkos version <= 4.3.01

.. code-block:: console

$ # Replace x, y, and z by the correct version
$ wget https://github.com/kokkos/kokkos/archive/refs/tags/4.x.yz.tar.gz
$ tar -xvf 4.x.yz.tar.gz
$ cd kokkos-4.x.yz

Build Kokkos for NVIDIA A100 cards
multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: console

cmake -S . -B build -G Ninja \
$ cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
-DCMAKE_INSTALL_PREFIX=/opt/kokkos/4.1.00/AMPERE80 \
-DCMAKE_CXX_STANDARD=20 \
Expand All @@ -326,29 +355,38 @@ For example, the following will build Kokkos for NVIDIA A100 cards
-DKokkos_ENABLE_EXAMPLES:BOOL=OFF \
-DKokkos_ENABLE_TESTS:BOOL=OFF \
-DKokkos_ENABLE_LIBDL:BOOL=OFF
cmake --build build && cmake --install build
echo export CMAKE_PREFIX_PATH=/opt/kokkos/4.1.00/AMPERE80:\$CMAKE_PREFIX_PATH
LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved
$ cmake --build build && cmake --install build
$ export CMAKE_PREFIX_PATH=/opt/kokkos/4.1.00/AMPERE80:\$CMAKE_PREFIX_PATH

Next, append the install location to ``CMAKE_PREFIX_PATH``.
Note that the C++20 standard is required (``-DCMAKE_CXX_STANDARD=20`` option), and hence CUDA v12 is required for the CUDA backend.
If an installation is not found, our builder will clone and install it during the build process.

Install Lightning-Kokkos
^^^^^^^^^^^^^^^^^^^^^^^^

If an installation of Kokkos is not found, then our builder will clone and install it during the build process. Lightning-Qubit should be installed (compilation is not necessary):

The simplest way to install Lightning-Kokkos (OpenMP backend) through ``pip``.

.. code-block:: console

PL_BACKEND="lightning_kokkos" python scripts/configure_pyproject_toml.py
CMAKE_ARGS="-DKokkos_ENABLE_OPENMP=ON" python -m pip install .

To build the plugin directly with CMake as above:
$ git clone https://github.com/PennyLaneAI/pennylane-lightning.git
$ cd pennylane-lightning
$ PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py
$ SKIP_COMPILATION=True pip install -e . -vv
$ PL_BACKEND="lightning_kokkos" python scripts/configure_pyproject_toml.py
$ CMAKE_ARGS="-DKokkos_ENABLE_OPENMP=ON" python -m pip install -e . -vv

.. code-block:: console
The supported backend options are

cmake -B build -DKokkos_ENABLE_OPENMP=ON -DPL_BACKEND=lightning_kokkos -G Ninja
cmake --build build
- ``SERIAL``
- ``OPENMP``
- ``THREADS``
- ``HIP``
- ``CUDA``
maliasadi marked this conversation as resolved.
Show resolved Hide resolved
maliasadi marked this conversation as resolved.
Show resolved Hide resolved

and the corresponding build options are ``-DKokkos_ENABLE_XXX=ON``, where ``XXX`` needs be replaced by the backend name, for instance ``OPENMP``.

The supported backend options are ``SERIAL``, ``OPENMP``, ``THREADS``, ``HIP`` and ``CUDA`` and the corresponding build options are ``-DKokkos_ENABLE_XXX=ON``, where ``XXX`` needs be replaced by the backend name, for instance ``OPENMP``.
One can activate simultaneously one serial, one parallel CPU host (e.g. ``OPENMP``, ``THREADS``) and one parallel GPU device backend (e.g. ``HIP``, ``CUDA``), but not two of any category at the same time.
For ``HIP`` and ``CUDA``, the appropriate software stacks are required to enable compilation and subsequent use.
Similarly, the CMake option ``-DKokkos_ARCH_{...}=ON`` must also be specified to target a given architecture.
Expand All @@ -359,6 +397,8 @@ Note that ``THREADS`` backend is not recommended since `Kokkos does not guarante

.. installation_LTensor-start-inclusion-marker-do-not-remove

-----------------------------

Lightning-Tensor installation
*****************************
Lightning-Tensor requires CUDA 12 and the `cuQuantum SDK <https://developer.nvidia.com/cuquantum-sdk>`_ (only the `cutensornet <https://docs.nvidia.com/cuda/cuquantum/latest/cutensornet/index.html>`_ library is required).
Expand All @@ -371,24 +411,24 @@ Lightning-Qubit should be installed before Lightning-Tensor (compilation is not

.. code-block:: console

git clone https://github.com/PennyLaneAI/pennylane-lightning.git
cd pennylane-lightning
pip install -r requirements.txt
PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py
SKIP_COMPILATION=True pip install .
$ git clone https://github.com/PennyLaneAI/pennylane-lightning.git
$ cd pennylane-lightning
$ pip install -r requirements.txt
$ PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py
$ SKIP_COMPILATION=True pip install .
LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved

Then the `cutensornet`_ library can be installed and set a ``CUQUANTUM_SDK`` environment variable.

.. code-block:: console

export CUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')")
$ export CUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')")

The Lightning-Tensor can then be installed with ``pip``:

.. code-block:: console

PL_BACKEND="lightning_tensor" python scripts/configure_pyproject_toml.py
pip install -e .
$ PL_BACKEND="lightning_tensor" python scripts/configure_pyproject_toml.py
$ pip install -e . -vv

.. installation_LTensor-end-inclusion-marker-do-not-remove

Expand All @@ -398,6 +438,8 @@ well as to the `PennyLane documentation <https://docs.pennylane.ai/>`_ for furth

.. docker-start-inclusion-marker-do-not-remove

--------------
LuisAlfredoNu marked this conversation as resolved.
Show resolved Hide resolved

Docker support
**************

Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.38.0-dev31"
__version__ = "0.38.0-dev32"
Loading