cuda.pathfinder.load_nvidia_dynamic_lib#

cuda.pathfinder.load_nvidia_dynamic_lib(
libname: str,
) LoadedDL#

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:

LoadedDL

Raises:
Search order:
  1. 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.

  2. NVIDIA Python wheels

    • Scan installed distributions (site-packages) to find libraries shipped in NVIDIA wheels.

  3. 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 the RPATH of the python binary (note: this can take precedence over LD_LIBRARY_PATH and /etc/ld.so.conf.d/).

      • Windows: %CONDA_PREFIX%\Library\bin on the system PATH.

    • 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 system PATH.

  4. Environment variables

    • If set, use CUDA_HOME or CUDA_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.