Skip to content

Commit

Permalink
Spawn threads in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Mills committed Mar 18, 2024
1 parent 3359d7a commit da5df0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/noise_model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ def test_to_dict(tmpdir_factory) -> None:
@pytest.mark.high_compute
def test_transpiler_backend() -> None:

mp.set_start_method("spawn", force=True)

circuit = Circuit(3)
for _ in range(32):
circuit.ZZMax(0, 1).ZZMax(1, 2)
Expand Down
5 changes: 5 additions & 0 deletions tests/zne_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
from qermit.zero_noise_extrapolation.zne import gen_noise_scaled_mitex
from qermit.noise_model import TranspilerBackend, PauliErrorTranspile
from itertools import product
import multiprocessing as mp

n_qubits = 2

Expand Down Expand Up @@ -848,6 +849,8 @@ def test_end_to_end_noise_scaled_mitex():
@pytest.mark.high_compute
def test_end_to_end_noise_aware_zne_mitex_starting_from_ptm() -> None:

mp.set_start_method("spawn", force=True)

# Here we are creating the PTM for a noise model acting
# XI with rate 0.1
ptm = np.diag([1, 1, 1, 1, 1, 1, 1, 1, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8])
Expand Down Expand Up @@ -907,6 +910,8 @@ def test_end_to_end_noise_aware_zne_mitex_starting_from_ptm() -> None:
@pytest.mark.high_compute
def test_end_to_end_noise_aware_zne_mitex():

mp.set_start_method("spawn", force=True)

error_rate = 0.1
error_distribution = ErrorDistribution(
distribution={(Pauli.X, Pauli.I): error_rate}
Expand Down

0 comments on commit da5df0d

Please sign in to comment.