vfhe.util.gpu

Loads the CUDA extension, when the install has it and the machine a device.

The extension _vfhe_cuda exists in an install built where nvcc was found, and loads on its own: the engine bindings loads is the same with or without it. available() is the call every program may make. A module with kernels of its own reaches them through extension(), as vfhe.arith’s cuda backend does.

>>> from vfhe.util import gpu
>>> gpu.available()
False
vfhe.util.gpu.available() → bool

Reports whether a kernel can run here.

vfhe.util.gpu.check(error: int) → None

Raises RuntimeError with the runtime’s description when a kernel returned error.

vfhe.util.gpu.extension() → tuple[Any, Any]

Returns the extension’s ffi and lib, for a module’s own kernels.

Raises RuntimeError when no device is available.