-
Notifications
You must be signed in to change notification settings - Fork 283
[path_finder_dev] 2025-05-01 version of cuda.bindings.path_finder
#578
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
Merged
Changes from 51 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
17478da
Undo changes to the nvJitLink, nvrtc, nvvm bindings
rwgk 7da74bd
Undo changes under .github, specific to nvvm, manipulating LD_LIBRARY…
rwgk 211164d
PARTIALLY_SUPPORTED_LIBNAMES_LINUX, PARTIALLY_SUPPORTED_LIBNAMES_WINDOWS
rwgk a649e7d
Update EXPECTED_LIB_SYMBOLS for nvJitLink to cleanly support CTK vers…
rwgk b5cef1b
Save result of factoring out load_dl_common.py, load_dl_linux.py, loa…
rwgk bc0137a
Fix an auto-generated docstring
rwgk 001a6a2
first round of Cursor refactoring (about 4 iterations until all tests…
rwgk 9721079
Revert "first round of Cursor refactoring (about 4 iterations until a…
rwgk c409346
A couple trivial tweaks
rwgk 0cd20d8
Merge branch 'path_finder_dev' into path_finder_review1
rwgk b3a3b16
Prefix the public API (just two items) with underscores for now.
rwgk 42cb9b6
Merge branch 'main' into path_finder_review1
rwgk 180eefd
Add SPDX-License-Identifier to all files under toolshed/ that don't h…
rwgk bfc4b69
Add SPDX-License-Identifier under cuda_bindings/tests/
rwgk a7001e1
Respond to "Do these need to be run as subprocesses?" review question…
rwgk 4d95eb4
Respond to "dead code?" review questions (e.g. https://github.com/NVI…
rwgk 72c339a
Respond to "Do we need to implement a cache separately ..." review qu…
rwgk 4ce94be
Remove cuDriverGetVersion() function for now.
rwgk 26eb4b5
Move add_dll_directory() from load_dl_common.py to load_dl_windows.py…
rwgk 72d2567
Add SPDX-License-Identifier and # Forked from: URL in cuda_paths.py
rwgk e14391d
Add Add SPDX-License-Identifier and Original LICENSE in findlib.py
rwgk 9154995
Very first draft of README.md
rwgk bdfc6a7
Update README.md, mostly as revised by perplexity, with various manua…
rwgk 2279bda
Merge branch 'main' into path_finder_review1
rwgk 2ad4b79
Refork cuda_paths.py AS-IS: https://github.com/NVIDIA/numba-cuda/blob…
rwgk 7dcaa50
ruff format cuda_paths.py (NO manual changes)
rwgk 714b88c
Add back _get_numba_CUDA_INCLUDE_PATH from 2279bda65640b73a9a5632df87…
rwgk 166837d
Remove cuda_paths.py dependency on numba.cuda.cudadrv.runtime
rwgk ad1e85e
Add Forked from URLs, two SPDX-License-Identifier, Original Numba LIC…
rwgk 47ad79f
Temporarily restore debug changes under .github/workflows, for expand…
rwgk 1b88ec2
Restore cuda_path.py AS-IT-WAS at commit 2279bda65640b73a9a5632df878f…
rwgk db79ec3
Revert "Restore cuda_path.py AS-IT-WAS at commit 2279bda65640b73a9a56…
rwgk 2bc7ef6
Force compute-sanitizer off unconditionally
rwgk 7650b2e
Revert "Force compute-sanitizer off unconditionally"
rwgk b79e85b
Add timeout=10 seconds to test_path_finder.py subprocess.run() invoca…
rwgk f9a9e9f
Increase test_path_finder.py subprocess.run() timeout to 30 seconds:
rwgk 7f76683
Revert "Temporarily restore debug changes under .github/workflows, fo…
rwgk aeaf4f0
Force compute-sanitizer off unconditionally
rwgk 6a60161
Add: Note that the search is done on a per-library basis.
rwgk 3277ac5
Add Note for CUDA_HOME / CUDA_PATH
rwgk 1d4420b
Add 0. **Check if a library was loaded into the process already by so…
rwgk 4437fcc
_find_dll_using_nvidia_bin_dirs(): reuse lib_searched_for in place of…
rwgk fd20253
Systematically replace all relative imports with absolute imports.
rwgk 703988c
handle: int → ctypes.CDLL fix
rwgk 28349a7
Make load_dl_windows.py abs_path_for_dynamic_library() implementation…
rwgk c55104c
Change argument name → libname for self-consistency
rwgk b32ed13
Systematically replace previously overlooked relative imports with ab…
rwgk 92e7b42
Simplify code (also for self-consistency)
rwgk 5a835d7
Expand the 3. **System Installations** section with information produ…
rwgk b910a6b
Pull out `**Environment variables**` into an added section, after man…
rwgk 0fa2c83
Merge branch 'main' into path_finder_review1
rwgk fc22b1d
Revert "Force compute-sanitizer off unconditionally"
rwgk ad0d2f3
Merge branch 'main' into path_finder_review1
rwgk 5d970f2
Move _path_finder/sys_path_find_sub_dirs.py → find_sub_dirs.py, use f…
rwgk bf9734c
WIP (search priority updated in README.md but not in code)
rwgk b8ab986
Merge branch 'main' into path_finder_review1
rwgk 6aa1f13
Revert "WIP (search priority updated in README.md but not in code)"
rwgk 0a21021
Merge branch 'path_finder_dev' into path_finder_review1
rwgk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
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 |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # `cuda.bindings.path_finder` Module | ||
|
|
||
| ## Public API (Work in Progress) | ||
|
|
||
| Currently exposes two primary interfaces: | ||
|
|
||
| ``` | ||
| cuda.bindings.path_finder._SUPPORTED_LIBNAMES # ('nvJitLink', 'nvrtc', 'nvvm') | ||
| cuda.bindings.path_finder._load_nvidia_dynamic_library(libname: str) -> LoadedDL | ||
|
rwgk marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| **Note:** | ||
| These APIs are prefixed with an underscore because they are considered | ||
| experimental while undergoing active development, although already | ||
| reasonably well-tested through CI pipelines. | ||
|
|
||
| ## Library Loading Search Priority | ||
|
|
||
| The `load_nvidia_dynamic_library()` function implements a hierarchical search | ||
| strategy for locating NVIDIA shared libraries: | ||
|
rwgk marked this conversation as resolved.
|
||
|
|
||
|
rwgk marked this conversation as resolved.
rwgk marked this conversation as resolved.
|
||
| 0. **Check if a library was loaded into the process already by some other means.** | ||
| - If yes, there is no alternative to skipping the rest of the search logic. | ||
| 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. | ||
|
|
||
| 2. **Conda Environments** | ||
| - Leverages Conda-specific paths through our fork of `get_cuda_paths()` from Numba. | ||
|
|
||
| 3. **System Installations** | ||
| - Checks traditional system locations via the same `get_cuda_paths()` implementation. | ||
| — Note that `get_cuda_paths()` references `CUDA_HOME` and `CUDA_PATH`. The existing | ||
| mechanism are used as-is (see Implementation Philosophy below). | ||
|
kkraus14 marked this conversation as resolved.
Outdated
|
||
|
|
||
| 4. **OS Default Mechanisms** | ||
| - Falls back to native loader: | ||
| - `dlopen()` on Linux | ||
| - `LoadLibraryW()` on Windows | ||
|
|
||
| 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'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: | ||
|
|
||
| - `supported_libs.SUPPORTED_LIBNAMES` | ||
| - `supported_libs.SUPPORTED_WINDOWS_DLLS` | ||
| - `supported_libs.SUPPORTED_LINUX_SONAMES` | ||
| - `supported_libs.EXPECTED_LIB_SYMBOLS` | ||
Oops, something went wrong.
Oops, something went wrong.
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.