# SETUP (common to all tutorials)
import fermioniq
client = fermioniq.Client() # Initialize the client (assumes environment variables are set)

import rich # Module for pretty printing
import nest_asyncio # Necessary only for Jupyter, can be omitted in .py files
nest_asyncio.apply()

4) Choosing different backends#

The emulator can be run with different backends. So far, everything has been running on CPU. Where the emulator really shines is running on GPUs.

To see the available backends, call the remote_configs() method.

# Get a list of available backends
backends = client.remote_configs()

for backend in backends:
    rich.print(backend)

The name of the desired backend should be specified when creating an EmulatorJob object. If no backend is specified, then the default one will be used (which currently is ‘default-cpu’).

For instance, to select the default GPU backend, and run the emulation on a GPU instance, we can do the following:

from qiskit import QuantumCircuit

def qiskit_bell_pair():
    circuit = QuantumCircuit(2)
    circuit.h(0)
    circuit.cx(0, 1)
    return circuit

# Requires the qiskit module
circuit = qiskit_bell_pair()

# Create the job, specifying the name of the backend
emulator_job_gpu = fermioniq.EmulatorJob(circuit=circuit, remote_config='gpu-12gb')

# Run the job (note that it may take longer than usual, due to some overhead involved in preparing a GPU instance)
result = client.schedule_and_wait(emulator_job_gpu)

# You should see in the result metadata that the job was GPU accelerated
rich.print(result)

There are several available GPU backends, each taking a different fraction of an H100, the smallest one being ‘gpu-12gb’. In general, emulations involving bigger bond dimensions or more qubits requires more memory.