Compiling without Querying Quantinuum API¶
This notebook contains an example of how to investigate circuits compiled for Quantinuum hardware without logging in or submitting to Quantinuum hardware. This may be useful if it is desired to explore circuit compilation in depth before submitting.
Circuit Preparation¶
A 2-qubit circuit is generated for submission to H-Series.
from pytket.circuit import Circuit
circuit = Circuit(2, name="Bell Test")
circuit.H(0)
circuit.CX(0, 1)
circuit.measure_all()
from pytket.circuit.display import render_circuit_jupyter
render_circuit_jupyter(circuit)
Set up Backend¶
Set up a QuantinuumBackend
object. The difference is the machine_debug
option uses the default pytket-quantinuum
options such as pytket’s version of the Quantinuum native gate set rather than querying the Quantinuum API for this information.
from pytket.extensions.quantinuum import QuantinuumBackend
from pytket.extensions.quantinuum.backends.api_wrappers import QuantinuumAPIOffline
machine = "H1-1E"
backend = QuantinuumBackend(
device_name=machine, machine_debug=True, api_handler=QuantinuumAPIOffline()
)
Native Gate Set¶
End users can view the hard-coded native gate set for the Quantinuum backend using the following command.
backend._gate_set
Circuit Compilation¶
Circuits can now be compiled with the get_compiled_circuit
function without querying the Quantinuum API.
compiled_circuit = backend.get_compiled_circuit(circuit, optimisation_level=2)
render_circuit_jupyter(compiled_circuit)