Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 321
[path_finder_dev] path_finder Search Priority v2#604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rwgk
merged 23 commits into
NVIDIA:path_finder_dev
from
rwgk:path_finder_search_priority_v2May 6, 2025
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
8c9a2de
WIP (search priority updated in README.md but not in code)
rwgk 8479511
Merge branch 'path_finder_dev' into path_finder_search_priority_v2
rwgk 2cf3fa2
Completely replace cuda_paths.py to achieve the desired Search Priori…
rwgk 2b74022
Define `IS_WINDOWS = sys.platform == "win32"` in supported_libs.py
rwgk 27db0a7
Use os.path.samefile() to resolve issues with doubled backslashes.
rwgk e0a0143
Merge branch 'path_finder_dev' into path_finder_search_priority_v2
rwgk 1f728c0
`load_in_subprocess(): Pass current environment
rwgk 0d23bb6
Add run_python_code_safely.py as generated by perplexity, plus ruff f…
rwgk b1a5e9d
Replace subprocess.run with run_python_code_safely
rwgk 8e9c7b1
Factor out `class Worker` to fix pickle issue.
rwgk 5977b9d
ChatGPT revisions based on Deep research:
rwgk 9b474bc
Fix race condition in result queue handling by using timeout-based get()
rwgk ab00a87
Resolve SIM108
rwgk 2a039d2
Change to "nppc" as ANCHOR_LIBNAME
rwgk f978e67
Implement CUDA_PYTHON_CUDA_HOME_PRIORITY first, last, with default first
rwgk 782fcf6
Remove retry_with_anchor_abs_path() and make retry_with_cuda_home_pri…
rwgk 676ecb2
Update README.md to reflect new search priority
rwgk 73498c0
SUPPORTED_LINUX_SONAMES does not need updates for CTK 12.9.0
rwgk 7661c13
The only addition to SUPPORTED_WINDOWS_DLLS for CTK 12.9.0 is nvvm70.dll
rwgk ddea021
Make OSError in load_dl_windows.py abs_path_for_dynamic_library() mor…
rwgk 55583d9
run_cuda_bindings_path_finder.py: optionally use args as libnames (to…
rwgk a576327
Bug fix in load_dl_windows.py: ctypes.windll.kernel32.LoadLibraryW() …
rwgk 5fb2d1f
Remove _find_nvidia_dynamic_library.retry_with_anchor_abs_path() meth…
rwgk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -24,52 +24,27 @@ strategy for locating NVIDIA shared libraries: | ||
| The absolute path of the already loaded library will be returned, along | ||
| with the handle to the library. | ||
| 1. **Python Package Ecosystem** | ||
| - Scans `sys.path` to find libraries installed via NVIDIA Python wheels. | ||
| 1. **NVIDIA Python wheels** | ||
| - Scans all site-packages to find libraries installed via NVIDIA Python wheels. | ||
| 2. **Conda Environments** | ||
| - Leverages Conda-specific paths through our fork of `get_cuda_paths()` | ||
| from numba-cuda. | ||
| 3. **Environment variables** | ||
| - Relies on `CUDA_HOME`/`CUDA_PATH` environment variables if set. | ||
| 4. **System Installations** | ||
| - Checks traditional system locations through these paths: | ||
| - Linux: `/usr/local/cuda/lib64` | ||
| - Windows: `C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y\bin` | ||
| (where X.Y is the CTK version) | ||
| - **Notably does NOT search**: | ||
| - Versioned CUDA directories like `/usr/local/cuda-12.3` | ||
| - Distribution-specific packages (RPM/DEB) | ||
| EXCEPT Debian's `nvidia-cuda-toolkit` | ||
| 5. **OS Default Mechanisms** | ||
| 2. **OS default mechanisms / Conda environments** | ||
| - Falls back to native loader: | ||
| - `dlopen()` on Linux | ||
| - `LoadLibraryW()` on Windows | ||
| - CTK installations with system config updates are expected to be discovered: | ||
| - Linux: Via `/etc/ld.so.conf.d/*cuda*.conf` | ||
| - Windows: Via `C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y\bin` on system `PATH` | ||
| - Conda installations are expected to be discovered: | ||
rwgk marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| - Linux: Via `$ORIGIN/../lib` on `RPATH` (of the `python` binary) | ||
| - Windows: Via `%CONDA_PREFIX%\Library\bin` on system `PATH` | ||
| 3. **Environment variables** | ||
| - Relies on `CUDA_HOME` or `CUDA_PATH` environment variables if set | ||
| (in that order). | ||
| Note that the search is done on a per-library basis. There is no centralized | ||
| mechanism that ensures all libraries are found in the same way. | ||
| ## Implementation Philosophy | ||
| The current implementation balances stability and evolution: | ||
| - **Baseline Foundation:** Uses a fork of numba-cuda's `cuda_paths.py` that has been | ||
| battle-tested in production environments. | ||
| - **Validation Infrastructure:** Comprehensive CI testing matrix being developed to cover: | ||
| - Various Linux/Windows environments | ||
| - Python packaging formats (wheels, conda) | ||
| - CUDA Toolkit versions | ||
| - **Roadmap:** Planned refactoring to: | ||
| - Unify library discovery logic | ||
| - Improve maintainability | ||
| - Better enforce search priority | ||
| - Expand platform support | ||
| ## Maintenance Requirements | ||
| These key components must be updated for new CUDA Toolkit releases: | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.