Estimate job run time
After submitting a job to the IBM Quantum™ channel, you can see an estimation for how much quantum time the job will take to run by using job.usage_estimation
. Alternatively, you can view this information on the IBM Quantum Platform user interface.
Quantum time is the duration, in seconds, a QPU is committed to fulfilling a user request.
Notes
- This only applies to jobs that use primitives.
- This is not yet available on the Qiskit Runtime on IBM Cloud® channel.
Example:
from qiskit import QuantumCircuit
from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2 as Sampler
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
service = QiskitRuntimeService()
# Create a new circuit with two qubits (first argument) and two classical
# bits (second argument)
qc = QuantumCircuit(2, 2)
# Add a Hadamard gate to qubit 0
qc.h(0)
# Perform a controlled-X gate on qubit 1, controlled by qubit 0
qc.cx(0, 1)
# Measure qubit 0 to cbit 0, and qubit 1 to cbit 1
qc.measure(0, 0)
qc.measure(1, 1)
# Run on the least-busy device you have access to
backend = service.least_busy(simulator=False,operational=True)
# Generate ISA circuits
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuit = pm.run(qc)
# Create a Sampler object
sampler = Sampler(backend)
# Submit the circuit to the sampler
job = sampler.run([isa_circuit])
print(job.usage_estimation)
Output:
{'quantum_seconds': 4.1058720028432445}
View the estimated workload (job) usage on IBM Quantum Platform
You can view the estimated usage (how much quantum time the workload will take to run) in two places on IBM Quantum Platform:
- On the Workloads table in the Usage column. From the Home page, click View all on the Recent workloads table. The Usage column shows the estimated usage for pending workloads, or actual usage for completed workloads.
- On the workload's details page. From the Dashboard or Workloads table, click the ID to open its details page. The estimated usage is shown in the Status timeline.
Next steps
Recommendations
- Review these tips: Minimize job run time.
- Set the Maximum execution time.
- Learn how to transpile locally in the Transpile section.
- Try the Submit pre-transpiled circuits tutorial.
Was this page helpful?
Report a bug or request content on GitHub.