diff --git a/python/tests/parallel/test_mpi_mqpu.py b/python/tests/parallel/test_mpi_mqpu.py index 1c029bddfd..00e96cd13d 100644 --- a/python/tests/parallel/test_mpi_mqpu.py +++ b/python/tests/parallel/test_mpi_mqpu.py @@ -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" @@ -20,6 +19,7 @@ @skipIfUnsupported def testMPI(): cudaq.set_target('nvidia-mqpu') + cudaq.mpi.initialize() target = cudaq.get_target() numQpus = target.num_qpus() diff --git a/python/tests/unittests/test_kernel_builder.py b/python/tests/unittests/test_kernel_builder.py index 9d9b0505cb..249d9df608 100644 --- a/python/tests/unittests/test_kernel_builder.py +++ b/python/tests/unittests/test_kernel_builder.py @@ -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]) diff --git a/unittests/integration/builder_tester.cpp b/unittests/integration/builder_tester.cpp index 832b6d0c45..2183f92334 100644 --- a/unittests/integration/builder_tester.cpp +++ b/unittests/integration/builder_tester.cpp @@ -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);