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

Add pybind11 and Python layers to lightning.tensor #748

Merged
merged 414 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
414 commits
Select commit Hold shift + click to select a range
422d6df
Auto update version from '0.37.0-dev16' to '0.37.0-dev17'
ringo-but-quantum May 23, 2024
f616207
Merge branch 'add_LTensor_nonParam_gate' into add_obs_measurement_ltn
multiphaseCFD May 23, 2024
b466d2b
explicitly instantiation obs class
multiphaseCFD May 23, 2024
f1fc0e5
update base on PR#739
multiphaseCFD May 23, 2024
506d8c6
init commit
multiphaseCFD May 23, 2024
24aae1e
Merge branch 'master' into add_LTensor_nonParam_gate
maliasadi May 23, 2024
99ec44e
Auto update version from '0.37.0-dev17' to '0.37.0-dev18'
ringo-but-quantum May 23, 2024
b5fa077
add docstring for DynamicGateDataAccess
multiphaseCFD May 23, 2024
072062e
move expval to the measurment class
multiphaseCFD May 23, 2024
9b37210
remove expval from tncudabase
multiphaseCFD May 23, 2024
2b082a6
further tidy up code
multiphaseCFD May 24, 2024
2451c67
more refinement
multiphaseCFD May 24, 2024
1bcc25c
turn on gpu related tests
multiphaseCFD May 24, 2024
608b294
Merge branch 'master' into add_LTensor_nonParam_gate
multiphaseCFD May 24, 2024
b8ff166
Auto update version from '0.37.0-dev18' to '0.37.0-dev19'
ringo-but-quantum May 24, 2024
511bd1f
store obs devcie data with hashtable
multiphaseCFD May 27, 2024
5a21a0b
this-> to basetype::
multiphaseCFD May 27, 2024
8454b37
tidy up code
multiphaseCFD May 27, 2024
20effcd
Merge branch 'master' into add_LTensor_nonParam_gate
multiphaseCFD May 27, 2024
f28aa0c
update docstring
multiphaseCFD May 27, 2024
8190130
Auto update version from '0.37.0-dev19' to '0.37.0-dev20'
ringo-but-quantum May 27, 2024
1cfcbcb
Merge branch 'add_LTensor_nonParam_gate' into add_obs_measurement_ltn
multiphaseCFD May 27, 2024
3071629
make format
multiphaseCFD May 27, 2024
8319f85
update obs class & its unit tests
multiphaseCFD May 28, 2024
3834a36
add pauliz obs for measurement
multiphaseCFD May 28, 2024
44fb119
further tidy up code
multiphaseCFD May 28, 2024
fd63a74
Merge master
multiphaseCFD May 28, 2024
ac4f07c
Auto update version from '0.37.0-dev20' to '0.37.0-dev21'
ringo-but-quantum May 28, 2024
a3cf7c6
add changelog
multiphaseCFD May 28, 2024
63d1368
tidy up code and add more unit tests
multiphaseCFD May 28, 2024
1f24dae
remove nested H creation support
multiphaseCFD May 28, 2024
f5600eb
getCoeffsPerTerm -> getCoeffs
multiphaseCFD May 28, 2024
3adc314
add more docstring
multiphaseCFD May 28, 2024
3e38196
further tidy up code
multiphaseCFD May 28, 2024
1e3bef0
resolve comments & tidy up code
multiphaseCFD May 28, 2024
c556c96
update cuda_helpera
multiphaseCFD May 28, 2024
381dc51
add more unit tests
multiphaseCFD May 29, 2024
f57d622
fix for getTensorsOutDataPtr
multiphaseCFD May 29, 2024
701884b
Merge branch 'add_obs_measurement_ltn' into add_pybind11_cutensornet
multiphaseCFD May 29, 2024
6ac974b
update naming and docstring
multiphaseCFD May 29, 2024
1f27bd6
update hash_val calculation
multiphaseCFD May 29, 2024
1952bae
remove bindings from lightning_tensor
multiphaseCFD May 29, 2024
870e583
Init commit
multiphaseCFD May 30, 2024
b938dc6
Auto update version from '0.37.0-dev21' to '0.37.0-dev23'
ringo-but-quantum May 30, 2024
44bc048
add unit tests for python layer
multiphaseCFD May 30, 2024
b51b6d0
Merge branch 'master' into add_pybind11_cutensornet
multiphaseCFD May 30, 2024
b6b4fce
Auto update version from '0.37.0-dev23' to '0.37.0-dev24'
ringo-but-quantum May 30, 2024
176ecea
update conftest.py
multiphaseCFD May 30, 2024
577250a
udpate GA workflow
multiphaseCFD May 30, 2024
d090452
quick fix
multiphaseCFD May 30, 2024
6bc273e
add `BasisState` support
multiphaseCFD May 30, 2024
2e36936
pylint python files
multiphaseCFD May 30, 2024
94580b9
update workflow
multiphaseCFD May 30, 2024
ad857d5
ignore tests/lightning_tensor
multiphaseCFD May 31, 2024
b77a10e
nake format
multiphaseCFD May 31, 2024
acd379b
suppress pylint complains
multiphaseCFD May 31, 2024
0dd8149
update lkcpu_python
multiphaseCFD May 31, 2024
390f415
revert changes in lkcpu_python
multiphaseCFD May 31, 2024
1d45349
ignore tests/lightning_tensor/ lkcpu
multiphaseCFD May 31, 2024
d9ae0f7
revert changes in PR#719
multiphaseCFD May 31, 2024
7498e0a
fix tncuda_python workflow
multiphaseCFD May 31, 2024
f73318a
Merge branch 'master' into add_obs_measurement_ltn
multiphaseCFD May 31, 2024
4d77a9c
resolve some comments
multiphaseCFD May 31, 2024
8ab0b41
Auto update version from '0.37.0-dev23' to '0.37.0-dev24'
ringo-but-quantum May 31, 2024
67a4fcb
as users to set `numHyperSamples` when calculate expval
multiphaseCFD May 31, 2024
e09cfa5
add more unit tests
multiphaseCFD May 31, 2024
4347a9d
add more docstrings
multiphaseCFD May 31, 2024
e2ddf73
make format
multiphaseCFD May 31, 2024
c0dc0f3
update docstring and resolve comments
multiphaseCFD Jun 3, 2024
f5ba974
Merge branch 'master' into add_obs_measurement_ltn
multiphaseCFD Jun 3, 2024
ece7935
Auto update version from '0.37.0-dev24' to '0.37.0-dev25'
ringo-but-quantum Jun 3, 2024
8140db1
update docsitng tensorprod obs
multiphaseCFD Jun 3, 2024
045e27c
add error raise for 2+ wires gates for mps backend
multiphaseCFD Jun 3, 2024
6b059b5
add stopping condition for mps and remove broadcast support
multiphaseCFD Jun 3, 2024
f2ea9d4
update changes in PR#750
multiphaseCFD Jun 3, 2024
9e41608
Merge branch 'add_obs_measurement_ltn' into add_pybind11_cutensornet
multiphaseCFD Jun 3, 2024
58433df
update class name Measurements -> MeasurementsTNCuda
multiphaseCFD Jun 3, 2024
b658f9f
Merge branch 'master' into add_obs_measurement_ltn
multiphaseCFD Jun 3, 2024
ed06913
add more python tests
multiphaseCFD Jun 3, 2024
33603ce
more unit tests
multiphaseCFD Jun 3, 2024
c7564ee
Auto update version from '0.37.0-dev25' to '0.37.0-dev27'
ringo-but-quantum Jun 3, 2024
da9851c
Merge branch 'add_obs_measurement_ltn' into add_pybind11_cutensornet
multiphaseCFD Jun 3, 2024
1a0817b
Merge branch 'master' into add_pybind11_cutensornet
multiphaseCFD Jun 3, 2024
6c11931
Auto update version from '0.37.0-dev26' to '0.37.0-dev27'
ringo-but-quantum Jun 3, 2024
96e3547
resolve CF complains
multiphaseCFD Jun 3, 2024
1a8acf8
more py unit tests
multiphaseCFD Jun 4, 2024
182402d
add more unit tests and remove adjoint support
multiphaseCFD Jun 4, 2024
1a2a99c
make format
multiphaseCFD Jun 4, 2024
de99035
remove adjoint ops support
multiphaseCFD Jun 4, 2024
0abbcdf
no binary tests for lightning_tensor
multiphaseCFD Jun 4, 2024
9cd6522
update test_lightning_tensor.py
multiphaseCFD Jun 4, 2024
4e116da
make format
multiphaseCFD Jun 4, 2024
39c3b38
quick fix
multiphaseCFD Jun 4, 2024
daaf1d8
add no binaries tests for lightning_tensor
multiphaseCFD Jun 4, 2024
bf74405
make format
multiphaseCFD Jun 4, 2024
3141e3e
add more unit tests
multiphaseCFD Jun 4, 2024
8ac5115
remove state_tensor property from measurement class
multiphaseCFD Jun 4, 2024
7b97638
add more unit tests for state tensor class and serialize
multiphaseCFD Jun 4, 2024
7b515aa
more unit tests
multiphaseCFD Jun 4, 2024
1b0efb5
make format
multiphaseCFD Jun 4, 2024
124e166
add tests no binaries LightningStateTensor
multiphaseCFD Jun 4, 2024
d5123d9
revert last commit
multiphaseCFD Jun 4, 2024
6d3db77
tidy up code
multiphaseCFD Jun 4, 2024
64744be
add tests for all supported gates/obs and remove unsupported ops from…
multiphaseCFD Jun 5, 2024
c8f428e
tidy up code
multiphaseCFD Jun 5, 2024
4576554
revert --ignore=tests/lightning_tensor/ in CI workflow
multiphaseCFD Jun 5, 2024
82886d2
revert --ignore=tests/lightning_tensor/ .github/workflows/tests_lqcpu…
multiphaseCFD Jun 5, 2024
d77ca82
Auto update version from '0.37.0-dev27' to '0.37.0-dev28'
ringo-but-quantum Jun 5, 2024
f2a29be
Update `LightningQubit` to adhere to MCM qnode arguments (#736)
mudit2812 Jun 5, 2024
43dc22f
Auto update version from '0.37.0-dev27' to '0.37.0-dev28'
ringo-but-quantum Jun 5, 2024
f29baab
Merge branch 'master' into add_pybind11_cutensornet
multiphaseCFD Jun 5, 2024
0b42569
Auto update version from '0.37.0-dev27' to '0.37.0-dev28'
ringo-but-quantum Jun 5, 2024
47b4142
update bindings
multiphaseCFD Jun 5, 2024
daba879
tidy up bindings
multiphaseCFD Jun 5, 2024
fa76fa2
update obs bindings
multiphaseCFD Jun 5, 2024
456425a
update bindings & update py unit tests
multiphaseCFD Jun 6, 2024
b26f8a7
test adjoint support
multiphaseCFD Jun 6, 2024
7672a35
remove tests for 3+
multiphaseCFD Jun 6, 2024
8fc30f6
add more unit tests for both c++ and python layer
multiphaseCFD Jun 6, 2024
db34bed
initial commit
multiphaseCFD Jun 6, 2024
ff1707d
Auto update version from '0.37.0-dev27' to '0.37.0-dev29'
ringo-but-quantum Jun 6, 2024
5245790
add inverse=true tests for nonParam gates
multiphaseCFD Jun 6, 2024
1d0ed1c
add unit tests for parametric gates
multiphaseCFD Jun 6, 2024
13a61de
tidy up code
multiphaseCFD Jun 6, 2024
3c1ea43
further tidy up code
multiphaseCFD Jun 6, 2024
2de6983
Merge branch 'master' into add_inverse_gate_support_ltensor
multiphaseCFD Jun 6, 2024
a4b7d04
Auto update version from '0.37.0-dev28' to '0.37.0-dev29'
ringo-but-quantum Jun 6, 2024
047278b
set state_tensor as const in MeasurementTNCuda
multiphaseCFD Jun 6, 2024
bd5f10e
add TODO for Exact TN
multiphaseCFD Jun 6, 2024
c5296ba
add changelog
multiphaseCFD Jun 6, 2024
06282d4
quick fix
multiphaseCFD Jun 6, 2024
c20bb15
resolve comments
multiphaseCFD Jun 6, 2024
3f30649
make format
multiphaseCFD Jun 6, 2024
08161c6
resolve more comments
multiphaseCFD Jun 6, 2024
4c13efb
Refactor C++ `libNames` for `Lightning.Tensor` (#755)
multiphaseCFD Jun 6, 2024
89c8423
make format
multiphaseCFD Jun 6, 2024
427f630
Merge branch 'add_inverse_gate_support_ltensor' into add_pybind11_cut…
multiphaseCFD Jun 6, 2024
184ea05
retention-days: 1
vincentmr Jun 6, 2024
fb67eb8
tidy up the code
multiphaseCFD Jun 6, 2024
316dd7c
resolve comments
multiphaseCFD Jun 6, 2024
ea09675
Merge branch 'add_inverse_gate_support_ltensor' into add_pybind11_cut…
multiphaseCFD Jun 6, 2024
45a751c
remove unused TODO
multiphaseCFD Jun 6, 2024
c39696d
Merge branch 'add_inverse_gate_support_ltensor' into add_pybind11_cut…
multiphaseCFD Jun 6, 2024
eafbca1
remove unused lib
multiphaseCFD Jun 6, 2024
9112cc1
revert changes to make it aligned with sv backends
multiphaseCFD Jun 6, 2024
8bd8fcc
Merge branch 'add_inverse_gate_support_ltensor' into add_pybind11_cut…
multiphaseCFD Jun 6, 2024
0afa20a
merge master
multiphaseCFD Jun 6, 2024
ab80c19
Auto update version from '0.37.0-dev29' to '0.37.0-dev30'
ringo-but-quantum Jun 6, 2024
624bb11
remove unused headers in bindings
multiphaseCFD Jun 6, 2024
e45022f
remove commented lines and make format
multiphaseCFD Jun 6, 2024
0fa8583
tidy up unit tests
multiphaseCFD Jun 6, 2024
dfa79ab
remove unnecessary obs public APIs to python layers
multiphaseCFD Jun 6, 2024
77c6efd
resolve more comments
multiphaseCFD Jun 7, 2024
89c593e
make format
multiphaseCFD Jun 7, 2024
170435e
lightningmeasurements->lightningtensormeasurements
multiphaseCFD Jun 7, 2024
cbccc7a
update bindings
multiphaseCFD Jun 7, 2024
5bfcb08
add tests to more gates
multiphaseCFD Jun 7, 2024
67c67e3
move most python unit tests to tests/ path
multiphaseCFD Jun 7, 2024
83339fc
update CI workflows
multiphaseCFD Jun 7, 2024
8bebcdc
Auto update version from '0.37.0-dev30' to '0.37.0-dev31'
ringo-but-quantum Jun 7, 2024
1533293
Merge branch 'master' into add_pybind11_cutensornet
multiphaseCFD Jun 7, 2024
2457024
Auto update version from '0.37.0-dev30' to '0.37.0-dev31'
ringo-but-quantum Jun 7, 2024
c710998
Fix the issue with initializing LK with zero-qubit and invalid number…
maliasadi Jun 7, 2024
42e2732
tidy up code
multiphaseCFD Jun 7, 2024
7fc6ead
Auto update version from '0.37.0-dev30' to '0.37.0-dev31'
ringo-but-quantum Jun 7, 2024
21fb68c
fix typo
multiphaseCFD Jun 7, 2024
9885d63
make format
multiphaseCFD Jun 7, 2024
5ddde94
add changelog
multiphaseCFD Jun 7, 2024
68dda84
quick fix
multiphaseCFD Jun 8, 2024
1c6acdc
revert changes in test_expval
multiphaseCFD Jun 8, 2024
4ba3344
Trigger CI
multiphaseCFD Jun 8, 2024
65e6d02
Trigger CI
multiphaseCFD Jun 8, 2024
d67f3f3
update requirements-dev
multiphaseCFD Jun 10, 2024
4907e44
Trigger CIs
multiphaseCFD Jun 10, 2024
85330ab
maxBondDim->max_bond_dim
multiphaseCFD Jun 10, 2024
f676f52
update docstring
multiphaseCFD Jun 10, 2024
0d75eb2
add cutoff and cutoff_mode options to the `lightning.tensor` device
multiphaseCFD Jun 10, 2024
b34b8cf
fix CF issues
multiphaseCFD Jun 10, 2024
3e833f6
resolve some comments
multiphaseCFD Jun 10, 2024
8150bad
Auto update version from '0.37.0-dev31' to '0.37.0-dev32'
ringo-but-quantum Jun 10, 2024
0cf9057
remove cuquantum_sdk env var from ci workflow
multiphaseCFD Jun 10, 2024
33a1c18
remove cuquantum_sdk from ci workflow
multiphaseCFD Jun 10, 2024
a447e43
Merge branch 'master' into add_pybind11_cutensornet
multiphaseCFD Jun 10, 2024
2e3adf9
Auto update version from '0.37.0-dev31' to '0.37.0-dev32'
ringo-but-quantum Jun 10, 2024
5e6ab75
resolve _serialize.py
multiphaseCFD Jun 10, 2024
095b605
tidy up code
multiphaseCFD Jun 10, 2024
525cc17
rename statetensorT as tensornetT
multiphaseCFD Jun 11, 2024
3ef1855
Further renaming state_tensor to tensor_net
multiphaseCFD Jun 11, 2024
c1c0048
statetensor->tensornet py frontend
multiphaseCFD Jun 11, 2024
cd8a48c
LightningStateTensor->LightningTensorNet
multiphaseCFD Jun 11, 2024
c1496c9
tensor_state -> tensornet in LightningTensorNet
multiphaseCFD Jun 11, 2024
fa13835
getFinalState->setMPSFinalState
multiphaseCFD Jun 11, 2024
0986e25
state->tensor network in py layer
multiphaseCFD Jun 11, 2024
59ca8a7
rename _state_tensor.py to _tensornet.py
multiphaseCFD Jun 11, 2024
cb08f9b
state_tensor -> tensornet in unit tests
multiphaseCFD Jun 11, 2024
ae9bec2
add docstring for max_bond_dim selection
multiphaseCFD Jun 11, 2024
6bb866b
resolve more comments
multiphaseCFD Jun 11, 2024
eae45b1
tidy up code and add more docstring
multiphaseCFD Jun 11, 2024
e77387a
Rename Statetensor to TensorNet (#759)
multiphaseCFD Jun 11, 2024
b06d363
Auto update version from '0.37.0-dev32' to '0.37.0-dev33'
ringo-but-quantum Jun 11, 2024
43b7306
Merge branch 'master' into add_pybind11_cutensornet
multiphaseCFD Jun 11, 2024
34c49d3
Auto update version from '0.37.0-dev32' to '0.37.0-dev33'
ringo-but-quantum Jun 11, 2024
f924367
update test_without_binary.yml
multiphaseCFD Jun 11, 2024
0ee8d1a
try to update tests_lmps_tncuda_python.yml
multiphaseCFD Jun 11, 2024
47060dc
update
multiphaseCFD Jun 11, 2024
9f3786a
tidy up workflow
multiphaseCFD Jun 11, 2024
820a7dc
test
multiphaseCFD Jun 11, 2024
2e8fe05
update changelog
multiphaseCFD Jun 11, 2024
b18152e
resolve stop conditions
multiphaseCFD Jun 11, 2024
5fc91f9
resolve more comments in py unit tests
multiphaseCFD Jun 11, 2024
6e49040
resolve more typos
multiphaseCFD Jun 11, 2024
7ef32e5
resolve more comments
multiphaseCFD Jun 11, 2024
1b9bdc3
remove rtol from hermitian tests
multiphaseCFD Jun 11, 2024
aae6f5b
make format
multiphaseCFD Jun 11, 2024
5893245
move BindingsLTensor.hpp to Bindings.hpp
multiphaseCFD Jun 11, 2024
fc53a39
add todo for bindingbase
multiphaseCFD Jun 11, 2024
322bd13
tidy up `append_mps_final_state`
multiphaseCFD Jun 11, 2024
10046b4
tidy up string
multiphaseCFD Jun 11, 2024
0114ebf
tidy up config.h
multiphaseCFD Jun 11, 2024
4b5a5ee
tidy up py tests
multiphaseCFD Jun 11, 2024
8c98f18
tidy up cpp unit tests
multiphaseCFD Jun 11, 2024
c738f8d
statetensor->tensornetwork in py layer
multiphaseCFD Jun 11, 2024
0f6da79
statetensor->tensornetwork in unit tests
multiphaseCFD Jun 11, 2024
fe26463
lightning_st -> lightning_tn in py unit tests
multiphaseCFD Jun 11, 2024
fd98e39
tidy up workflows
multiphaseCFD Jun 11, 2024
4714f42
tidy up CMakeList
multiphaseCFD Jun 11, 2024
44ddfd5
revert changes in ci workflow
multiphaseCFD Jun 11, 2024
d2b53de
setup venv mps ci workflow
multiphaseCFD Jun 11, 2024
20185ae
quick fix for ci
multiphaseCFD Jun 12, 2024
a742898
trigger all cis
multiphaseCFD Jun 12, 2024
3b0b1c0
add more unit tests for _serialize.py
multiphaseCFD Jun 12, 2024
2c2e883
revert changes in cis
multiphaseCFD Jun 12, 2024
abd99d4
add PIP Path to ci
multiphaseCFD Jun 12, 2024
7a5d845
quick fix
multiphaseCFD Jun 12, 2024
aef3a6f
fix codecov complains
multiphaseCFD Jun 12, 2024
9306c33
add more tests for _measurements.py
multiphaseCFD Jun 12, 2024
2e39a7a
remove shots from
multiphaseCFD Jun 12, 2024
477e52f
update naming
multiphaseCFD Jun 12, 2024
0b33aa9
revert changes in LTensorBindings
multiphaseCFD Jun 12, 2024
1478bbb
resolve some comments
multiphaseCFD Jun 12, 2024
5f5e159
update more
multiphaseCFD Jun 12, 2024
84c7e2f
remove self return
multiphaseCFD Jun 12, 2024
64eb0f8
resolve more comments
multiphaseCFD Jun 12, 2024
76ee6fc
test donot clear venv
multiphaseCFD Jun 12, 2024
5363844
revert changes
multiphaseCFD Jun 12, 2024
6ccdd0e
update kwargs
multiphaseCFD Jun 12, 2024
a7eed5c
update C++ layer
multiphaseCFD Jun 12, 2024
974e0cf
revert changes in lq
multiphaseCFD Jun 12, 2024
e628968
update arg name to align with default.tensor
multiphaseCFD Jun 12, 2024
fb5a663
fix typo
multiphaseCFD Jun 12, 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
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Release 0.37.0-dev

### New features since last release
* Implement Python interface to the `lightning.tensor` device.
[(#748)](https://github.com/PennyLaneAI/pennylane-lightning/pull/748)

* Add `inverse` support for gate operations in `lightning.tensor` in the C++ layer.
[(#753)](https://github.com/PennyLaneAI/pennylane-lightning/pull/753)

Expand Down
208 changes: 208 additions & 0 deletions .github/workflows/tests_lmps_tncuda_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
name: Testing::Linux::x86_64::MPSTNCuda::Python
# TODO remove MPS from the workflow name and the workflow filename once exact is in.
# 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-ignore:
- .github/**
- '!.github/workflows/tests_lmps_tncuda_python.yml'
- pennylane_lightning/core/src/simulators/lightning_kokkos/**
multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved
- pennylane_lightning/core/src/simulators/lightning_qubit/**
- pennylane_lightning/core/src/simulators/lightning_gpu/**
- pennylane_lightning/core/_version.py
- pennylane_lightning/lightning_gpu/**
- pennylane_lightning/lightning_qubit/**
- pennylane_lightning/lightning_kokkos/**
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_python-${{ 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

pythontestswithMPSTNCuda:
if: ${{ !contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
needs: [builddeps]
strategy:
matrix:
os: [ubuntu-22.04]
pl_backend: ["lightning_tensor"]
default_backend: ["lightning_qubit"]
pl_tensor_method: ["mps"]
pl_tensor_backend: ["cutensornet"]
cuda_version: ["12"]

name: Python 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_*

multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved
# 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
multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved

- 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 => $py_path"
echo "pip=$py_path" >> $GITHUB_OUTPUT

- name: Install required packages
run: |
cd main
python -m pip install -r requirements-dev.txt
python -m pip install ninja cmake scipy custatevec-cu${{ matrix.cuda_version }} cutensornet-cu${{ matrix.cuda_version }} openfermionpyscf

- name: Checkout PennyLane for release build
if: inputs.pennylane-version == 'release'
uses: actions/checkout@v4
with:
path: pennylane
repository: PennyLaneAI/pennylane

- name: Switch to release build of PennyLane
if: inputs.pennylane-version == 'release'
run: |
cd pennylane
git fetch --all
git checkout $(git branch -a --list "origin/v*rc*" | tail -1)
python -m pip uninstall -y pennylane && python -m pip install . -vv --no-deps

- name: Install Stable PennyLane
if: inputs.pennylane-version == 'stable'
run: |
cd main
python -m pip uninstall -y pennylane && python -m pip install -U pennylane

- name: Build and install package
run: |
cd main
rm -rf build
CMAKE_ARGS="-DPL_BACKEND=${{ matrix.default_backend }} -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \
python -m pip install . -vv
rm -rf build

rm -rf build
CMAKE_ARGS="-DPL_BACKEND=${{ matrix.pl_backend }} -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \
python -m pip install . -vv

- name: Run PennyLane-Lightning-Tensor unit tests
if: ${{ matrix.pl_backend != 'all'}}
run: |
cd main/
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
PL_DEVICE=${DEVICENAME} python -m pytest tests $COVERAGE_FLAGS
mv coverage.xml coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml

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


upload-to-codecov-linux-python:
needs: [pythontestswithMPSTNCuda]
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-python

- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/tests_without_binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
runs-on: ${{ needs.determine_runner.outputs.runner_group }}
strategy:
matrix:
pl_backend: ["lightning_qubit", "lightning_kokkos", "lightning_gpu"]
pl_backend: ["lightning_qubit", "lightning_kokkos", "lightning_gpu", "lightning_tensor"]

name: Python Tests without Binary (${{ matrix.pl_backend }})

Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
python -m pip uninstall -y pennylane && python -m pip install -U pennylane

- name: Install the pennylane_lightning package
if: ${{ matrix.pl_backend == 'lightning_kokkos' || matrix.pl_backend == 'lightning_gpu'}}
if: ${{ contains(fromJson('["lightning_kokkos", "lightning_gpu", "lightning_tensor"]'), matrix.pl_backend) }}
run: |
cd main
SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" python -m pip install . -vv
Expand All @@ -110,7 +110,7 @@ jobs:
cd main
python -m pip install . -vv

- name: Run PennyLane-Lightning unit tests
- name: Run PennyLane-Lightning unit tests for all backends
run: |
cd main/
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ if(ENABLE_PYTHON)
pybind11_add_module("${PL_BACKEND}_ops" "pennylane_lightning/core/src/bindings/Bindings.cpp")

# Allow pip installation of cuQuantum & CUDA 12 libs to be accessible without setting LD_LIBRARY_PATH for lightning_gpu
if("${PL_BACKEND}" STREQUAL "lightning_gpu")
if("${PL_BACKEND}" STREQUAL "lightning_gpu" OR "${PL_BACKEND}" STREQUAL "lightning_tensor")
set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
set_target_properties("${PL_BACKEND}_ops" PROPERTIES BUILD_RPATH "$ORIGIN/../cuquantum/lib:$ORIGIN/../nvidia/cuda_runtime/lib:$ORIGIN/../nvidia/cublas/lib:$ORIGIN/../nvidia/cusparse/lib:$ORIGIN")
endif()
Expand All @@ -171,12 +171,15 @@ if(ENABLE_PYTHON)
)

target_link_libraries("${PL_BACKEND}_ops" PRIVATE ${PL_BACKEND} #simulator
"${PL_BACKEND}_algorithms"
"${PL_BACKEND}_observables"
"${PL_BACKEND}_bindings"
"${PL_BACKEND}_measurements"
)

if(NOT DEFINED PL_TENSOR)
target_link_libraries("${PL_BACKEND}_ops" PRIVATE "${PL_BACKEND}_algorithms")
endif()

set_target_properties("${PL_BACKEND}_ops" PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_compile_definitions("${PL_BACKEND}_ops" PRIVATE VERSION_INFO=${VERSION_STRING})
endif()
Expand Down
31 changes: 26 additions & 5 deletions pennylane_lightning/core/_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

"""

# pylint: disable=import-outside-toplevel, too-many-instance-attributes, c-extension-no-member
# pylint: disable=import-outside-toplevel, too-many-instance-attributes, c-extension-no-member, too-many-branches, too-many-statements
def __init__(
self, device_name, use_csingle: bool = False, use_mpi: bool = False, split_obs: bool = False
):
Expand Down Expand Up @@ -86,10 +86,23 @@
raise ImportError(
f"Pre-compiled binaries for {device_name} are not available."
) from exception
elif device_name == "lightning.tensor":
try:
import pennylane_lightning.lightning_tensor_ops as lightning_ops
except ImportError as exception:
raise ImportError(
f"Pre-compiled binaries for {device_name} are not available."
) from exception
else:
raise DeviceError(f'The device name "{device_name}" is not a valid option.')
self.statevector_c64 = lightning_ops.StateVectorC64
self.statevector_c128 = lightning_ops.StateVectorC128

if device_name == "lightning.tensor":
self.tensornetwork_c64 = lightning_ops.TensorNetC64
self.tensornetwork_c128 = lightning_ops.TensorNetC128
multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved
else:
self.statevector_c64 = lightning_ops.StateVectorC64
self.statevector_c128 = lightning_ops.StateVectorC128

self.named_obs_c64 = lightning_ops.observables.NamedObsC64
self.named_obs_c128 = lightning_ops.observables.NamedObsC128
self.hermitian_obs_c64 = lightning_ops.observables.HermitianObsC64
Expand All @@ -98,8 +111,10 @@
self.tensor_prod_obs_c128 = lightning_ops.observables.TensorProdObsC128
self.hamiltonian_c64 = lightning_ops.observables.HamiltonianC64
self.hamiltonian_c128 = lightning_ops.observables.HamiltonianC128
self.sparse_hamiltonian_c64 = lightning_ops.observables.SparseHamiltonianC64
self.sparse_hamiltonian_c128 = lightning_ops.observables.SparseHamiltonianC128

if device_name != "lightning.tensor":
self.sparse_hamiltonian_c64 = lightning_ops.observables.SparseHamiltonianC64
self.sparse_hamiltonian_c128 = lightning_ops.observables.SparseHamiltonianC128
multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved

self._use_mpi = use_mpi

Expand Down Expand Up @@ -134,6 +149,8 @@
"""State vector matching ``use_csingle`` precision (and MPI if it is supported)."""
if self._use_mpi:
return self.statevector_mpi_c64 if self.use_csingle else self.statevector_mpi_c128
if self.device_name == "lightning.tensor":
return self.tensornetwork_c64 if self.use_csingle else self.tensornetwork_c128
multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved
return self.statevector_c64 if self.use_csingle else self.statevector_c128

@property
Expand Down Expand Up @@ -286,6 +303,10 @@
if isinstance(observable, OP_MATH_OBS):
return self._hamiltonian(observable, wires_map)
if isinstance(observable, SparseHamiltonian):
if self.device_name == "lightning.tensor":
raise NotImplementedError(

Check warning on line 307 in pennylane_lightning/core/_serialize.py

View check run for this annotation

Codecov / codecov/patch

pennylane_lightning/core/_serialize.py#L307

Added line #L307 was not covered by tests
multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved
"SparseHamiltonian is not supported on the lightning.tensor device."
)
return self._sparse_hamiltonian(observable, wires_map)
return self._hermitian_ob(observable, wires_map)

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.37.0-dev32"
__version__ = "0.37.0-dev33"
Loading
Loading