Transforms
Adapt quantum programs to specific hardware requirements.
In the qBraid-SDK, a “transpile” action refers to converting a quantum program from one type to another, such as from Qiskit to Amazon Braket. In contrast, a “transform” action involves modifying a quantum program to meet specific requirements dictated by the target device or API through which the program will be executed.
Let’s delve into the various “transforms” employed to prepare a quantum program for execution on an IonQ backend.
We begin by constructing a simple Qiskit circuit that executes a controlled Y rotation:
We then connect to the IonQProvider
and retrieve the specifications for the IonQ Harmony device:
By reviewing the device’s TargetProfile
, we understand that in order to run a program on IonQ Harmony,
qBraid runtime requires that it be expressed as an openqasm3.ast.Program
and utilize only the gates from
its defined basis gate set. Consequently, our first step is to transpile our qiskit
program to the openqasm3
program type:
Next, we load the program into a qBraid QuantumProgram
object and examine its string representation:
We can now apply a “transform” to this program, using our device object as argument, ensuring it is represented exclusively in terms of gates supported by IonQ Harmony:
Device-specific transforms are a crucial component of the qBraid runtime framework, applied as the final step before a program is executed on a quantum backend.
We’ve just demonstrated how one can utilize these transforms independently, outside of a runtime protocol, which
may be beneficial for testing or local simulations. However, for qBraid runtime end-users, these steps are automatically
performed behind the scenes whenever the QuantumDevice.run
method is invoked.