gpu.h¶
The CUDA extension’s runtime: whether a device is usable, and what an error means.
nvcc compiles every module’s .cu sources into _vfhe_cuda, an extension beside the engines, when the build finds a CUDA toolkit; the kernels are declared in their own modules’ headers. The CUDA runtime is linked statically, so the extension loads on a machine with no driver; vfhe_gpu_device_count() then returns 0 and every kernel returns an error.
Note
Thread-safe. The first call initialises the CUDA runtime, which takes a moment.
Functions
-
uint64_t vfhe_gpu_device_count(void)¶
Returns how many CUDA devices this machine can run kernels on.
- Returns:
The device count; 0 when the runtime finds no device or no driver.
-
const char *vfhe_gpu_error_string(int error)¶
Returns the CUDA runtime’s description of an error code.
- Parameters:
error – [in] A code a kernel returned.
- Returns:
A string owned by the runtime, valid for the life of the process.