2
$\begingroup$

I tried to change a little the code here for running the quantum volume circuits in real devices. My code is

backend = provider.get_backend('ibmq_bogota')

shots = 1000
for trial in range(ntrials):
    clear_output(wait=True)
    t_qcs = transpile(qv_circs[trial], backend=backend, initial_layout=qubit_lists[0])
    qobj = [assemble(t_qcs)]

    job_manager = IBMQJobManager()
    job_set_foo = job_manager.run(qobj, backend=backend, shots=shots, name='QV trial %d'%(trial))
print(job_set_foo.report(detailed=True))
print(f'Completed trial {trial+1}/{ntrials}')

But I get

status: job submit failed: 'bad input to assemble() function; must be either circuits or schedules'

I don't understand how this can fail,since qv_circs must contain the necessary attributes. Note that I wrote qobj = [assemble(t_qcs)] instead of qobj = assemble(t_qcs). If I do the latter I obtain

'QasmQobj' object is not iterable

EDIT:

Some information about the objects:

print(t_qcs)
[<qiskit.circuit.quantumcircuit.QuantumCircuit object at 0x7fa2398698a0>]
print(type(t_qcs))
<class 'list'>
$\endgroup$
2
  • 1
    $\begingroup$ I'm having trouble recreating the issue, could you provide some more information on the qv_circs or print(t_qcs) / print(type(t_qcs)) on the iteration that's failing? $\endgroup$
    – ryanhill1
    Commented Jun 2, 2022 at 16:19
  • $\begingroup$ Thanks! I added the prints you suggested, though I don't know exactly what should I look for in qv_circs (i.e. I don't know which methods you suggest to use to extract certain information). Meanwhile, I can tell you that I obtained the object using the qiskit tutorial: import qiskit.ignis.verification.quantum_volume as qv and qv_circs, qv_circs_nomeas = qv.qv_circuits(qubit_lists, ntrials) . $\endgroup$ Commented Jun 3, 2022 at 8:03

2 Answers 2

2
$\begingroup$

As per Qiskit's release notes, under "IBM Q Provider 0.12.0"[1]

qiskit.providers.ibmq.IBMQBackend.run() method now takes one or more QuantumCircuit or Schedule. Use of QasmQobj and PulseQobj is now deprecated.

So, you shouldn't call assemble. Just pass the transpiled circuits to IBMQJobManager.run() method:

shots = 1000
for trial in range(ntrials):
    clear_output(wait=True)
    t_qcs = transpile(qv_circs[trial], backend=backend, initial_layout=qubit_lists)

    job_manager = IBMQJobManager()
    job_set_foo = job_manager.run(t_qcs, backend=backend, shots=shots, name='QV trial %d'%(trial))
    
print(job_set_foo.report(detailed=True))
print(f'Completed trial {trial+1}/{ntrials}')

I tested this code using the latest Qiskit version and it worked without any problem. The backend was ibmq_santiago (it is the backend returned by least_busy() function when I called it)

$\endgroup$
0
2
$\begingroup$

By doing some error tracking, you'll find that

TypeError: 'QasmQobj' object is not iterable`

was raised from

IBMQJobManagerInvalidStateError: Pulse schedules found, but the backend does not support pulse schedules.

So your code was ok, it's just that the IBMQ Bogota backend doesn't support pulse schedules. Right now it appears that the only IBMQ QPU that does support pulse schedules is IBMQ Armonk:

>>> provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')
>>> for backend in provider.backends():
... config = backend.configuration()
... if config.open_pulse:
...     print(config.backend_name)
ibmq_armonk

IBMQ Armonk is a single-qubit device, so the qubit_lists and any other qubit-related parts of your code will have to be modified.

Good luck!

$\endgroup$

Your Answer

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

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