1
$\begingroup$

I have a quantum circuit for the Markovian Reservoir Engineering[MRE] Model, written in cirq (frontend) and trying to run it on Ionq hardware, using qbraid credits. This is all being done on qbraid workspace. We did test run a simple quantum circuit with Qiskit as frontend, we did not get any issues.

In MRE, we have to run for three different pumps [XX, ZZ, and ZZXX], each of them for 256 shots and we have to do for each of the four initial states - 00, 01, 10, 11 and each case for five different probabilities. Since we have credits on two different qbraid accounts, what we are doing is that on one account, we are running several pumps for a particular initial state for all five different probability inputs, and the remaining batches on another account.

Below is the error I am getting.

ValidationException: An error occurred (ValidationException) when calling the CreateQuantumTask operation (reached max retries: 4): Device requires all qubits in the program to be measured. This may be caused by declaring non-contiguous qubits or measuring partial qubits

Also, we tried to resolve this by measuring all the qubits and also initializing sys and ancilla qubits as subarrays [such as all qubits from 0 to 5 are for sys and the remaining for ancilla qubits], however, it still does give us the same error.

Any suggestion would be appreciated.

$\endgroup$
4
  • $\begingroup$ For clarity, what are you using to run your programs on Braket? The Braket SDK, Qiskit provider, or something else? Does the generated OpenQASM show each declared qubit being measured? $\endgroup$
    – Cody Wang
    May 3 at 21:18
  • $\begingroup$ @CodyWang We are using qBraid device wrappers which are used to run the circuits on quantum backends associated with qBraid. We followed this tutorial - docs.qbraid.com/en/stable/sdk/jobs.html. And in our case, the backend device is aws_ionq - IonQ 11 qubit qpu. $\endgroup$ May 3 at 22:03
  • $\begingroup$ Can you extract the OpenQASM or preferably the Braket circuit object? I'm wondering if it's an issue with the translation to Braket. $\endgroup$
    – Cody Wang
    May 4 at 3:20
  • $\begingroup$ @CodyWang yep, will do that, its an issue with transpiling, and also Braket does not have measurement gate i guess, but we are using measurement gate in the cirq circuit. It works fine after removing the measurement statement in the code. $\endgroup$ May 12 at 19:54

1 Answer 1

3
$\begingroup$

I believe we connected over Discord, but reposting my answer here for anyone else that might run into a similar issue:

This was a bug in the qbraid.transpiler.cirq_braket conversions module. It was caused by a failure to convert the cirq.ops.MeasurementGate to an equivalent Amazon Braket gate (since one doesn't exist). The qBraid transpiler was not properly accounting for this, so had a bug that actually dropped the entire quantum register where the measurement gate would-have been applied. This impacted the output circuit qubit indexing, and thus caused the non-contiguous qubits error you got above.

As you mentioned, the quick fix was simply removing the measurement gate from your cirq $\rightarrow$ braket conversion. But since then, this issue has been resolved with PR #192 and published with Release 0.4.0. So updating to the latest version should fix it!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.