Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix brisbane not working with ibmq_qasm_simulator anymore #287

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pytket/extensions/qiskit/backends/ibmq_emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ def __init__(
# Get noise model:
self._noise_model = NoiseModel.from_backend(self._ibmq._backend)

if self._ibmq._backend_info.n_nodes > 32:
raise ValueError(
"ibmq_qasm_simulator only supports 32 qubits, \
devices with more than 32 qubtis can't be simulated"
)

if OpType.ECR in self._ibmq._primitive_gates:
raise ValueError("ibmq_qasm_simulator does not support ECR in gateset")

# cache of results keyed by job id and circuit index
self._ibm_res_cache: Dict[Tuple[str, int], Counter] = dict()

Expand Down
13 changes: 5 additions & 8 deletions tests/backend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,9 @@ def test_nshots_batching(brisbane_backend: IBMQBackend) -> None:
@pytest.mark.flaky(reruns=3, reruns_delay=10)
@pytest.mark.skipif(skip_remote_tests, reason=REASON)
def test_nshots(
brisbane_emulator_backend: IBMQEmulatorBackend,
brisbane_local_emulator_backend: IBMQLocalEmulatorBackend,
) -> None:
for b in [AerBackend(), brisbane_emulator_backend, brisbane_local_emulator_backend]:
for b in [AerBackend(), brisbane_local_emulator_backend]:
circuit = Circuit(1).X(0)
circuit.measure_all()
n_shots = [1, 2, 3]
Expand Down Expand Up @@ -836,10 +835,9 @@ def test_operator_expectation_value() -> None:
@pytest.mark.flaky(reruns=3, reruns_delay=10)
@pytest.mark.skipif(skip_remote_tests, reason=REASON)
def test_ibmq_emulator(
brisbane_emulator_backend: IBMQEmulatorBackend,
brisbane_local_emulator_backend: IBMQLocalEmulatorBackend,
) -> None:
for b in [brisbane_emulator_backend, brisbane_local_emulator_backend]:
for b in [brisbane_local_emulator_backend]:
assert b._noise_model is not None # type: ignore
b_ibm = b._ibmq # type: ignore
b_aer = AerBackend()
Expand Down Expand Up @@ -1147,6 +1145,7 @@ def test_cloud_stabiliser(simulator_stabilizer_backend: IBMQBackend) -> None:


# https://github.com/CQCL/pytket-qiskit/issues/278
# @pytest.mark.flaky(reruns=3, reruns_delay=10)
@pytest.mark.xfail(reason="Qiskit rejecting cx")
@pytest.mark.skipif(skip_remote_tests, reason=REASON)
def test_cloud_stabiliser_0() -> None:
Expand Down Expand Up @@ -1193,11 +1192,10 @@ def test_available_devices(ibm_provider: IBMProvider) -> None:
@pytest.mark.flaky(reruns=3, reruns_delay=10)
@pytest.mark.skipif(skip_remote_tests, reason=REASON)
def test_backendinfo_serialization1(
brisbane_emulator_backend: IBMQEmulatorBackend,
brisbane_local_emulator_backend: IBMQLocalEmulatorBackend,
) -> None:
# https://github.com/CQCL/tket/issues/192
for b in [brisbane_emulator_backend, brisbane_local_emulator_backend]:
for b in [brisbane_local_emulator_backend]:
backend_info_json = b.backend_info.to_dict() # type: ignore
s = json.dumps(backend_info_json)
backend_info_json1 = json.loads(s)
Expand Down Expand Up @@ -1250,11 +1248,10 @@ def test_sim_qubit_order() -> None:
@pytest.mark.flaky(reruns=3, reruns_delay=10)
@pytest.mark.skipif(skip_remote_tests, reason=REASON)
def test_required_predicates(
brisbane_emulator_backend: IBMQEmulatorBackend,
brisbane_local_emulator_backend: IBMQLocalEmulatorBackend,
) -> None:
# https://github.com/CQCL/pytket-qiskit/issues/93
for b in [brisbane_emulator_backend, brisbane_local_emulator_backend]:
for b in [brisbane_local_emulator_backend]:
circ = Circuit(8) # 8 qubit circuit in IBMQ gateset
circ.X(0).CX(0, 1).CX(0, 2).CX(0, 3).CX(0, 4).CX(0, 5).CX(0, 6).CX(
0, 7
Expand Down
Loading