Skip to main content

Module loader

Module loader 

Source
Expand description

Dynamic CUDA driver library loader.

This module is the architectural foundation of oxicuda-driver. It locates and loads the CUDA driver shared library (libcuda.so on Linux, nvcuda.dll on Windows) at runtime via libloading, so that no CUDA SDK is required at build time.

§Platform support

PlatformLibrary names triedNotes
Linuxlibcuda.so.1, libcuda.soInstalled by NVIDIA driver
Windowsnvcuda.dllShips with the display driver
macOSReturns UnsupportedPlatform

§Usage

Application code should not interact with DriverApi directly. Instead, call try_driver to obtain a reference to the lazily- initialised global singleton:

let api = try_driver()?;
// api.cu_init, api.cu_device_get, …

The singleton is stored in a OnceLock so that the (relatively expensive) dlopen + symbol resolution only happens once, and all subsequent accesses are a single atomic load.

Structs§

DriverApi
Complete function-pointer table for the CUDA Driver API.

Functions§

try_driver
Get a reference to the lazily-loaded CUDA driver API function table.