-
Notifications
You must be signed in to change notification settings - Fork 158
First 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
base: main
Are you sure you want to change the base?
Changes from all commits
147b242
7a0c068
32f6c76
74c9750
00f8e4d
17478da
7da74bd
211164d
a649e7d
b5cef1b
bc0137a
001a6a2
9721079
c409346
ceff853
0cd20d8
b3a3b16
42cb9b6
180eefd
bfc4b69
a7001e1
4d95eb4
72c339a
4ce94be
26eb4b5
72d2567
e14391d
9154995
bdfc6a7
2279bda
2ad4b79
7dcaa50
714b88c
166837d
ad1e85e
47ad79f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,8 @@ jobs: | |
} | ||
} | ||
|
||
"CUDA_BINDINGS_PATH_FINDER_TEST_ALL_LIBNAMES=1" >> $env:GITHUB_ENV | ||
|
||
# Make outputs from the previous job as env vars | ||
$CUDA_CORE_ARTIFACT_BASENAME = "cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ inputs.host-platform }}" | ||
"PYTHON_VERSION_FORMATTED=${PYTHON_VERSION_FORMATTED}" >> $env:GITHUB_ENV | ||
|
@@ -165,8 +167,7 @@ jobs: | |
uses: Jimver/[email protected] | ||
with: | ||
cuda: ${{ inputs.cuda-version }} | ||
method: 'network' | ||
sub-packages: ${{ env.MINI_CTK_DEPS }} | ||
method: 'local' | ||
|
||
- name: Update PATH | ||
if: ${{ inputs.local-ctk == '1' }} | ||
|
@@ -190,7 +191,7 @@ jobs: | |
|
||
Push-Location ./cuda_bindings | ||
pip install -r requirements.txt | ||
pytest -rxXs -v tests/ | ||
pytest -ra -s -v tests/ | ||
# skip Cython tests for now (NVIDIA/cuda-python#466) | ||
Pop-Location | ||
|
||
|
@@ -214,7 +215,7 @@ jobs: | |
|
||
Push-Location ./cuda_core | ||
pip install -r "tests/requirements-cu${TEST_CUDA_MAJOR}.txt" | ||
pytest -rxXs -v tests/ | ||
pytest -ra -s -v tests/ | ||
Pop-Location | ||
|
||
- name: Ensure cuda-python installable | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# `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 | ||
``` | ||
|
||
**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: | ||
Comment on lines
+19
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should clarify that the current behavior is that the search is done on a per library basis and that there is no centralized mechanism that ensures all libraries are found from the same location / installation method. I.E. if someone has a In the future we should probably not allow this behavior to occur, but for now we should probably clearly document that this is not behavior we intend to support in the future and is essentially undefined behavior as of now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW in nvmath-python docs we simplified what Keith said into: "Don't mix-n-match pip, conda, and system (installations of CUDA)" 😄 https://docs.nvidia.com/cuda/nvmath-python/latest/installation.html#troubleshooting |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we're missing using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, if someone has already loaded libraries via some other mechanism I think we end up finding those before going down any of these other search paths? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes this should be documented |
||
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 | ||
Comment on lines
+28
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you make this more explicit? Does this check |
||
|
||
4. **OS Default Mechanisms** | ||
- Falls back to native loader: | ||
- `dlopen()` on Linux | ||
- `LoadLibraryW()` on Windows | ||
|
||
## 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` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the path is correct