set_platform

static Config.set_platform(platform, device_id=0)

Set the simulation platform of jax to 'cpu' or 'gpu'.

Note

'cpu' is the safest default for small and medium-sized simulations, quick debugging, and workloads where JAX compilation overhead would dominate the actual runtime.

'gpu' is typically preferable for larger simulations, batched propagations, and repeated time-evolution workloads where the higher arithmetic throughput of JAX on GPU can outweigh compilation and data-transfer costs.

In practice, 'gpu' tends to be most useful when the Hilbert-space dimension is large, many propagators must be evaluated, or the same computation is executed repeatedly after JIT compilation. For one-off calculations or small models, 'cpu' may still be faster overall.

If the requested GPU backend is unavailable, Simphony falls back to 'cpu'.

Parameters:
  • platform (str) – Simulation platform of jax. Accepted case-insensitive values are 'cpu' and 'gpu'.

  • device_id (int | None) – GPU device id to expose via CUDA_VISIBLE_DEVICES. Defaults to 0 so a process only ever touches a single GPU by default – important resource hygiene on shared multi-GPU machines. Pass None to leave all GPUs visible instead (e.g. to place work on multiple devices from within the same process).