Skip to content

Commit

Permalink
Updating test and simplifying profile parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
idavis committed Sep 27, 2024
1 parent 269097b commit 9eac82c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
8 changes: 1 addition & 7 deletions azure-quantum/azure/quantum/target/microsoft/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,8 @@ def submit(
from pyqir import Context, Module

if isinstance(input_data, QuantumCircuit):

backend = ResourceEstimatorBackend()
# Unrestricted isn't a valid target profile for QIR. Check if
# the target profile is set to "Base" and set the target
# profile to "Base" if so, default to "Adaptive_RI" otherwise.
target_profile = TargetProfile.Adaptive_RI
if self.target_profile == "Base":
target_profile = TargetProfile.Base
target_profile = TargetProfile.from_str(self.target_profile)
qir_str = backend.qir(input_data, target_profile=target_profile)
context = Context()
module = Module.from_ir(context, qir_str)
Expand Down
15 changes: 10 additions & 5 deletions azure-quantum/tests/unit/test_qiskit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1836,13 +1836,10 @@ def test_qiskit_get_qci_qpu_targets(self):
self.assertEqual("qir.v1", config.azure["input_data_format"])
self.assertEqual("microsoft.quantum-results.v2", backend._get_output_data_format())

# @pytest.mark.parametrize("endian_pos, expectation",
# [(0,"000 000 001"), (1,"000 010 000"), (2,"100 000 000")]
# )
@pytest.mark.qci
@pytest.mark.live_test
def test_qiskit_endianness_submit_to_qci(
self, endian_pos=0, expectation="000 000 001"
self, expectation="000 000 001"
):
workspace = self.create_workspace()
provider = AzureQuantumProvider(workspace=workspace)
Expand All @@ -1851,9 +1848,17 @@ def test_qiskit_endianness_submit_to_qci(

qr = QuantumRegister(3)
cr = [ClassicalRegister(3) for _ in range(3)]
circuit = QuantumCircuit(qr, *cr, name=f"endian0cr3")
circuit = QuantumCircuit(qr, *cr, name="endian0cr3")
circuit.x(0)
circuit.measure(qr[0], cr[0][0])
circuit.measure(qr[1], cr[0][1])
circuit.measure(qr[1], cr[0][2])
circuit.measure(qr[1], cr[1][0])
circuit.measure(qr[1], cr[1][1])
circuit.measure(qr[1], cr[1][2])
circuit.measure(qr[2], cr[2][0])
circuit.measure(qr[2], cr[2][1])
circuit.measure(qr[2], cr[2][2])
circuit.metadata = {"some": "data"}

qiskit_job = backend.run(circuit, shots=shots)
Expand Down

0 comments on commit 9eac82c

Please sign in to comment.