Skip to content

Commit

Permalink
Update LQ's MCM treatment following dynamic_one_shot update. (#724)
Browse files Browse the repository at this point in the history
* Update LQ's mcm workflow.

* Auto update version from '0.37.0-dev6' to '0.37.0-dev7'

* Update changelog

* trigger ci

* trigger ci

* Fix paths-ignore for python tests.

* Update .github/CHANGELOG.md

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

---------

Co-authored-by: ringo-but-quantum <[email protected]>
  • Loading branch information
vincentmr and ringo-but-quantum authored May 10, 2024
1 parent c164f2e commit 1036b83
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 13 deletions.
9 changes: 6 additions & 3 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

### 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.
[(#724)](https://github.com/PennyLaneAI/pennylane-lightning/pull/724)

* `dynamic_one_shot` deals with post-selection during the post-processing phase, so Lightning-Qubit does not return `None`-valued measurements for mismatching samples anymore.
[(#720)](https://github.com/PennyLaneAI/pennylane-lightning/pull/720)

### Improvements

* Update C++ and Python GitHub actions names to include the matrix info.
Expand All @@ -17,12 +20,12 @@

* The various OpenMP configurations of Lightning-Qubit are tested in parallel on different Github Actions runners.
[(#712)](https://github.com/PennyLaneAI/pennylane-lightning/pull/712)

* Update Linux wheels to use `manylinux_2_28` images.
[(#667)](https://github.com/PennyLaneAI/pennylane-lightning/pull/667)

* Add support for `qml.expval` and `qml.var` in the `lightning.tensor` device for the `quimb` interface and the MPS method.
[(#686)](https://github.com/PennyLaneAI/pennylane-lightning/pull/686)
[(#686)](https://github.com/PennyLaneAI/pennylane-lightning/pull/686)

* Changed the name of `lightning.tensor` to `default.tensor` with the `quimb` backend.
[(#719)](https://github.com/PennyLaneAI/pennylane-lightning/pull/719)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_lgpu_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
release:
pull_request:
paths-ignore:
- .github
- .github/**
- '!.github/workflows/tests_lgpu_python.yml'
- pennylane_lightning/core/_version.py
- pennylane_lightning/core/src/simulators/lightning_kokkos/**
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_lgpumpi_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
- main
pull_request:
paths-ignore:
- .github
- .github/**
- '!.github/workflows/tests_lgpumpi_python.yml'
- pennylane_lightning/core/_version.py
- pennylane_lightning/core/src/simulators/lightning_kokkos/**
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_lkcpu_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
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)
pull_request:
paths-ignore:
- .github
- .github/**
- '!.github/workflows/tests_lkcpu_python.yml'
- pennylane_lightning/core/_version.py
- pennylane_lightning/core/src/simulators/lightning_gpu/**
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_lkcuda_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
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)
pull_request:
paths-ignore:
- .github
- .github/**
- '!.github/workflows/tests_lkcuda_python.yml'
- pennylane_lightning/core/_version.py
- pennylane_lightning/core/src/simulators/lightning_gpu/**
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_lqcpu_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
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)
pull_request:
paths-ignore:
- .github
- .github/**
- '!.github/workflows/tests_lqcpu_python.yml'
- pennylane_lightning/core/_version.py
- pennylane_lightning/core/src/simulators/lightning_gpu/**
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-dev7"
__version__ = "0.37.0-dev8"
20 changes: 16 additions & 4 deletions pennylane_lightning/lightning_qubit/lightning_qubit.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,23 @@ def simulate(circuit: QuantumScript, state: LightningStateVector, mcmc: dict = N
state.reset_state()
has_mcm = any(isinstance(op, MidMeasureMP) for op in circuit.operations)
if circuit.shots and has_mcm:
mid_measurements = {}
final_state = state.get_final_state(circuit, mid_measurements=mid_measurements)
return LightningMeasurements(final_state, **mcmc).measure_final_state(
circuit, mid_measurements=mid_measurements
results = []
aux_circ = qml.tape.QuantumScript(
circuit.operations,
circuit.measurements,
shots=[1],
trainable_params=circuit.trainable_params,
)
for _ in range(circuit.shots.total_shots):
state.reset_state()
mid_measurements = {}
final_state = state.get_final_state(aux_circ, mid_measurements=mid_measurements)
results.append(
LightningMeasurements(final_state, **mcmc).measure_final_state(
aux_circ, mid_measurements=mid_measurements
)
)
return tuple(results)
final_state = state.get_final_state(circuit)
return LightningMeasurements(final_state, **mcmc).measure_final_state(circuit)

Expand Down

0 comments on commit 1036b83

Please sign in to comment.