Skip to content

Commit

Permalink
Add MPSTNCuda class (#704)
Browse files Browse the repository at this point in the history
* init commit

* Auto update version from '0.36.0-dev44' to '0.36.0-dev46'

* typo fix

* fix last blank line error

* fix codecov warnings

* fix CI & change ctor interface

* remove unused methods

* tidy up code and add more unit tests

* add testhelper & tidy up code

* fix typo

* set PL_TENSOR in the root cmakelists

* add more tests for tensor classes

* make format

* fix sitesExtents_ init & add mpscutn tests

* only test cutnmps cpp layer

* further tidy up code

* update MPS ctor

* refactor MPSCutn to allow easy TN extension

* move methods to CutnBase class & rename maxextent

* update docstring

* turn on all ci unit tests

* fix codefactor complaining

* add changelog

* Trigger CI

* quick fix for getFreeMemorySize

* fix based on some comments

* size_t->std::size_t

* set computeState() as protected & make format

* copy ctor -> std::move

* safer store for ptr to sitesExtents and tensor

* std::vector<void*> ->std::vector<uint64_t*>

* update base on comments

* update docstring

* update memory set

* make format

* size_t->std::size_t for ->GENERATE

* Auto update version from '0.36.0-dev46' to '0.36.0-dev48'

* On-Board Lightning Linux workflows (that are run on PRs) to large runners based on label (#700)

* Try on-boarding to large runner

* Auto update version from '0.36.0-dev43' to '0.36.0-dev44'

* Remove usage of runner.os in job name

* Fix invalid runs-on

* Remove usage of runner.os in job name

* Trigger CI

* Fix inputs.run-on for build&cache kokkos

* Trigger CI

* Auto update version from '0.36.0-dev45' to '0.36.0-dev46'

---------

Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: Vincent Michaud-Rioux <[email protected]>

* Port PR #705 changes (#711)

* port PR #705 changes

* Auto update version from '0.36.0-dev45' to '0.36.0-dev46'

* Update pennylane_lightning/lightning_qubit/lightning_qubit.py

Co-authored-by: Ali Asadi <[email protected]>

* Trigger CIs

* fix CodeFactor fail

* fix CodeFactor fail

* fix CodeFactor fail

* Auto update version from '0.36.0-dev46' to '0.36.0-dev47'

---------

Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: Ali Asadi <[email protected]>

* fix naming comments and drop initHelper_()

* move MPSStatus to MPS class & update docstrings

* udpate tensornetbase ctor

* Auto update version from '0.36.0-dev48' to '0.36.0-dev49'

* enum to c++ style

* update unit tests

* update class name cutn->TNCuda

* Auto update version from '0.36.0-dev49' to '0.37.0-dev2'

* Syncing master with V0.36.0 branch (#715)

* Update Changelog

* update release candidate version

* run agains pennylane rc

* update relese cadidate version

* Increase tolerance for a flaky test (test_single_return_value)

* Update `LightningBaseFallBack` to raise an error instead of falling back to default.qubit (#689)

* Initial commit.

* Update changelog

* Auto update version

* trigger ci

* Unused import.

* Auto update version

* trigger ci

* Fix imports.

* Auto update version

* Fix LightningException

* make format

* Auto update version from '0.36.0-dev34' to '0.36.0-dev35'

* Auto update version from '0.36.0-dev35' to '0.36.0-dev36'

* Auto update version from '0.36.0-dev36' to '0.36.0-dev37'

* Make python -m pip install consistent.

* Fix ImportError

* Auto update version from '0.36.0-dev37' to '0.36.0-dev38'

* --force-reinstall

* Auto update version from '0.36.0-dev38' to '0.36.0-dev39'

* Remove --force-reinstall

* Auto update version from '0.36.0-dev39' to '0.36.0-dev40'

* Auto update version from '0.36.0-dev42' to '0.36.0-dev43'

* Auto update version from '0.36.0-dev43' to '0.36.0-dev44'

* Spec CMAKE_CXX_COMPILER

* Fix quotes.

* Remove quotes

* Hardcode g++-11

* use env.COMPILER

* which g++

* Revert

* Downgrade pip

* Pin libomp.

* Revert wheel_linux

* Upload artifacts.

* Comment upload trigger

* Install pip==23

* Revert libomp

* try testing outside cibuildwheel

* yum install devtools

* yum install devtools

* Do not install python

* Revert changes

* Don't editable install.

* Not edit install

* Not edit install

* Fix cov path

* Explicit mcm tests path

* Fix qml.QuantumFunctionError error messages.

---------

Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: AmintorDusko <[email protected]>

* trigger CIs

* Introduce pytest-splits (#696)

* Try update lightning CI paths

* Auto update version

* Update kokkos tests to trigger on changes to pl core

* Auto update version

* Split tests_linux.yml into cpp/python.

* Auto update version from '0.36.0-dev36' to '0.36.0-dev38'

* Split GPU tests into cpp/python.

* Split MPI-GPU tests into cpp/python.

* Fix LGPU triggers.

* Remove python tests from LGPU-C++.

* Remove upload-to-codecov-linux-cpp from LGPUMPI tests.

* Rename test workflows.

* Update changelog.

* Change group names.

* Use paths-ignore to simplify workflow paths

* Auto update version from '0.36.0-dev38' to '0.36.0-dev39'

* Fix test names.

* you may only define one of `paths` and `paths-ignore` for a single event

* Fix formatting

* Auto update version from '0.36.0-dev39' to '0.36.0-dev40'

* Change to paths-ignore in no-bin tests.

* Auto update version from '0.36.0-dev40' to '0.36.0-dev41'

* trigger ci

* Change error message.

* Split build/test jobs.

* Revert pennylane_lightning/lightning_kokkos/lightning_kokkos.py

* Fix setup.py command

* Comment workflows

* Comment pull_request:

* Copy wheels to github.workspace /wheels

* SKIP_COMPILATION=True

* Revert SKIP_COMPILATION=True

* Remove duplicate python actions.

* Split LQ-test into 5 groups.

* Update requirements-dev.txt

* 2 groups

* 1 group

* 7 groups

* Refactor LKokos tests

* Auto update version from '0.36.0-dev42' to '0.36.0-dev43'

* Fix cache id

* Fix needs

* Remove all builds

* put back CMAKE_PREFIX_PATH

* install fake lightning

* Fix compat paths

* Auto update version from '0.36.0-dev42' to '0.36.0-dev43'

* Revert changes.

* Update changelog

* trigger ci

* build_and_cache_Kokkos_linux.yml not concurrent.

* Remove C++ tests from compat tests (skipped anyways).

* Use ${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} for concurrency groups.

* PL_BACKEND: ${{ matrix.pl_backend }}

* Update changelog

* Install wheel package.

* Auto update version from '0.36.0-dev43' to '0.36.0-dev44'

* Install scipy wheel in one place.

* Comment job triggers.

* Add LK[cpu] est durations.

* trigger ci

* Use sha independent keys.

* trigger ci

* build_and_cache_Kokkos

* Change LK keys

* ls -l

* Install version nonce

* Do not skip comp.

* Trade ref for sha in key

* Install after PL

* ref ==> sha

* Reorder

* Try LQ workflows.

* Use actions/setup-python

* Revert triggers.

* Provide correct cov path.

* Revert pennylane_lightning/core/src/utils/config.h

* LK uses 5 groups.

* Restore wheels to main

* main/wheels

* Revert cache paths

* Fix ls -l

* fail-on-cache-miss: true

* Introduce env.GITHUB_WORKSPACE

* Use artifacts

* Fix paths

* No ls -l

* Download to github.workspace

* fix wheel name

* WHEEL_NAME

* Add blas.

* Use outputs.

* Send wheel name

* Fix artifact name

* Fix name

* Use WHEEL_NAME var

* artifacts kokkos

* fix wheel name

* Restore bins.

* Clean up

* Split Linux CPU python tests into 2.

* Fix compat workflows.

* Split format and tidy workflows.

* fix lkcpu

* fix concurrency group

* Do not use editable installs.

* Split full kokkos tests except unitary_correct

* Upload LK test durations.

* duration-paths

* Unique test_durations

* Unique test_durations

* Unique test_durations

* Fix path

* Update python_lightning_kokkos_test_durations

* Remove obsolete all and SERIAL tests.

* Update changelog

* Creating the `LightningTensor` device class based on the new API (#671)

* empty commit (triggering CI)

* Auto update version

* Definition of the two front-end classes

* adding the `lightning_tensor` string to the supported backends in `setup.py`

* adding `__init__.py` file to directly import the `lightning_tensor` device class

* re-naming file

* Auto update version

* Creating the first prototype of initial MPS state tensor using `quimb`

* providing the `backend`, `method` parameters and making `wires` optional

* Changing names and structure

* Auto update version

* adding method required by the new device API design

* Auto update version

* using the `kwargs` parameter in `LightningTensor` and `CircuitMPS` in `quimb`

* taking some further inputs from the new device API

* Perhaps decided the overall structure of `LIghtningTensor`

* Auto update version

* adding docs to methods

* temporary changes so that `pylint` does not complain at this stage

* running `isort`

* re-running formatter after `isort`

* re-running formatter after `isort`

* Applying suggested formatting change from CI

* adding tmp unit tests

* Adding `quimb` in `requirements.txt`

* runing `isort` on mps test

* removing `quimb` from requirement and deleting unit tests for `lightning.tensor`

* Auto update version

* re-inserting unit tests with an additional `yml` file

* running isort on quimb test

* changing name of yml file

* preventing error in import

* updating yml file

* inserting `quimb` package in requirements-dev

* strange error with `quimb`

* strange error with `quimb`

* specifying scipy version

* removing installation of scipy from yml file

* removing the new `yml` file

* testing if tests are tested

* Covering all lines in tests

* forgot final line for formatter

* Python formatter on CI complaints

* covering missing lines

* formatter on CI complaints

* Trying not to skip test if Cpp is enabled

* skipping tests if Cpp is enabled

* removing the only line not covered by tests so far

* Auto update version

* Applying suggestions from code review and making the `state` attribute private (new API design)

* Python formatter

* removing params from `QuimbMPS`

* Auto update version

* removing `**kwargs` from `QuimbMPS`

* removing unnecessary param at this stage

* covering test line

* formatter...

* removing param description

* Making `pylint` happy

* forgot new arg in test

* Updating base class and `preprocess` function

* Updating `LightningTensor` class with new names from more advanced PR

* Auto update version

* Auto update version

* Triggering CI

* Auto update version

* Trying to remove pin from `quimb` in `requirements.dev`

* Auto update version

* Auto update version

* Removing infos on derivatives and using config options to pass parameters to interface

* Usual `pylint` failures

* Trying to solve formatting errors

* typo in docstring

* Sunday update: improved docstrings and structure

* Removing method that was supposed to be in next PR

* removing old TODO comment

* Removing changes from the `setup.py` file

* restoring previous format to `setup.py`

* Auto update version from '0.36.0-dev34' to '0.36.0-dev41'

* Auto update version from '0.36.0-dev40' to '0.36.0-dev41'

* Removing kwargs as suggested from code review

* Addressing comments from CR

* Skipping tests if CPP binary is available

* Auto update version from '0.36.0-dev42' to '0.36.0-dev43'

* Auto update version from '0.36.0-dev43' to '0.36.0-dev44'

* Restoring name in changelog (?)

* Increasing time limit for Python tests

* Applying suggestions from code review

---------

Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ringo-but-quantum <[email protected]>

* Increase tolerance for a flaky test (test_single_return_value) (#703)

* update dev version

* increase tolerance

* update changelog

* trigger CIs

* Auto update version from '0.36.0-dev44' to '0.36.0-dev45'

---------

Co-authored-by: ringo-but-quantum <[email protected]>

* Auto update version from '0.36.0-dev45' to '0.36.0-dev46'

* Remove LTensor stuff

* Update changelog

* Revert requirements-dev.txt

* trigger ci

* Update python_lightning_kokkos_test_durations

* Restore 'all' tests in tests_lkcuda_python.yml

* Fix durations paths.

* Try --splitting-algorithm=least_duration

* Try no -n auto lkcpu tests

* One last test.

---------

Co-authored-by: Rashid N H M <[email protected]>
Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: Pietropaolo Frisoni <[email protected]>
Co-authored-by: Amintor Dusko <[email protected]>

* Update changelog (#706)

* Use wire order specified on instantiation (#705)

* use map wires instead of map_to_standard_wires

* oops

* Update .github/CHANGELOG.md

* black

* Trigger CIs

* add test

* black on tests

* Update .github/CHANGELOG.md

---------

Co-authored-by: AmintorDusko <[email protected]>
Co-authored-by: Ali Asadi <[email protected]>

* Update wire order support for probabilities (#707)

* Begin expansion of probs tests

* Update tests to exhaustively compute probs with wires

* Update all tests in LQ Meas to use CHECK instead of REQUIRES for better signal of failures

* Add Jet Permuter

* Add noisy functionality

* Fix permutation ordering

* Update changelog

* Fix wrong ordering in probs tests

* Add recommendation from apache flink to purge azure dirs

* Forbid out of order indices for probs with LK and LG in CPP layer

* Remove MSFT tools from GH Actions

* Just try to remove dotnet

* List opt hostedtoolcache

* Remove packages from /opt/hostedtoolcache

* Fix missing test hit

* Forbid and remove broken tests from LK probs ordering

* Fix clang-tidy isms

* Ensure libopenblas is not broken from failed apt pull with dev

* Appease GH Action

* Full remove GH action modifier step due to unexplained failures

* Add bidreictional wire validation for LGPU CPP layer

* Clang-tidy warning fix

* Appease CT

* Update JET license agreement

* Sync version

* pacify CodeFactor

* make CodeFactor ignore all JET code

* trigger ci

* trigger ci

* build wheels for test

* remove Win LKokkos upload-pypi [skip-ci]

* [skip ci]

* trigger wheels CIs with Release event

* update version

* fix upload wheels artifact for release

* target pennylane master

* Version bump CHANGELOG

* Auto update version from '' to '0.36.0-dev48'

* version bump to dev0

* Auto update version from '0.37.0-dev0' to '0.36.0-dev48'

* Update version

* Auto update version from '0.37.0-dev0' to '0.36.0-dev48'

* Update pennylane_lightning/core/_version.py

---------

Co-authored-by: Vincent Michaud-Rioux <[email protected]>
Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: Rashid N H M <[email protected]>
Co-authored-by: Pietropaolo Frisoni <[email protected]>
Co-authored-by: Ali Asadi <[email protected]>
Co-authored-by: Christina Lee <[email protected]>
Co-authored-by: Lee James O'Riordan <[email protected]>
Co-authored-by: Vincent Michaud-Rioux <[email protected]>

* Update Linux wheels to use manylinux_2_28 (#667)

* update version

* update gcc and containers for linux_x86_64

* trigger CIs

* test Engine

* try removing podman

* try alternative path for docker

* y

* priviledged container

* aarch64

* build wheels

* dnf->yum

* install dependencies (apt)

* update container

* update and build ppc64le wheels

* update and build x86_64_cuda wheels

* update config-manager

* add install dnf-utils

* Auto update version

* update dev version

* move dnf-utils

* set cuda repository to AlmaLinux

* make gcc 12

* Auto update version

* trigger ci

* upload artifacts

* Update .github/workflows/wheel_linux_x86_64.yml

Co-authored-by: Ali Asadi <[email protected]>

* Update .github/workflows/wheel_linux_x86_64.yml

Co-authored-by: Raul Torres <[email protected]>

* Auto update version from '0.36.0-dev29' to '0.36.0-dev36'

* fix source for linux_x86_64_cuda

* Auto update version from '0.36.0-dev37' to '0.36.0-dev36'

* Update Changelog

* update release candidate version

* run agains pennylane rc

* update relese cadidate version

* Increase tolerance for a flaky test (test_single_return_value)

* format

* Update `LightningBaseFallBack` to raise an error instead of falling back to default.qubit (#689)

* Initial commit.

* Update changelog

* Auto update version

* trigger ci

* Unused import.

* Auto update version

* trigger ci

* Fix imports.

* Auto update version

* Fix LightningException

* make format

* Auto update version from '0.36.0-dev34' to '0.36.0-dev35'

* Auto update version from '0.36.0-dev35' to '0.36.0-dev36'

* Auto update version from '0.36.0-dev36' to '0.36.0-dev37'

* Make python -m pip install consistent.

* Fix ImportError

* Auto update version from '0.36.0-dev37' to '0.36.0-dev38'

* --force-reinstall

* Auto update version from '0.36.0-dev38' to '0.36.0-dev39'

* Remove --force-reinstall

* Auto update version from '0.36.0-dev39' to '0.36.0-dev40'

* Auto update version from '0.36.0-dev42' to '0.36.0-dev43'

* Auto update version from '0.36.0-dev43' to '0.36.0-dev44'

* Spec CMAKE_CXX_COMPILER

* Fix quotes.

* Remove quotes

* Hardcode g++-11

* use env.COMPILER

* which g++

* Revert

* Downgrade pip

* Pin libomp.

* Revert wheel_linux

* Upload artifacts.

* Comment upload trigger

* Install pip==23

* Revert libomp

* try testing outside cibuildwheel

* yum install devtools

* yum install devtools

* Do not install python

* Revert changes

* Don't editable install.

* Not edit install

* Not edit install

* Fix cov path

* Explicit mcm tests path

* Fix qml.QuantumFunctionError error messages.

---------

Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: AmintorDusko <[email protected]>

* trigger CIs

* Introduce pytest-splits (#696)

* Try update lightning CI paths

* Auto update version

* Update kokkos tests to trigger on changes to pl core

* Auto update version

* Split tests_linux.yml into cpp/python.

* Auto update version from '0.36.0-dev36' to '0.36.0-dev38'

* Split GPU tests into cpp/python.

* Split MPI-GPU tests into cpp/python.

* Fix LGPU triggers.

* Remove python tests from LGPU-C++.

* Remove upload-to-codecov-linux-cpp from LGPUMPI tests.

* Rename test workflows.

* Update changelog.

* Change group names.

* Use paths-ignore to simplify workflow paths

* Auto update version from '0.36.0-dev38' to '0.36.0-dev39'

* Fix test names.

* you may only define one of `paths` and `paths-ignore` for a single event

* Fix formatting

* Auto update version from '0.36.0-dev39' to '0.36.0-dev40'

* Change to paths-ignore in no-bin tests.

* Auto update version from '0.36.0-dev40' to '0.36.0-dev41'

* trigger ci

* Change error message.

* Split build/test jobs.

* Revert pennylane_lightning/lightning_kokkos/lightning_kokkos.py

* Fix setup.py command

* Comment workflows

* Comment pull_request:

* Copy wheels to github.workspace /wheels

* SKIP_COMPILATION=True

* Revert SKIP_COMPILATION=True

* Remove duplicate python actions.

* Split LQ-test into 5 groups.

* Update requirements-dev.txt

* 2 groups

* 1 group

* 7 groups

* Refactor LKokos tests

* Auto update version from '0.36.0-dev42' to '0.36.0-dev43'

* Fix cache id

* Fix needs

* Remove all builds

* put back CMAKE_PREFIX_PATH

* install fake lightning

* Fix compat paths

* Auto update version from '0.36.0-dev42' to '0.36.0-dev43'

* Revert changes.

* Update changelog

* trigger ci

* build_and_cache_Kokkos_linux.yml not concurrent.

* Remove C++ tests from compat tests (skipped anyways).

* Use ${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} for concurrency groups.

* PL_BACKEND: ${{ matrix.pl_backend }}

* Update changelog

* Install wheel package.

* Auto update version from '0.36.0-dev43' to '0.36.0-dev44'

* Install scipy wheel in one place.

* Comment job triggers.

* Add LK[cpu] est durations.

* trigger ci

* Use sha independent keys.

* trigger ci

* build_and_cache_Kokkos

* Change LK keys

* ls -l

* Install version nonce

* Do not skip comp.

* Trade ref for sha in key

* Install after PL

* ref ==> sha

* Reorder

* Try LQ workflows.

* Use actions/setup-python

* Revert triggers.

* Provide correct cov path.

* Revert pennylane_lightning/core/src/utils/config.h

* LK uses 5 groups.

* Restore wheels to main

* main/wheels

* Revert cache paths

* Fix ls -l

* fail-on-cache-miss: true

* Introduce env.GITHUB_WORKSPACE

* Use artifacts

* Fix paths

* No ls -l

* Download to github.workspace

* fix wheel name

* WHEEL_NAME

* Add blas.

* Use outputs.

* Send wheel name

* Fix artifact name

* Fix name

* Use WHEEL_NAME var

* artifacts kokkos

* fix wheel name

* Restore bins.

* Clean up

* Split Linux CPU python tests into 2.

* Fix compat workflows.

* Split format and tidy workflows.

* fix lkcpu

* fix concurrency group

* Do not use editable installs.

* Split full kokkos tests except unitary_correct

* Upload LK test durations.

* duration-paths

* Unique test_durations

* Unique test_durations

* Unique test_durations

* Fix path

* Update python_lightning_kokkos_test_durations

* Remove obsolete all and SERIAL tests.

* Update changelog

* Creating the `LightningTensor` device class based on the new API (#671)

* empty commit (triggering CI)

* Auto update version

* Definition of the two front-end classes

* adding the `lightning_tensor` string to the supported backends in `setup.py`

* adding `__init__.py` file to directly import the `lightning_tensor` device class

* re-naming file

* Auto update version

* Creating the first prototype of initial MPS state tensor using `quimb`

* providing the `backend`, `method` parameters and making `wires` optional

* Changing names and structure

* Auto update version

* adding method required by the new device API design

* Auto update version

* using the `kwargs` parameter in `LightningTensor` and `CircuitMPS` in `quimb`

* taking some further inputs from the new device API

* Perhaps decided the overall structure of `LIghtningTensor`

* Auto update version

* adding docs to methods

* temporary changes so that `pylint` does not complain at this stage

* running `isort`

* re-running formatter after `isort`

* re-running formatter after `isort`

* Applying suggested formatting change from CI

* adding tmp unit tests

* Adding `quimb` in `requirements.txt`

* runing `isort` on mps test

* removing `quimb` from requirement and deleting unit tests for `lightning.tensor`

* Auto update version

* re-inserting unit tests with an additional `yml` file

* running isort on quimb test

* changing name of yml file

* preventing error in import

* updating yml file

* inserting `quimb` package in requirements-dev

* strange error with `quimb`

* strange error with `quimb`

* specifying scipy version

* removing installation of scipy from yml file

* removing the new `yml` file

* testing if tests are tested

* Covering all lines in tests

* forgot final line for formatter

* Python formatter on CI complaints

* covering missing lines

* formatter on CI complaints

* Trying not to skip test if Cpp is enabled

* skipping tests if Cpp is enabled

* removing the only line not covered by tests so far

* Auto update version

* Applying suggestions from code review and making the `state` attribute private (new API design)

* Python formatter

* removing params from `QuimbMPS`

* Auto update version

* removing `**kwargs` from `QuimbMPS`

* removing unnecessary param at this stage

* covering test line

* formatter...

* removing param description

* Making `pylint` happy

* forgot new arg in test

* Updating base class and `preprocess` function

* Updating `LightningTensor` class with new names from more advanced PR

* Auto update version

* Auto update version

* Triggering CI

* Auto update version

* Trying to remove pin from `quimb` in `requirements.dev`

* Auto update version

* Auto update version

* Removing infos on derivatives and using config options to pass parameters to interface

* Usual `pylint` failures

* Trying to solve formatting errors

* typo in docstring

* Sunday update: improved docstrings and structure

* Removing method that was supposed to be in next PR

* removing old TODO comment

* Removing changes from the `setup.py` file

* restoring previous format to `setup.py`

* Auto update version from '0.36.0-dev34' to '0.36.0-dev41'

* Auto update version from '0.36.0-dev40' to '0.36.0-dev41'

* Removing kwargs as suggested from code review

* Addressing comments from CR

* Skipping tests if CPP binary is available

* Auto update version from '0.36.0-dev42' to '0.36.0-dev43'

* Auto update version from '0.36.0-dev43' to '0.36.0-dev44'

* Restoring name in changelog (?)

* Increasing time limit for Python tests

* Applying suggestions from code review

---------

Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ringo-but-quantum <[email protected]>

* Increase tolerance for a flaky test (test_single_return_value) (#703)

* update dev version

* increase tolerance

* update changelog

* trigger CIs

* Auto update version from '0.36.0-dev44' to '0.36.0-dev45'

---------

Co-authored-by: ringo-but-quantum <[email protected]>

* Auto update version from '0.36.0-dev45' to '0.36.0-dev46'

* Remove LTensor stuff

* Update changelog

* Revert requirements-dev.txt

* trigger ci

* Update python_lightning_kokkos_test_durations

* Restore 'all' tests in tests_lkcuda_python.yml

* Fix durations paths.

* Try --splitting-algorithm=least_duration

* Try no -n auto lkcpu tests

* One last test.

---------

Co-authored-by: Rashid N H M <[email protected]>
Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: Pietropaolo Frisoni <[email protected]>
Co-authored-by: Amintor Dusko <[email protected]>

* Update changelog (#706)

* Use wire order specified on instantiation (#705)

* use map wires instead of map_to_standard_wires

* oops

* Update .github/CHANGELOG.md

* black

* Trigger CIs

* add test

* black on tests

* Update .github/CHANGELOG.md

---------

Co-authored-by: AmintorDusko <[email protected]>
Co-authored-by: Ali Asadi <[email protected]>

* Update wire order support for probabilities (#707)

* Begin expansion of probs tests

* Update tests to exhaustively compute probs with wires

* Update all tests in LQ Meas to use CHECK instead of REQUIRES for better signal of failures

* Add Jet Permuter

* Add noisy functionality

* Fix permutation ordering

* Update changelog

* Fix wrong ordering in probs tests

* Add recommendation from apache flink to purge azure dirs

* Forbid out of order indices for probs with LK and LG in CPP layer

* Remove MSFT tools from GH Actions

* Just try to remove dotnet

* List opt hostedtoolcache

* Remove packages from /opt/hostedtoolcache

* Fix missing test hit

* Forbid and remove broken tests from LK probs ordering

* Fix clang-tidy isms

* Ensure libopenblas is not broken from failed apt pull with dev

* Appease GH Action

* Full remove GH action modifier step due to unexplained failures

* Add bidreictional wire validation for LGPU CPP layer

* Clang-tidy warning fix

* Appease CT

* Update JET license agreement

* Sync version

* pacify CodeFactor

* make CodeFactor ignore all JET code

* trigger ci

* trigger ci

* build wheels for test

* remove Win LKokkos upload-pypi [skip-ci]

* [skip ci]

* trigger wheels CIs with Release event

* update version

* fix upload wheels artifact for release

* target pennylane master

* Version bump CHANGELOG

* Auto update version from '' to '0.36.0-dev48'

* version bump to dev0

* Auto update version from '0.37.0-dev0' to '0.36.0-dev48'

* Update version

* Auto update version from '0.37.0-dev0' to '0.36.0-dev48'

* Update pennylane_lightning/core/_version.py

* update changelog

* Update .github/workflows/wheel_linux_aarch64.yml

* Update .github/workflows/wheel_linux_ppc64le.yml

---------

Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ali Asadi <[email protected]>
Co-authored-by: Raul Torres <[email protected]>
Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: Vincent Michaud-Rioux <[email protected]>
Co-authored-by: Rashid N H M <[email protected]>
Co-authored-by: Pietropaolo Frisoni <[email protected]>
Co-authored-by: Christina Lee <[email protected]>
Co-authored-by: Lee James O'Riordan <[email protected]>
Co-authored-by: Vincent Michaud-Rioux <[email protected]>

* change filename

* make format

* Auto update version from '0.37.0-dev2' to '0.37.0-dev3'

* change path name

* Accelerate CI parallelizing over OMP configs (#712)

* Update Changelog

* update release candidate version

* run agains pennylane rc

* update relese cadidate version

* Increase tolerance for a flaky test (test_single_return_value)

* Update `LightningBaseFallBack` to raise an error instead of falling back to default.qubit (#689)

* Initial commit.

* Update changelog

* Auto update version

* trigger ci

* Unused import.

* Auto update version

* trigger ci

* Fix imports.

* Auto update version

* Fix LightningException

* make format

* Auto update version from '0.36.0-dev34' to '0.36.0-dev35'

* Auto update version from '0.36.0-dev35' to '0.36.0-dev36'

* Auto update version from '0.36.0-dev36' to '0.36.0-dev37'

* Make python -m pip install consistent.

* Fix ImportError

* Auto update version from '0.36.0-dev37' to '0.36.0-dev38'

* --force-reinstall

* Auto update version from '0.36.0-dev38' to '0.36.0-dev39'

* Remove --force-reinstall

* Auto update version from '0.36.0-dev39' to '0.36.0-dev40'

* Auto update version from '0.36.0-dev42' to '0.36.0-dev43'

* Auto update version from '0.36.0-dev43' to '0.36.0-dev44'

* Spec CMAKE_CXX_COMPILER

* Fix quotes.

* Remove quotes

* Hardcode g++-11

* use env.COMPILER

* which g++

* Revert

* Downgrade pip

* Pin libomp.

* Revert wheel_linux

* Upload artifacts.

* Comment upload trigger

* Install pip==23

* Revert libomp

* try testing outside cibuildwheel

* yum install devtools

* yum install devtools

* Do not install python

* Revert changes

* Don't editable install.

* Not edit install

* Not edit install

* Fix cov path

* Explicit mcm tests path

* Fix qml.QuantumFunctionError error messages.

---------

Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: AmintorDusko <[email protected]>

* trigger CIs

* Introduce pytest-splits (#696)

* Try update lightning CI paths

* Auto update version

* Update kokkos tests to trigger on changes to pl core

* Auto update version

* Split tests_linux.yml into cpp/python.

* Auto update version from '0.36.0-dev36' to '0.36.0-dev38'

* Split GPU tests into cpp/python.

* Split MPI-GPU tests into cpp/python.

* Fix LGPU triggers.

* Remove python tests from LGPU-C++.

* Remove upload-to-codecov-linux-cpp from LGPUMPI tests.

* Rename test workflows.

* Update changelog.

* Change group names.

* Use paths-ignore to simplify workflow paths

* Auto update version from '0.36.0-dev38' to '0.36.0-dev39'

* Fix test names.

* you may only define one of `paths` and `paths-ignore` for a single event

* Fix formatting

* Auto update version from '0.36.0-dev39' to '0.36.0-dev40'

* Change to paths-ignore in no-bin tests.

* Auto update version from '0.36.0-dev40' to '0.36.0-dev41'

* trigger ci

* Change error message.

* Split build/test jobs.

* Revert pennylane_lightning/lightning_kokkos/lightning_kokkos.py

* Fix setup.py command

* Comment workflows

* Comment pull_request:

* Copy wheels to github.workspace /wheels

* SKIP_COMPILATION=True

* Revert SKIP_COMPILATION=True

* Remove duplicate python actions.

* Split LQ-test into 5 groups.

* Update requirements-dev.txt

* 2 groups

* 1 group

* 7 groups

* Refactor LKokos tests

* Auto update version from '0.36.0-dev42' to '0.36.0-dev43'

* Fix cache id

* Fix needs

* Remove all builds

* put back CMAKE_PREFIX_PATH

* install fake lightning

* Fix compat paths

* Auto update version from '0.36.0-dev42' to '0.36.0-dev43'

* Revert changes.

* Update changelog

* trigger ci

* build_and_cache_Kokkos_linux.yml not concurrent.

* Remove C++ tests from compat tests (skipped anyways).

* Use ${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} for concurrency groups.

* PL_BACKEND: ${{ matrix.pl_backend }}

* Update changelog

* Install wheel package.

* Auto update version from '0.36.0-dev43' to '0.36.0-dev44'

* Install scipy wheel in one place.

* Comment job triggers.

* Add LK[cpu] est durations.

* trigger ci

* Use sha independent keys.

* trigger ci

* build_and_cache_Kokkos

* Change LK keys

* ls -l

* Install version nonce

* Do not skip comp.

* Trade ref for sha in key

* Install after PL

* ref ==> sha

* Reorder

* Try LQ workflows.

* Use actions/setup-python

* Revert triggers.

* Provide correct cov path.

* Revert pennylane_lightning/core/src/utils/config.h

* LK uses 5 groups.

* Restore wheels to main

* main/wheels

* Revert cache paths

* Fix ls -l

* fail-on-cache-miss: true

* Introduce env.GITHUB_WORKSPACE

* Use artifacts

* Fix paths

* No ls -l

* Download to github.workspace

* fix wheel name

* WHEEL_NAME

* Add blas.

* Use outputs.

* Send wheel name

* Fix artifact name

* Fix name

* Use WHEEL_NAME var

* artifacts kokkos

* fix wheel name

* Restore bins.

* Clean up

* Split Linux CPU python tests into 2.

* Fix compat workflows.

* Split format and tidy workflows.

* fix lkcpu

* fix concurrency group

* Do not use editable installs.

* Split full kokkos tests except unitary_correct

* Upload LK test durations.

* duration-paths

* Unique test_durations

* Unique test_durations

* Unique test_durations

* Fix path

* Update python_lightning_kokkos_test_durations

* Remove obsolete all and SERIAL tests.

* Update changelog

* Creating the `LightningTensor` device class based on the new API (#671)

* empty commit (triggering CI)

* Auto update version

* Definition of the two front-end classes

* adding the `lightning_tensor` string to the supported backends in `setup.py`

* adding `__init__.py` file to directly import the `lightning_tensor` device class

* re-naming file

* Auto update version

* Creating the first prototype of initial MPS state tensor using `quimb`

* providing the `backend`, `method` parameters and making `wires` optional

* Changing names and structure

* Auto update version

* adding method required by the new device API design

* Auto update version

* using the `kwargs` parameter in `LightningTensor` and `CircuitMPS` in `quimb`

* taking some further inputs from the new device API

* Perhaps decided the overall structure of `LIghtningTensor`

* Auto update version

* adding docs to methods

* temporary changes so that `pylint` does not complain at this stage

* running `isort`

* re-running formatter after `isort`

* re-running formatter after `isort`

* Applying suggested formatting change from CI

* adding tmp unit tests

* Adding `quimb` in `requirements.txt`

* runing `isort` on mps test

* removing `quimb` from requirement and deleting unit tests for `lightning.tensor`

* Auto update version

* re-inserting unit tests with an additional `yml` file

* running isort on quimb test

* changing name of yml file

* preventing error in import

* updating yml file

* inserting `quimb` package in requirements-dev

* strange error with `quimb`

* strange error with `quimb`

* specifying scipy version

* removing installation of scipy from yml file

* removing the new `yml` file

* testing if tests are tested

* Covering all lines in tests

* forgot final line for formatter

* Python formatter on CI complaints

* covering missing lines

* formatter on CI complaints

* Trying not to skip test if Cpp is enabled

* skipping tests if Cpp is enabled

* removing the only line not covered by tests so far

* Auto update version

* Applying suggestions from code review and making the `state` attribute private (new API design)

* Python formatter

* removing params from `QuimbMPS`

* Auto update version

* removing `**kwargs` from `QuimbMPS`

* removing unnecessary param at this stage

* covering test line

* formatter...

* removing param description

* Making `pylint` happy

* forgot new arg in test

* Updating base class and `preprocess` function

* Updating `LightningTensor` class with new names from more advanced PR

* Auto update version

* Auto update version

* Triggering CI

* Auto update version

* Trying to remove pin from `quimb` in `requirements.dev`

* Auto update version

* Auto update version

* Removing infos on derivatives and using config options to pass parameters to interface

* Usual `pylint` failures

* Trying to solve formatting errors

* typo in docstring

* Sunday update: improved docstrings and structure

* Removing method that was supposed to be in next PR

* removing old TODO comment

* Removing changes from the `setup.py` file

* restoring previous format to `setup.py`

* Auto update version from '0.36.0-dev34' to '0.36.0-dev41'

* Auto update version from '0.36.0-dev40' to '0.36.0-dev41'

* Removing kwargs as suggested from code review

* Addressing comments from CR

* Skipping tests if CPP binary is available

* Auto update version from '0.36.0-dev42' to '0.36.0-dev43'

* Auto update version from '0.36.0-dev43' to '0.36.0-dev44'

* Restoring name in changelog (?)

* Increasing time limit for Python tests

* Applying suggestions from code review

---------

Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ringo-but-quantum <[email protected]>

* Increase tolerance for a flaky test (test_single_return_value) (#703)

* update dev version

* increase tolerance

* update changelog

* trigger CIs

* Auto update version from '0.36.0-dev44' to '0.36.0-dev45'

---------

Co-authored-by: ringo-but-quantum <[email protected]>

* Auto update version from '0.36.0-dev45' to '0.36.0-dev46'

* Remove LTensor stuff

* Update changelog

* Revert requirements-dev.txt

* trigger ci

* Update python_lightning_kokkos_test_durations

* Restore 'all' tests in tests_lkcuda_python.yml

* Fix durations paths.

* Try --splitting-algorithm=least_duration

* Try no -n auto lkcpu tests

* One last test.

---------

Co-authored-by: Rashid N H M <[email protected]>
Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: Pietropaolo Frisoni <[email protected]>
Co-authored-by: Amintor Dusko <[email protected]>

* Update changelog (#706)

* Use wire order specified on instantiation (#705)

* use map wires instead of map_to_standard_wires

* oops

* Update .github/CHANGELOG.md

* black

* Trigger CIs

* add test

* black on tests

* Update .github/CHANGELOG.md

---------

Co-authored-by: AmintorDusko <[email protected]>
Co-authored-by: Ali Asadi <[email protected]>

* Update wire order support for probabilities (#707)

* Begin expansion of probs tests

* Update tests to exhaustively compute probs with wires

* Update all tests in LQ Meas to use CHECK instead of REQUIRES for better signal of failures

* Add Jet Permuter

* Add noisy functionality

* Fix permutation ordering

* Update changelog

* Fix wrong ordering in probs tests

* Add recommendation from apache flink to purge azure dirs

* Forbid out of order indices for probs with LK and LG in CPP layer

* Remove MSFT tools from GH Actions

* Just try to remove dotnet

* List opt hostedtoolcache

* Remove packages from /opt/hostedtoolcache

* Fix missing test hit

* Forbid and remove broken tests from LK probs ordering

* Fix clang-tidy isms

* Ensure libopenblas is not broken from failed apt pull with dev

* Appease GH Action

* Full remove GH action modifier step due to unexplained failures

* Add bidreictional wire validation for LGPU CPP layer

* Clang-tidy warning fix

* Appease CT

* Update JET license agreement

* Sync version

* pacify CodeFactor

* make CodeFactor ignore all JET code

* trigger ci

* trigger ci

* Split OMP builds using matrix.

* trigger ci

* Ignore .github but not self.

* Fix cd..

* Fix path

* Update changelog [skip ci]

* Revert changes to reqs.txt

* Auto update version from '0.37.0-dev0' to '0.37.0-dev2'

* Auto update version from '0.37.0-dev1' to '0.37.0-dev2'

* Update .github/CHANGELOG.md

Co-authored-by: Amintor Dusko <[email protected]>

* Update .github/CHANGELOG.md

Co-authored-by: Ali Asadi <[email protected]>

---------

Co-authored-by: AmintorDusko <[email protected]>
Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: Rashid N H M <[email protected]>
Co-authored-by: Pietropaolo Frisoni <[email protected]>
Co-authored-by: Amintor Dusko <[email protected]>
Co-authored-by: Ali Asadi <[email protected]>
Co-authored-by: Christina Lee <[email protected]>
Co-authored-by: Lee James O'Riordan <[email protected]>

* add changelog

* Auto update version from '0.37.0-dev3' to '0.37.0-dev4'

* fix multiple reset()/setbasisstate() & resolve comments

* add blank lines to the end of each file

* Auto update version from '0.37.0-dev8' to '0.37.0-dev9'

* Auto update version from '0.37.0-dev9' to '0.37.0-dev10'

---------

Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: Rashid N H M <[email protected]>
Co-authored-by: Vincent Michaud-Rioux <[email protected]>
Co-authored-by: Amintor Dusko <[email protected]>
Co-authored-by: Ali Asadi <[email protected]>
Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pietropaolo Frisoni <[email protected]>
Co-authored-by: Christina Lee <[email protected]>
Co-authored-by: Lee James O'Riordan <[email protected]>
Co-authored-by: Vincent Michaud-Rioux <[email protected]>
Co-authored-by: Raul Torres <[email protected]>
Co-authored-by: AmintorDusko <[email protected]>
  • Loading branch information
13 people authored May 14, 2024
1 parent 29fa26c commit 10b58bd
Show file tree
Hide file tree
Showing 37 changed files with 1,878 additions and 8 deletions.
8 changes: 7 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### New features since last release

* Add `cutensornet` backed `MPS` C++ layer to `lightning.tensor`.
[(#704)](https://github.com/PennyLaneAI/pennylane-lightning/pull/704)

### Breaking changes

* `dynamic_one_shot` uses shot-vectors in the auxiliary tape to tell the device how many times to repeat the tape. Lightning-Qubit is updated accordingly.
Expand Down Expand Up @@ -38,14 +41,17 @@

This release contains contributions from (in alphabetical order):

Ali Asadi, Amintor Dusko, Pietropaolo Frisoni, Vincent Michaud-Rioux, Mudit Pandey
Ali Asadi, Amintor Dusko, Pietropaolo Frisoni, Vincent Michaud-Rioux, Mudit Pandey, Shuli Shu

---

# Release 0.36.0

### New features since last release

* Add `cutensornet` backed `MPS` C++ layer to `lightning.tensor`.
[(#704)](https://github.com/PennyLaneAI/pennylane-lightning/pull/704)

* Add Python class for the `lightning.tensor` device which uses the new device API and the interface for `quimb` based on the MPS method.
[(#671)](https://github.com/PennyLaneAI/pennylane-lightning/pull/671)

Expand Down
195 changes: 195 additions & 0 deletions .github/workflows/tests_lmps_tncuda_cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
name: Testing::Linux::x86_64::MPSTNCuda::C++
# TODO remove MPS from the workflow name and the workflow filename once exact is in.
# TODO remove the `PL_TENSOR_METHOD` option once exact TN is added.
# TODO remove the `pl_tensor_method` once exact TN is added.
on:
workflow_call:
inputs:
lightning-version:
type: string
required: true
description: The version of Lightning to use. Valid values are either 'release' (most recent release candidate), 'stable' (most recent git-tag) or 'latest' (most recent commit from master)
pennylane-version:
type: string
required: true
description: The version of PennyLane to use. Valid values are either 'release' (most recent release candidate), 'stable' (most recent git-tag) or 'latest' (most recent commit from master)
release:
pull_request:
paths:
- .github/workflows/tests_lmps_tncuda_cpp.yml
- pennylane_lightning/core/src/**
- '!pennylane_lightning/core/src/simulators/lightning_kokkos/**'
- '!pennylane_lightning/core/src/simulators/lightning_qubit/**'
- '!pennylane_lightning/core/src/simulators/lightning_gpu/**'
push:
branches:
- master

env:
CI_CUDA_ARCH: 86
COVERAGE_FLAGS: "--cov=pennylane_lightning --cov-report=term-missing --cov-report=xml:./coverage.xml --no-flaky-report -p no:warnings --tb=native"
GCC_VERSION: 11

concurrency:
group: tests_lmps_tncuda_cpp-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }}
cancel-in-progress: true

jobs:
builddeps:
runs-on:
- self-hosted
- ubuntu-22.04
- gpu

strategy:
max-parallel: 1
matrix:
os: [ubuntu-22.04]
pl_backend: ["lightning_tensor"]
cuda_version: ["12"]

steps:
- name: Validate GPU version and installed compiler
run: |
source /etc/profile.d/modules.sh
module use /opt/modules
module load cuda/${{ matrix.cuda_version }}
echo "${PATH}" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
nvcc --version
nvidia-smi
cpptestswithMPSTNCuda:
if: ${{ !contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
needs: [builddeps]
strategy:
matrix:
os: [ubuntu-22.04]
pl_backend: ["lightning_tensor"]
pl_tensor_method: ["mps"]
pl_tensor_backend: ["cutensornet"]
cuda_version: ["12"]

name: C++ Tests (${{ matrix.pl_backend }}, method-${{ matrix.pl_tensor_method }}, backend-${{ matrix.pl_tensor_backend }}, cuda-${{ matrix.cuda_version }})
runs-on:
- ${{ matrix.os }}
- self-hosted
- gpu

steps:
- name: Validate GPU version and installed compiler
run: |
source /etc/profile.d/modules.sh
module use /opt/modules
module load cuda/${{ matrix.cuda_version }}
echo "${PATH}" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
nvcc --version
nvidia-smi
- name: Checkout PennyLane-Lightning-Tensor-MPS-TNCuda
uses: actions/checkout@v4
with:
path: main

- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.9'

# Since the self-hosted runner can be re-used. It is best to set up all package
# installations in a virtual environment that gets cleaned at the end of each workflow run
- name: Setup Python virtual environment
id: setup_venv
env:
VENV_NAME: ${{ github.workspace }}/venv_${{ steps.setup_python.outputs.python-version }}_${{ github.sha }}
run: |
# Clear any pre-existing venvs
rm -rf venv_*
# Create new venv for this workflow_run
python --version
python -m venv ${{ env.VENV_NAME }}
# Add the venv to PATH for subsequent steps
echo ${{ env.VENV_NAME }}/bin >> $GITHUB_PATH
# Adding venv name as an output for subsequent steps to reference if needed
echo "venv_name=${{ env.VENV_NAME }}" >> $GITHUB_OUTPUT
- name: Display Python-Path
id: python_path
run: |
py_path=$(which python)
echo "Python Interpreter Path => $py_path"
echo "python=$py_path" >> $GITHUB_OUTPUT
pip_path=$(which python)
echo "PIP Path => $pip_path"
echo "pip=$pip_path" >> $GITHUB_OUTPUT
- name: Install required packages
run: |
python -m pip install ninja cmake scipy custatevec-cu${{ matrix.cuda_version }} cutensornet-cu${{ matrix.cuda_version }}
- name: Build and run unit tests
run: |
set -x
cd main
cmake . -BBuild \
-DCUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')")\
-DBUILD_TESTS=ON \
-DENABLE_PYTHON=OFF \
-DPL_BACKEND=${{ matrix.pl_backend }} \
-DPL_TENSOR_METHOD=${{ matrix.pl_tensor_method }} \
-DPL_TENSOR_BACKEND=${{ matrix.pl_tensor_backend }} \
-DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION) \
-DENABLE_COVERAGE=ON \
-G Ninja
cmake --build ./Build
cd ./Build
mkdir -p ./tests/results_${{ github.job }}_${{ matrix.pl_backend }}
for file in *runner ; do ./$file --order lex --reporter junit --out ./tests/results_${{ github.job }}_${{ matrix.pl_backend }}/report_$file.xml; done;
lcov --directory . -b ../pennylane_lightning/core/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
mv coverage.info coverage-${{ github.job }}-${{ matrix.pl_backend }}.info
set +x
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: ubuntu-tests-reports-${{ github.job }}_${{ matrix.pl_backend }}
path: ./main/Build/tests/results_${{ github.job }}_${{ matrix.pl_backend }}
if-no-files-found: error

- name: Upload code coverage results
uses: actions/upload-artifact@v3
with:
name: ubuntu-codecov-results-cpp
path: ./main/Build/coverage-${{ github.job }}-${{ matrix.pl_backend }}.info
if-no-files-found: error


upload-to-codecov-linux-cpp:
needs: [cpptestswithMPSTNCuda]
name: Upload coverage data to codecov
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download coverage reports
uses: actions/download-artifact@v3
with:
name: ubuntu-codecov-results-cpp

- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Cleanup
if: always()
run: |
rm -rf ${{ steps.setup_venv.outputs.venv_name }}
rm -rf * .git .gitignore .github
pip cache purge
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ endif()
# Print PL_BACKEND
foreach(BACKEND ${PL_BACKEND})
message(STATUS "PL_BACKEND: ${BACKEND}")
if("${BACKEND}" STREQUAL "lightning_tensor")
set(PL_TENSOR_METHOD "mps" CACHE STRING "PennyLane LightningTensor MPS simulator.")
set(PL_TENSOR_BACKEND "cutensornet" CACHE STRING "PennyLane LightningTensor backed by cutensornet")
set(PL_TENSOR "${PL_BACKEND}_${PL_TENSOR_METHOD}_${PL_TENSOR_BACKEND}")
endif()
endforeach()

# Process compile options
Expand Down
54 changes: 54 additions & 0 deletions cmake/support_pltensortncuda.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
###############################################################################################
# This file provides macros to process cuTensorNet external libraries.
###############################################################################################

# Include this only once
include_guard()

# Macro to aid in finding cuTensorNet lib
macro(findCutensornet external_libs)
find_library(CUTENSORNET_LIB
NAMES libcutensornet.so.2 libcutensornet.so
HINTS /usr/lib
/usr/local/cuda
/usr/local/lib
/opt
/opt/cuda
lib
lib64
${CUQUANTUM_SDK}/lib
${CUQUANTUM_SDK}/lib64
${CUDAToolkit_LIBRARY_DIR}
${CUDA_TOOLKIT_ROOT_DIR}/lib
${CUDA_TOOLKIT_ROOT_DIR}/lib64
${Python_SITELIB}/cuquantum/lib
ENV LD_LIBRARY_PATH
)

find_file( CUTENSORNET_INC
NAMES cutensornet.h
HINTS /usr/include
/usr/local/cuda
/usr/local/include
/opt
/opt/cuda
include
${CUQUANTUM_SDK}/include
${CUDAToolkit_INCLUDE_DIRS}
${CUDA_TOOLKIT_ROOT_DIR}/include
${Python_SITELIB}/cuquantum/include
ENV CPATH
)

if(NOT CUTENSORNET_LIB OR NOT CUTENSORNET_INC)
message(FATAL_ERROR "\nUnable to find cuQuantum SDK installation. Please ensure it is correctly installed and available on path.")
else()
add_library(cutensornet SHARED IMPORTED GLOBAL)

get_filename_component(CUTENSORNET_INC_DIR ${CUTENSORNET_INC} DIRECTORY)
target_include_directories(cutensornet INTERFACE ${CUTENSORNET_INC_DIR})
set_target_properties(cutensornet PROPERTIES IMPORTED_LOCATION ${CUTENSORNET_LIB})

target_link_libraries(${external_libs} INTERFACE cutensornet)
endif()
endmacro()
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.37.0-dev9"
__version__ = "0.37.0-dev10"
12 changes: 9 additions & 3 deletions pennylane_lightning/core/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ set(COMPONENT_SUBDIRS algorithms
simulators
utils
)
foreach(COMP ${COMPONENT_SUBDIRS})
add_subdirectory(${COMP})
endforeach()

if("${PL_BACKEND}" STREQUAL "lightning_tensor")
add_subdirectory(simulators)
add_subdirectory(utils)
else()
foreach(COMP ${COMPONENT_SUBDIRS})
add_subdirectory(${COMP})
endforeach()
endif()

if (BUILD_TESTS)
# Include macros supporting tests.
Expand Down
5 changes: 3 additions & 2 deletions pennylane_lightning/core/src/simulators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ cmake_minimum_required(VERSION 3.20)

project(lightning_simulators LANGUAGES CXX)

add_subdirectory(base)

if(NOT "${PL_BACKEND}" STREQUAL "lightning_tensor")
add_subdirectory(base)
endif()
###############################################################################
# Determine simulator and include its directory
###############################################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.20)

project(lightning_tensor LANGUAGES CXX)

###############################################################################
# Include all nested sources directories
###############################################################################
set(COMPONENT_SUBDIRS utils
tensor)

if("${PL_TENSOR_BACKEND}" STREQUAL "cutensornet")
list(APPEND COMPONENT_SUBDIRS tncuda)
else()
message(FATAL_ERROR "Lightning Tensor currently doesn't support ${PL_TENSOR_BACKEND} method")
endif()

foreach(COMP ${COMPONENT_SUBDIRS})
add_subdirectory(${COMP})
endforeach()
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.20)
project(${PL_BACKEND}_tensor LANGUAGES CXX)

add_library(${PL_BACKEND}_tensor INTERFACE)

add_subdirectory(base)

set(TNCUDA_UTILS_ADDED FALSE CACHE BOOL "Add tncuda_utils header files")

if("${PL_TENSOR_BACKEND}" STREQUAL "cutensornet" AND NOT TNCUDA_UTILS_ADDED)
add_subdirectory(tncuda)
target_include_directories(${PL_BACKEND}_tensor INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/tncuda)
target_link_libraries(${PL_BACKEND}_tensor INTERFACE tensor_cuda)
set(CUDA_UTILS_ADDED TRUE)
endif()

target_include_directories(${PL_BACKEND}_tensor INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/base)
target_link_libraries(${PL_BACKEND}_tensor INTERFACE tensorBase lightning_utils lightning_compile_options lightning_external_libs)

set_property(TARGET ${PL_BACKEND}_tensor PROPERTY POSITION_INDEPENDENT_CODE ON)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.20)
project(tensorBase LANGUAGES CXX)

add_library(tensorBase INTERFACE)


target_include_directories(tensorBase INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(tensorBase INTERFACE lightning_utils lightning_compile_options lightning_external_libs)

set_property(TARGET tensorBase PROPERTY POSITION_INDEPENDENT_CODE ON)
Loading

0 comments on commit 10b58bd

Please sign in to comment.