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 simulator

  • AerStateConfig: targets Qiskit Aer statevector simulator

  • AerUnitaryConfig: targets Qiskit Aer unitary simulator

  • BraketConfig: targets devices available through Amazon Braket

  • QuantinuumConfig: targets Quantinuum devices and emulators

  • IBMQConfig: targets devices available through IBMQ

  • IBMQEmulatorConfig: targets emulated devices available through IBMQ (uses a noise model for simulation)

  • ProjectQConfig: targets the ProjectQ simulator

  • QulacsConfig: targets the Qulacs simulator

import qnexus as qnx

from datetime import datetime
from pytket import Circuit
# Create a configuration to target the H1-1LE noiseless simulator
my_quantinuum_config = qnx.QuantinuumConfig(
    device_name="H1-1LE",
)
# Create a configuration to target the IBMQ Kyiv device through the open plan
my_ibmq_config = qnx.IBMQConfig(
    backend_name="ibm_kyiv",
    hub="ibm-q",
    group="open",
    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=f"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()}",
    circuits=[my_circuit_ref],
    backend_config=my_ibmq_config,
    project=my_project_ref,
)

compile_job_IBMQ.df()
# Run an ExecuteJob targeting the H1-1 Syntax Checker device

execute_job_H1_1LE = qnx.start_execute_job(
    name=f"My H1-1LE execution job from {datetime.now()}",
    circuits=[my_circuit_ref],
    n_shots=[1000],
    backend_config=my_quantinuum_config,
    project=my_project_ref,
)

execute_job_H1_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_shots

  • supports_counts

  • supports_state

  • supports_unitary

  • supports_density_matrix

  • supports_expectation

  • expectation_allows_nonhermitian

  • supports_contextual_optimisation

# Check if the H1-1LE simulator support shots
qnx.devices.supports_shots(
    qnx.QuantinuumConfig(device_name="H1-1LE")
)