Skip to content

pycauset.cuda.is_available

pycauset.cuda.is_available() -> bool

Returns True if a CUDA device is loaded and active in the current session.

This is not a hardware probe. It reports whether the CUDA backend is currently active (plugin loaded + device created). If you need to attempt activation, call pycauset.cuda.enable() first.

Installing the GPU backend

The GPU backend is opt-in. The base install is CPU-only; add the CUDA runtime (~500 MB) with:

pip install "pycauset[gpu]"

On a machine with an NVIDIA GPU but no GPU backend, import pycauset prints a one-line reminder with this command (silence it with PYCAUSET_GPU_HINT=0).

Returns

  • bool: Whether the CUDA backend is active.

Notes

  • The CUDA plugin may auto-load at import time if it is available, in which case is_available() can return True without an explicit enable.
  • If the plugin cannot be loaded, this returns False and routing is CPU-only.

Example

import pycauset as pc

if pc.cuda.is_available():
    print("CUDA is active")
else:
    pc.cuda.enable()
    print("CUDA active:", pc.cuda.is_available())

See also