Skip to content

[FEA]: Add per-library path override env var to cuda.pathfinder#1979

Open
rparolin wants to merge 2 commits intoNVIDIA:mainfrom
rparolin:feat/pathfinder-path-override
Open

[FEA]: Add per-library path override env var to cuda.pathfinder#1979
rparolin wants to merge 2 commits intoNVIDIA:mainfrom
rparolin:feat/pathfinder-path-override

Conversation

@rparolin
Copy link
Copy Markdown
Collaborator

@rparolin rparolin commented Apr 26, 2026

Summary

Closes #1054.

Adds CUDA_PATHFINDER_<LIBNAME_UPPER>_PATH_OVERRIDE as a developer escape hatch so users working on a development branch of a library (e.g. nvshmem) can point cuda.pathfinder at a custom build without having to uninstall the wheel or copy .so files into site-packages.

This implements option 1 from the issue (per-library override), which matches @kkraus14's later suggestion in the thread for a per-library, pathfinder-specific knob — and avoids the cross-cutting precedence concerns @leofang raised against a global TOP_PRIORITY_PATH.

Behavior

  • Env var name: CUDA_PATHFINDER_<LIBNAME_UPPER>_PATH_OVERRIDE
    • nvshmem_hostCUDA_PATHFINDER_NVSHMEM_HOST_PATH_OVERRIDE
    • cublasLtCUDA_PATHFINDER_CUBLASLT_PATH_OVERRIDE
  • Value: either an absolute file path (used as-is) or a directory (searched with the same platform logic as conda / CUDA_PATH).
  • Priority: highest. Runs before site-packages, conda, system search, CUDA_PATH, and the canary probe. Applies uniformly to CTK, third-party, and driver libraries.
  • Fail-loud: if the env var is set but the library cannot be resolved from the path, the load raises DynamicLibNotFoundError immediately rather than silently falling through. Silent fallthrough would be the actual debugging footgun — a typo or stale path should be loud.
  • found_via: tagged as override(CUDA_PATHFINDER_<LIB>_PATH_OVERRIDE) so the resolved source is distinguishable from site-packages, conda, etc.

Files

  • cuda_pathfinder/cuda/pathfinder/_dynamic_libs/search_steps.py — new find_via_path_override find step + path_override_env_var helper; prepended to EARLY_FIND_STEPS.
  • cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_nvidia_dynamic_lib.py — driver fast-path also honors the override; updated docstring.
  • cuda_pathfinder/tests/test_search_steps.py — 11 new unit tests.

🤖 Generated with Claude Code

Adds CUDA_PATHFINDER_<LIBNAME_UPPER>_PATH_OVERRIDE as a developer
escape hatch for pointing cuda.pathfinder at a custom build of a
specific library (e.g. a development branch of nvshmem) without
having to remove the wheel or copy .so files into site-packages.

The value can be either an absolute file path (used as-is) or a
directory (searched with the same platform logic as conda /
CUDA_PATH). The override has the highest priority and applies
uniformly to CTK, third-party, and driver libraries.

If the env var is set but the library cannot be resolved from it,
the load fails immediately rather than silently falling through to
other search steps. This keeps the override behavior explicit and
easy to debug.

Closes NVIDIA#1054.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rparolin rparolin added this to the cuda.pathfinder next milestone Apr 26, 2026
@rparolin rparolin added feature New feature or request cuda.pathfinder Everything related to the cuda.pathfinder module labels Apr 26, 2026
@rparolin rparolin requested a review from rwgk April 26, 2026 18:51
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rparolin rparolin self-assigned this Apr 26, 2026
@github-actions
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.pathfinder Everything related to the cuda.pathfinder module feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEA]: Ability to provide an extra path for cuda-pathfinder to search with high priority

1 participant