# 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 ‘cpu’).

To 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-h100')

# 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)