Skip to content

Commit

Permalink
fix test failures
Browse files Browse the repository at this point in the history
Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
  • Loading branch information
amccaskey committed Aug 17, 2023
1 parent bd0be4e commit 37a205d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/tests/parallel/test_mpi_mqpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from cudaq import spin
import numpy as np

cudaq.mpi.initialize()
skipIfUnsupported = pytest.mark.skipif(
not (cudaq.num_available_gpus() > 0 and cudaq.mpi.is_initialized() and cudaq.has_target('nvidia-mqpu')),
reason="nvidia-mqpu backend not available or mpi not found"
Expand All @@ -20,6 +19,7 @@
@skipIfUnsupported
def testMPI():
cudaq.set_target('nvidia-mqpu')
cudaq.mpi.initialize()

target = cudaq.get_target()
numQpus = target.num_qpus()
Expand Down
1 change: 1 addition & 0 deletions python/tests/unittests/test_kernel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def test_tdg_1_state_negate():

def test_can_progressively_build():
"""Tests that a kernel can be build progressively."""
cudaq.reset_target()
kernel = cudaq.make_kernel()
q = kernel.qalloc(2)
kernel.h(q[0])
Expand Down
5 changes: 3 additions & 2 deletions unittests/integration/builder_tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,9 @@ CUDAQ_TEST(BuilderTester, checkCanProgressivelyBuild) {
kernel.h(q[0]);
auto state = cudaq::get_state(kernel);
EXPECT_NEAR(M_SQRT1_2, state[0].real(), 1e-3);
EXPECT_NEAR(0.0, state[1].real(), 1e-3);
EXPECT_NEAR(M_SQRT1_2, state[2].real(), 1e-3);
// Handle sims with different endianness
EXPECT_TRUE(std::fabs(M_SQRT1_2 - state[1].real()) < 1e-3 ||
std::fabs(M_SQRT1_2 - state[2].real()) < 1e-3);
EXPECT_NEAR(0.0, state[3].real(), 1e-3);

auto counts = cudaq::sample(kernel);
Expand Down

0 comments on commit 37a205d

Please sign in to comment.