The following example creates a simple Binary Quadratic Model and samples it on the Dynex neuromorphic GPU network:
import dyneximport dimodfrom dynex import DynexConfig, ComputeBackend# Build a simple BQM: minimize x0 + x1 with interaction penaltybqm = dimod.BinaryQuadraticModel( {0: -1.0, 1: -1.0}, {(0, 1): 2.0}, 0.0, 'BINARY')# Configure to use Dynex neuromorphic GPU chipsconfig = DynexConfig(compute_backend=ComputeBackend.GPU)# Wrap model and create samplermodel = dynex.BQM(bqm)sampler = dynex.DynexSampler(model, config=config, description="My first Dynex job")# Samplesampleset = sampler.sample(num_reads=1000, annealing_time=200)# Inspect resultsbest = sampleset.firstprint(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.