diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 1065b462de..8a5f6f86b8 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -26,6 +26,9 @@ ### Improvements +* Add configuration files to improve compatibility with Catalyst. + [(#566)](https://github.com/PennyLaneAI/pennylane-lightning/pull/566) + * Refactor shot-noise related methods of MeasurementsBase class in the C++ layer and eigenvalues are not limited to `1` and `-1`. Add `getObs()` method to Observables class. Refactor `applyInPlaceShots` to allow users to get eigenvalues of Observables object. Deprecated `_preprocess_state` method in `MeasurementsBase` class for safer use of the `LightningQubitRaw` backend. [(#570)](https://github.com/PennyLaneAI/pennylane-lightning/pull/570) @@ -76,7 +79,7 @@ This release contains contributions from (in alphabetical order): -Isaac De Vlugt, Amintor Dusko, Vincent Michaud-Rioux, Lee James O'Riordan, Shuli Shu +Isaac De Vlugt, Amintor Dusko, Vincent Michaud-Rioux, Erick Ochoa Lopez, Lee James O'Riordan, Shuli Shu --- diff --git a/MANIFEST.in b/MANIFEST.in index 8f5a65d821..ba9ba9519f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,5 @@ include requirements.txt -include CHANGELOG.rst \ No newline at end of file +include CHANGELOG.rst +include lightning_qubit.toml +include lightning_gpu.toml +include lightning_kokkos.toml diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index 7382faa86b..42f8909ba2 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.34.0-dev17" +__version__ = "0.34.0-dev18" diff --git a/pennylane_lightning/lightning_gpu/lightning_gpu.py b/pennylane_lightning/lightning_gpu/lightning_gpu.py index e7e76bcfbd..f424d1e14e 100644 --- a/pennylane_lightning/lightning_gpu/lightning_gpu.py +++ b/pennylane_lightning/lightning_gpu/lightning_gpu.py @@ -18,6 +18,7 @@ """ from warnings import warn +from pathlib import Path import numpy as np from pennylane_lightning.core.lightning_base import ( @@ -230,6 +231,7 @@ class LightningGPU(LightningBase): # pylint: disable=too-many-instance-attribut operations = allowed_operations observables = allowed_observables _backend_info = backend_info + config = Path(__file__).parent / "lightning_gpu.toml" def __init__( self, diff --git a/pennylane_lightning/lightning_gpu/lightning_gpu.toml b/pennylane_lightning/lightning_gpu/lightning_gpu.toml new file mode 100644 index 0000000000..7e2944755d --- /dev/null +++ b/pennylane_lightning/lightning_gpu/lightning_gpu.toml @@ -0,0 +1,122 @@ +schema = 1 + +[device] +name = "lightning.gpu" + +[operators] +# Observables supported by the device +observables = [ + "PauliX", + "PauliY", + "PauliZ", + "Hadamard", + "Hermitian", + "Identity", + "SparseHamiltonian", + "Hamiltonian", + "Sum", + "SProd", + "Prod", + "Exp", +] + +# The union of all gate types listed in this section must match what +# the device considers "supported" through PennyLane's device API. +[[operators.gates]] +native = [ + "Identity", + "PauliX", + "PauliY", + "PauliZ", + "Hadamard", + "S", + "T", + "PhaseShift", + "RX", + "RY", + "RZ", + "Rot", + "CNOT", + "CY", + "CZ", + "SWAP", + "CSWAP", + "Toffoli", + "IsingXX", + "IsingXY", + "IsingYY", + "IsingZZ", + "ControlledPhaseShift", + "CRX", + "CRY", + "CRZ", + "CRot", + "SingleExcitation", + "SingleExcitationPlus", + "SingleExcitationMinus", + "DoubleExcitation", + "DoubleExcitationPlus", + "DoubleExcitationMinus", + "MultiRZ", + "QubitUnitary", +] + +# Operators that should be decomposed according to the algorithm used +# by PennyLane's device API. +# Optional, since gates not listed in this list will typically be decomposed by +# default, but can be useful to express a deviation from this device's regular +# strategy in PennyLane. +decomp = [ + "BasisState", + "QFT", + "QubitStateVector", + "StatePrep", + "MultiControlledX", +] + +# Gates which should be translated to QubitUnitary +matrix = [ + "ControlledQubitUnitary", + "ECR", + "SX", + "ISWAP", + "PSWAP", + "SISWAP", + "SQISW", + "CPhase", + "OrbitalRotation", + "QubitCarry", + "QubitSum", + "DiagonalQubitUnitary", +] + +[measurement_processes] +exactshots = [ + "Expval", + "Var", + "Probs", + "State", +] +finiteshots = [ + "Expval", + "Var", + "Probs", + "Sample", + "Counts", +] + +[compilation] +# If the device is compatible with qjit +qjit_compatible = false +# If the device requires run time generation of the quantum circuit. +runtime_code_generation = false +# If the device supports adjoint +quantum_adjoint = false +# If the device supports quantum control instructions natively +quantum_control = false +# If the device supports mid circuit measurements natively +mid_circuit_measurement = false + +# This field is currently unchecked but it is reserved for the purpose of +# determining if the device supports dynamic qubit allocation/deallocation. +dynamic_qubit_management = false diff --git a/pennylane_lightning/lightning_kokkos/lightning_kokkos.py b/pennylane_lightning/lightning_kokkos/lightning_kokkos.py index 56cda8f92c..ea1c877ab4 100644 --- a/pennylane_lightning/lightning_kokkos/lightning_kokkos.py +++ b/pennylane_lightning/lightning_kokkos/lightning_kokkos.py @@ -18,6 +18,7 @@ """ from warnings import warn +from pathlib import Path import numpy as np from pennylane_lightning.core.lightning_base import ( @@ -185,6 +186,7 @@ class LightningKokkos(LightningBase): operations = allowed_operations observables = allowed_observables _backend_info = backend_info + config = Path(__file__).parent / "lightning_kokkos.toml" def __init__( self, diff --git a/pennylane_lightning/lightning_kokkos/lightning_kokkos.toml b/pennylane_lightning/lightning_kokkos/lightning_kokkos.toml new file mode 100644 index 0000000000..fd1b20de7a --- /dev/null +++ b/pennylane_lightning/lightning_kokkos/lightning_kokkos.toml @@ -0,0 +1,122 @@ +schema = 1 + +[device] +name = "lightning.kokkos" + +[operators] +# Observables supported by the device +observables = [ + "PauliX", + "PauliY", + "PauliZ", + "Hadamard", + "Hermitian", + "Identity", + "SparseHamiltonian", + "Hamiltonian", + "Sum", + "SProd", + "Prod", + "Exp", +] + +# The union of all gate types listed in this section must match what +# the device considers "supported" through PennyLane's device API. +[[operators.gates]] +native = [ + "Identity", + "PauliX", + "PauliY", + "PauliZ", + "Hadamard", + "S", + "T", + "PhaseShift", + "RX", + "RY", + "RZ", + "Rot", + "CNOT", + "CY", + "CZ", + "SWAP", + "CSWAP", + "Toffoli", + "IsingXX", + "IsingXY", + "IsingYY", + "IsingZZ", + "ControlledPhaseShift", + "CRX", + "CRY", + "CRZ", + "CRot", + "SingleExcitation", + "SingleExcitationPlus", + "SingleExcitationMinus", + "DoubleExcitation", + "DoubleExcitationPlus", + "DoubleExcitationMinus", + "MultiRZ", + "QubitUnitary", +] + +# Operators that should be decomposed according to the algorithm used +# by PennyLane's device API. +# Optional, since gates not listed in this list will typically be decomposed by +# default, but can be useful to express a deviation from this device's regular +# strategy in PennyLane. +decomp = [ + "BasisState", + "QubitStateVector", + "StatePrep", + "QFT", + "MultiControlledX", +] + +# Gates which should be translated to QubitUnitary +matrix = [ + "ControlledQubitUnitary", + "ECR", + "SX", + "ISWAP", + "PSWAP", + "SISWAP", + "SQISW", + "CPhase", + "OrbitalRotation", + "QubitCarry", + "QubitSum", + "DiagonalQubitUnitary", +] + +[measurement_processes] +exactshots = [ + "Expval", + "Var", + "Probs", + "State", +] +finiteshots = [ + "Expval", + "Var", + "Probs", + "Sample", + "Counts", +] + +[compilation] +# If the device is compatible with qjit +qjit_compatible = true +# If the device requires run time generation of the quantum circuit. +runtime_code_generation = false +# If the device supports adjoint +quantum_adjoint = true +# If the device supports quantum control instructions natively +quantum_control = false +# If the device supports mid circuit measurements natively +mid_circuit_measurement = true + +# This field is currently unchecked but it is reserved for the purpose of +# determining if the device supports dynamic qubit allocation/deallocation. +dynamic_qubit_management = false diff --git a/pennylane_lightning/lightning_qubit/lightning_qubit.py b/pennylane_lightning/lightning_qubit/lightning_qubit.py index 1e42d36932..2eb96e46c7 100644 --- a/pennylane_lightning/lightning_qubit/lightning_qubit.py +++ b/pennylane_lightning/lightning_qubit/lightning_qubit.py @@ -18,6 +18,7 @@ """ from warnings import warn +from pathlib import Path import numpy as np from pennylane_lightning.core.lightning_base import ( @@ -207,6 +208,7 @@ class LightningQubit(LightningBase): operations = allowed_operations observables = allowed_observables _backend_info = backend_info + config = Path(__file__).parent / "lightning_qubit.toml" def __init__( # pylint: disable=too-many-arguments self, diff --git a/pennylane_lightning/lightning_qubit/lightning_qubit.toml b/pennylane_lightning/lightning_qubit/lightning_qubit.toml new file mode 100644 index 0000000000..bd5d3994d3 --- /dev/null +++ b/pennylane_lightning/lightning_qubit/lightning_qubit.toml @@ -0,0 +1,129 @@ +schema = 1 + +[device] +name = "lightning.qubit" + +[operators] +# Observables supported by the device +observables = [ + "PauliX", + "PauliY", + "PauliZ", + "Hadamard", + "Hermitian", + "Identity", + "Projector", + "SparseHamiltonian", + "Hamiltonian", + "Sum", + "SProd", + "Prod", + "Exp", +] + +# The union of all gate types listed in this section must match what +# the device considers "supported" through PennyLane's device API. +[[operators.gates]] +native = [ + # Operators that shouldn't be decomposed. + "Identity", + "PauliX", + "PauliY", + "PauliZ", + "Hadamard", + "S", + "T", + "PhaseShift", + "RX", + "RY", + "RZ", + "Rot", + "CNOT", + "CY", + "CZ", + "SWAP", + "CSWAP", + "Toffoli", + "IsingXX", + "IsingXY", + "IsingYY", + "IsingZZ", + "ControlledPhaseShift", + "CRX", + "CRY", + "CRZ", + "CRot", + "SingleExcitation", + "SingleExcitationPlus", + "SingleExcitationMinus", + "DoubleExcitation", + "DoubleExcitationPlus", + "DoubleExcitationMinus", + "MultiRZ", + "QubitUnitary", +] + +# Operators that should be decomposed according to the algorithm used +# by PennyLane's device API. +# Optional, since gates not listed in this list will typically be decomposed by +# default, but can be useful to express a deviation from this device's regular +# strategy in PennyLane. +decomp = [ + "BasisState", + "QubitStateVector", + "StatePrep", + "QFT", + "MultiControlledX", +] + +# Gates which should be translated to QubitUnitary +matrix = [ + "ControlledQubitUnitary", + "ECR", + "SX", + "ISWAP", + "PSWAP", + "SISWAP", + "SQISW", + "CPhase", + "OrbitalRotation", + "QubitCarry", + "QubitSum", + "DiagonalQubitUnitary", +] + +[measurement_processes] +exactshots = [ + "Expval", + "Var", + "Probs", + "State", +] +finiteshots = [ + "Expval", + "Var", + "Probs", + "Sample", + "Counts", +] + +[compilation] +# If the device is compatible with qjit +qjit_compatible = true +# If the device requires run time generation of the quantum circuit. +runtime_code_generation = false +# If the device supports adjoint +quantum_adjoint = true +# If the device supports quantum control instructions natively +quantum_control = false +# If the device supports mid circuit measurements natively +mid_circuit_measurement = true + +# This field is currently unchecked but it is reserved for the purpose of +# determining if the device supports dynamic qubit allocation/deallocation. +dynamic_qubit_management = false + +[options] +mcmc = "_mcmc" +num_burnin = "_num_burnin" +kernel_name = "_kernel_name"