Backend Configuration¶
A Backend is a loose term for a provider of a quantum computer or simulator.
Currently in Nexus these are specified by a BackendConfig, of which we offer the following types:
AerConfig: targets Qiskit Aer simulatorAerStateConfig: targets Qiskit Aer statevector simulatorAerUnitaryConfig: targets Qiskit Aer unitary simulatorBraketConfig: targets devices available through Amazon BraketQuantinuumConfig: targets Quantinuum devices and emulatorsIBMQConfig: targets devices available through IBMQIBMQEmulatorConfig: targets emulated devices available through IBMQ (uses a noise model for simulation)ProjectQConfig: targets the ProjectQ simulatorQulacsConfig: targets the Qulacs simulator
from datetime import datetime
from pytket import Circuit
import qnexus as qnx
# Create a configuration to target the H2-1LE noiseless simulator
my_quantinuum_config = qnx.QuantinuumConfig(
    device_name="H2-1LE",
)
# Create a configuration to target the IBMQ Kyiv device through the open plan
my_ibmq_config = qnx.IBMQConfig(
    instance="default-us",
    project="main",
)
BackendConfigs are a required parameter when running Jobs in Nexus.
my_project_ref = qnx.projects.get_or_create(name="My Nexus Project")
my_circuit_ref = qnx.circuits.upload(
    name="My Circuit",
    circuit=Circuit(2).H(0).CX(0, 1).measure_all(),
    project=my_project_ref,
)
# Run a CompileJob targeting an IBMQ device
compile_job_IBMQ = qnx.start_compile_job(
    name=f"My IBMQ compilation job from {datetime.now()}",
    programs=[my_circuit_ref],
    backend_config=my_ibmq_config,
    project=my_project_ref,
)
compile_job_IBMQ.df()
# Run an ExecuteJob targeting the H2-1 Syntax Checker device
execute_job_H2_1LE = qnx.start_execute_job(
    name=f"My H2-1LE execution job from {datetime.now()}",
    programs=[my_circuit_ref],
    n_shots=[1000],
    backend_config=my_quantinuum_config,
    project=my_project_ref,
)
execute_job_H2_1LE.df()
Information about a particular Backend¶
You can find out certain features of a backend as specified by a BackendConfig, these are boolean values for the following:
supports_shotssupports_countssupports_statesupports_unitarysupports_density_matrixsupports_expectationexpectation_allows_nonhermitiansupports_contextual_optimisation
# Check if the H2-1LE simulator support shots
qnx.devices.supports_shots(qnx.QuantinuumConfig(device_name="H2-1LE"))