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

update devices and tests #220

Merged
merged 5 commits into from
Dec 11, 2023
Merged

update devices and tests #220

merged 5 commits into from
Dec 11, 2023

Conversation

cqc-melf
Copy link
Collaborator

@cqc-melf cqc-melf commented Dec 7, 2023

Some of the backends have been removed, updating the devices requires some changes.

@@ -1017,7 +1016,7 @@ def test_compilation_correctness(perth_backend: IBMQBackend) -> None:
c.CX(0, 3).CX(0, 4)
u_backend = AerUnitaryBackend()
u = u_backend.run_circuit(c).get_unitary()
ibm_backend = perth_backend
ibm_backend = AerUnitaryBackend()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unitary calculation only works for 14 or less entry's in the coupling map. There are no devices of that size available...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this test now useless, since it's just comparing AerUnitaryBackend() with itself? (Also it doesn't need the backend parameter and doesn't need to be a remote-only test.) Can we solve the problem by removing blank wires in the compiled circuit?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove_blank_wires is still not working, had to use FlattenRelabelRegistersPass I will now keep the remote backend as it was before?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(done in 25c7929 )

@@ -1086,7 +1085,7 @@ def test_rebase_phase() -> None:
@pytest.mark.skipif(skip_remote_tests, reason=REASON)
def test_postprocess() -> None:
b = IBMQBackend(
"ibm_lagos",
"ibm_kyoto",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lagos is not in the open plan anymore

return IBMQBackend(
"ibm_perth",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perth is not in the open plan anymore

instance="ibm-q/open/main",
token=os.getenv("PYTKET_REMOTE_QISKIT_TOKEN"),
)
assert b.supports_contextual_optimisation
c = Circuit(2, 2)
c.SX(0).SX(1).CX(0, 1).measure_all()
c.X(0).X(1).measure_all()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CX is not in the target gate set anymore, needed to change the circuit.

@cqc-melf cqc-melf marked this pull request as ready for review December 11, 2023 08:58
@cqc-melf cqc-melf requested a review from cqc-alec December 11, 2023 08:58
@@ -392,29 +392,29 @@ def default_compilation_pass(
if not isinstance(arch, FullyConnected):
if placement_options is not None:
noise_aware_placement = NoiseAwarePlacement(
arch,
arch, # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about assert(arch is not None) to get rid of these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 25c7929

@@ -1017,7 +1016,7 @@ def test_compilation_correctness(perth_backend: IBMQBackend) -> None:
c.CX(0, 3).CX(0, 4)
u_backend = AerUnitaryBackend()
u = u_backend.run_circuit(c).get_unitary()
ibm_backend = perth_backend
ibm_backend = AerUnitaryBackend()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this test now useless, since it's just comparing AerUnitaryBackend() with itself? (Also it doesn't need the backend parameter and doesn't need to be a remote-only test.) Can we solve the problem by removing blank wires in the compiled circuit?

@@ -340,17 +340,17 @@ def test_process_characterisation_complete_noise_model() -> None:
assert gqe1[0][1][1][1] == 0.65
assert gqe1[0][2][1][0] == 0.35
assert gqe1[0][2][1][1] == 0.65
assert node_errors[arch.nodes[0]][OpType.U3] == 0.375
assert round(link_errors[(arch.nodes[0], arch.nodes[1])][OpType.CX], 4) == 0.5625
assert node_errors[arch.nodes[0]][OpType.U3] == 0.375 # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use assert again to remove these (and below)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@cqc-melf cqc-melf requested a review from cqc-alec December 11, 2023 12:21
c1 = cu.circuit
compiled_u = u_backend.run_circuit(c1).get_unitary()

# Adjust for placement
imap = cu.initial_map
fmap = cu.final_map
c_idx = {c.qubits[i]: i for i in range(7)}
c1_idx = {c1.qubits[i]: i for i in range(7)}
c_idx = {c.qubits[i]: i for i in range(5)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not 7?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two qubits are not used and removed by the flatten registers pass. Staying with 7 will create and index out of bounds error.

@cqc-melf cqc-melf requested a review from cqc-alec December 11, 2023 13:29
@cqc-melf cqc-melf merged commit 3844315 into develop Dec 11, 2023
7 checks passed
@cqc-melf cqc-melf deleted the fix/backendissues branch March 26, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants