IBMRuntimeService¶
-
class
IBMRuntimeService
(provider)[source]¶ Bases:
object
Class for interacting with the Qiskit Runtime service.
Qiskit Runtime is a new architecture offered by IBM Quantum that streamlines computations requiring many iterations. These experiments will execute significantly faster within its improved hybrid quantum/classical process.
The Qiskit Runtime Service allows authorized users to upload their Qiskit quantum programs. A Qiskit quantum program, also called a runtime program, is a piece of Python code and its metadata that takes certain inputs, performs quantum and maybe classical processing, and returns the results. The same or other authorized users can invoke these quantum programs by simply passing in parameters.
A sample workflow of using the runtime service:
from qiskit import IBMQ, QuantumCircuit from qiskit.providers.ibmq import RunnerResult provider = IBMQ.load_account() backend = provider.backend.ibmq_qasm_simulator # List all available programs. provider.runtime.pprint_programs() # Create a circuit. qc = QuantumCircuit(2, 2) qc.h(0) qc.cx(0, 1) qc.measure_all() # Set the "circuit-runner" program parameters params = provider.runtime.program(program_id="circuit-runner").parameters() params.circuits = qc params.measurement_error_mitigation = True # Configure backend options options = {'backend_name': backend.name()} # Execute the circuit using the "circuit-runner" program. job = provider.runtime.run(program_id="circuit-runner", options=options, inputs=params) # Get runtime job result. result = job.result(decoder=RunnerResult)
If the program has any interim results, you can use the
callback
parameter of therun()
method to stream the interim results. Alternatively, you can use theRuntimeJob.stream_results()
method to stream the results at a later time, but before the job finishes.The
run()
method returns aRuntimeJob
object. You can use its methods to perform tasks like checking job status, getting job result, and canceling job.IBMRuntimeService constructor.
- Parameters
provider (
AccountProvider
) – IBM Quantum account provider.
Methods
Delete a runtime job.
Delete a runtime program.
Retrieve a runtime job.
Retrieve all runtime jobs, subject to optional filtering.
Clears authorization cache on the server.
Pretty print information about available runtime programs.
Retrieve a runtime program.
Return available runtime programs.
Execute the runtime program.
Sets a program’s visibility.
Upload a runtime program.