cuda.pathfinder.find_nvidia_binary_utility#
- cuda.pathfinder.find_nvidia_binary_utility(utility_name: str) str | None#
Locate a CUDA binary utility executable.
- Parameters:
utility_name (str) – The name of the binary utility to find (e.g.,
"nvdisasm","cuobjdump"). On Windows, the.exeextension will be automatically appended if not present. The function also recognizes.batand.cmdfiles on Windows.- Returns:
Absolute path to the discovered executable, or
Noneif the utility cannot be found. The returned path is normalized (absolute and with resolved separators).- Return type:
str or None
- Raises:
UnsupportedBinaryError – If
utility_nameis not in the supported set (seeSUPPORTED_BINARY_UTILITIES).RuntimeError – If a native Windows architecture needed for an architecture-specific utility layout cannot be determined, or an installed Nsight product has incomplete or invalid registry data.
- Windows on ARM (WoA) Note:
Binary utilities execute in separate processes and do not need to match the Python process architecture. When choosing among architecture-specific Windows layouts, this API deliberately targets the native machine architecture rather than the Python interpreter architecture. For example, standalone
nsysandncudiscovery under x64 Python on an Arm64 machine selects the Arm64 target. This differs fromload_nvidia_dynamic_libandfind_static_lib, which target the Python interpreter architecture.- Search order:
NVIDIA Python wheels
Scan installed distributions (
site-packages) for binary layouts shipped in NVIDIA wheels (e.g.,cuda-nvcc).
Conda environments
Check Conda-style installation prefixes via
CONDA_PREFIXenvironment variable, which use platform-specific bin directory layouts (Library/binon Windows,binon Linux).
Library-specific standalone installations
Search the installation paths for the CUDA Toolkit, Nsight Systems, and Nsight Compute.
- 3.1. Nsight installations: On Windows, locate Nsight Systems and
Nsight Compute from their installer registry entries. Select architecture-specific binaries using the native machine architecture, independent of Python. Lookup of the standalone
nsysandncuCLIs is terminal; a miss does not fall through to CUDA Toolkit locations.- 3.2. CUDA Toolkit installation: Use
CUDA_PATHorCUDA_HOME (in that order), searching
bin/x64,bin/x86_64, andbinsubdirectories on Windows, or justbinon Linux.
CTK-root canary fallback
For utilities that reach this step after the earlier searches miss, resolve the
cudartlibrary through the OS dynamic loader, derive the CUDA Toolkit root from it, and search that root’s bin layout.
Note
Results are cached using
@functools.cachefor performance. The cache persists for the lifetime of the process.On Windows, executables are identified by their file extensions (
.exe,.bat,.cmd). On Unix-like systems, executables are identified by theX_OK(execute) permission bit.Lookup is restricted to the trusted directories and the canary-derived CTK root listed above.
Example
>>> from cuda.pathfinder import find_nvidia_binary_utility >>> nvdisasm = find_nvidia_binary_utility("nvdisasm") >>> if nvdisasm: ... print(f"Found nvdisasm at: {nvdisasm}")