From 454e4e004072c569f2d7e78ab7d92dc1704c3f05 Mon Sep 17 00:00:00 2001 From: Shuli Shu <08cnbj@gmail.com> Date: Tue, 22 Oct 2024 18:47:19 +0000 Subject: [PATCH] quick fix --- pennylane_lightning/lightning_gpu/_state_vector.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pennylane_lightning/lightning_gpu/_state_vector.py b/pennylane_lightning/lightning_gpu/_state_vector.py index 397e2c503..4beccdcc9 100644 --- a/pennylane_lightning/lightning_gpu/_state_vector.py +++ b/pennylane_lightning/lightning_gpu/_state_vector.py @@ -238,9 +238,6 @@ def _apply_lightning_controlled(self, operation): Returns: None """ - if self._mpi_handler.use_mpi: - raise DeviceError("Lightning-GPU-MPI does not support Controlled GlobalPhase gates.") - state = self.state_vector basename = operation.base.name @@ -336,6 +333,14 @@ def _apply_lightning( isinstance(operation, qml.ops.Controlled) and not self._mpi_handler.use_mpi ): # MPI backend does not have native controlled gates support self._apply_lightning_controlled(operation) + elif ( + self._mpi_handler.use_mpi + and isinstance(operation, qml.ops.Controlled) + and isinstance(operation.base, qml.GlobalPhase) + ): + raise DeviceError( + "Lightning-GPU-MPI does not support Controlled GlobalPhase gates." + ) else: # apply gate as a matrix try: mat = qml.matrix(operation)