cuda.pathfinder.load_nvidia_dynamic_lib#
- cuda.pathfinder.load_nvidia_dynamic_lib(
- libname: str,
Load an NVIDIA dynamic library by name.
- Parameters:
libname (str) – The short name of the library to load (e.g.,
"cudart"
,"nvvm"
, etc.).- Returns:
Object containing the OS library handle and absolute path.
- Return type:
- Raises:
DynamicLibNotFoundError – If the library cannot be found or loaded.
RuntimeError – If Python is not 64-bit.
- Search order:
Already loaded in the current process
If a matching library is already loaded by some other component, return its absolute path and handle and skip the rest of the search.
NVIDIA Python wheels
Scan installed distributions (
site-packages
) to find libraries shipped in NVIDIA wheels.
OS default mechanisms / Conda environments
Fall back to the native loader:
Linux:
dlopen()
Windows:
LoadLibraryW()
Conda installations are commonly discovered via:
Linux:
$ORIGIN/../lib
in theRPATH
of thepython
binary (note: this can take precedence overLD_LIBRARY_PATH
and/etc/ld.so.conf.d/
).Windows:
%CONDA_PREFIX%\Library\bin
on the systemPATH
.
CUDA Toolkit (CTK) system installs with system config updates are often discovered via:
Linux:
/etc/ld.so.conf.d/*cuda*.conf
Windows:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y\bin
on the systemPATH
.
Environment variables
If set, use
CUDA_HOME
orCUDA_PATH
(in that order).
Notes
The search is performed per library. There is currently no mechanism to guarantee that multiple libraries are all resolved from the same location.