transitlos.flex.backend¶
Where the heavy array work runs: on a CUDA GPU when one is usable, otherwise on the CPU.
device() 'cuda' or 'cpu' (environment variable TRANSITLOS_DEVICE = cpu | cuda | auto, default auto)
xp() the array module: CuPy on 'cuda', NumPy on 'cpu'
CuPy is imported lazily and only when needed; a missing package, a missing driver or a failing device all fall back to the CPU, never to an error.
device()
¶
"cuda" when CuPy and a usable GPU are found (and TRANSITLOS_DEVICE / FLEX_BACKEND allow it), else
"cpu"; decided once per process.
Returns:
| Type | Description |
|---|---|
str
|
The device name. |
xp()
¶
The array library for the current device: CuPy on "cuda", NumPy otherwise.
Returns:
| Type | Description |
|---|---|
|
The |