Skip to main content

Prerequisites

Install

pip install dynex

Configure credentials

Set your SDK key as an environment variable, or create a .env file in your project root:
# .env
DYNEX_SDK_KEY=your_sdk_key_here
DYNEX_GRPC_ENDPOINT=quantum-router-engine-grpc.hz.dynex.co:3000
Install python-dotenv to auto-load .env files: pip install python-dotenv

Your first annealing job

The following example creates a simple Binary Quadratic Model and samples it on the Dynex neuromorphic GPU network:
import dynex
import dimod
from dynex import DynexConfig, ComputeBackend

# Build a simple BQM: minimize x0 + x1 with interaction penalty
bqm = dimod.BinaryQuadraticModel(
    {0: -1.0, 1: -1.0},
    {(0, 1): 2.0},
    0.0,
    'BINARY'
)

# Configure to use Dynex neuromorphic GPU chips
config = DynexConfig(compute_backend=ComputeBackend.GPU)

# Wrap model and create sampler
model = dynex.BQM(bqm)
sampler = dynex.DynexSampler(model, config=config, description="My first Dynex job")

# Sample
sampleset = sampler.sample(num_reads=1000, annealing_time=200)

# Inspect results
best = sampleset.first
print(f"Best sample:  {best.sample}")
print(f"Best energy:  {best.energy}")
ComputeBackend.GPU is the primary Dynex backend — your job runs on Dynex’s own neuromorphic GPU chips distributed globally. For offline testing without credentials, use ComputeBackend.LOCAL with the local solver binary.

Your first quantum circuit

Run a PennyLane circuit on Dynex using the DynexCircuit class:
import pennylane as qml
from dynex import DynexConfig, ComputeBackend, DynexCircuit

# Define a simple 2-qubit circuit
def bell_circuit(params):
    qml.Hadamard(wires=0)
    qml.CNOT(wires=[0, 1])
    return qml.state()

# Configure QPU backend
config = DynexConfig(
    compute_backend=ComputeBackend.QPU,
    qpu_model='apollo_rc1'
)

dynex_circuit = DynexCircuit(config=config)
result = dynex_circuit.execute(
    bell_circuit,
    params=[],
    wires=2,
    method='measure'
)
print("Circuit result:", result)

Next steps