Skip to content

Commit

Permalink
add fp32 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
multiphaseCFD committed Oct 24, 2023
1 parent 378a5d7 commit 41aace7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 0 additions & 2 deletions mpitests/test_expval.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ def test_hadamard_expectation(self, theta, phi, tol):
"""Test that Hadamard expectation value is correct"""
dev = qml.device(device_name, mpi=True, wires=3)

if device_name == "lightning.gpu" and dev.R_DTYPE == np.float32:
pytest.skip("Skipped FP32 tests for expval in lightning.gpu")

O1 = qml.Hadamard(wires=[0])
O2 = qml.Hadamard(wires=[1])
Expand Down
16 changes: 8 additions & 8 deletions pennylane_lightning/lightning_gpu/lightning_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,23 +361,23 @@ def state(self):
@property
def create_ops_list(self):
"""Returns create_ops_list function of the matching precision."""
if not self._mpi:
return create_ops_listC64 if self.use_csingle else create_ops_listC128
return create_ops_listMPIC64 if self.use_csingle else create_ops_listMPIC128
if self._mpi:
return create_ops_listMPIC64 if self.use_csingle else create_ops_listMPIC128

Check warning on line 365 in pennylane_lightning/lightning_gpu/lightning_gpu.py

View check run for this annotation

Codecov / codecov/patch

pennylane_lightning/lightning_gpu/lightning_gpu.py#L365

Added line #L365 was not covered by tests
return create_ops_listC64 if self.use_csingle else create_ops_listC128

@property
def measurements(self):
"""Returns Measurements constructor of the matching precision."""
if not self._mpi:
if self._mpi:
return (

Check warning on line 372 in pennylane_lightning/lightning_gpu/lightning_gpu.py

View check run for this annotation

Codecov / codecov/patch

pennylane_lightning/lightning_gpu/lightning_gpu.py#L372

Added line #L372 was not covered by tests
MeasurementsC64(self._gpu_state)
MeasurementsMPIC64(self._gpu_state)
if self.use_csingle
else MeasurementsC128(self._gpu_state)
else MeasurementsMPIC128(self._gpu_state)
)
return (
MeasurementsMPIC64(self._gpu_state)
MeasurementsC64(self._gpu_state)
if self.use_csingle
else MeasurementsMPIC128(self._gpu_state)
else MeasurementsC128(self._gpu_state)
)

def syncD2H(self, state_vector, use_async=False):
Expand Down

0 comments on commit 41aace7

Please sign in to comment.