Skip to content

Commit 8ddb806

Browse files
committed
WIP: Replace cuda_paths.py to achieve desired Search Priority — toolshed/run_cuda_bindings_path_finder.py passes but tests/test_path_finder_find_load.py does not.
1 parent 8479511 commit 8ddb806

File tree

7 files changed

+131
-775
lines changed

7 files changed

+131
-775
lines changed

cuda_bindings/cuda/bindings/_path_finder/README.md

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ strategy for locating NVIDIA shared libraries:
2525
with the handle to the library.
2626

2727
1. **Environment variables**
28-
- Relies on `CUDA_HOME`/`CUDA_PATH` environment variables if set.
28+
- Relies on `CUDA_HOME` or `CUDA_PATH` environment variables if set
29+
(in that order).
2930

3031
2. **NVIDIA Python wheels**
3132
- Scans all site-packages to find libraries installed via NVIDIA Python wheels.
@@ -34,41 +35,16 @@ strategy for locating NVIDIA shared libraries:
3435
- Falls back to native loader:
3536
- `dlopen()` on Linux
3637
- `LoadLibraryW()` on Windows
37-
- Conda environments are expected to be covered by OS default mechanisms:
38-
- Based on `$ORIGIN/../lib` `RPATH` on Linux
39-
- Based on `%CONDA_PREFIX%\Library\bin` on the system `PATH` on Windows
40-
41-
5. **System Installations**
42-
- Checks traditional system locations through these paths:
43-
- Linux: `/usr/local/cuda/lib64`
44-
- Windows: `C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y\bin`
45-
(where X.Y is the CTK version)
46-
- **Notably does NOT search**:
47-
- Versioned CUDA directories like `/usr/local/cuda-12.3`
48-
- Distribution-specific packages (RPM/DEB)
49-
EXCEPT Debian's `nvidia-cuda-toolkit`
38+
- CTK installations with system config updates are expected to be discovered:
39+
- Linux: Via `/etc/ld.so.conf.d/*cuda*.conf`
40+
- Windows: Via `C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y\bin` on system `PATH`
41+
- Conda installations are expected to be discovered:
42+
- Linux: Via `$ORIGIN/../lib` on `RPATH` (of the `python` binary)
43+
- Windows: Via `%CONDA_PREFIX%\Library\bin` on system `PATH`
5044

5145
Note that the search is done on a per-library basis. There is no centralized
5246
mechanism that ensures all libraries are found in the same way.
5347

54-
## Implementation Philosophy
55-
56-
The current implementation balances stability and evolution:
57-
58-
- **Baseline Foundation:** Uses a fork of numba-cuda's `cuda_paths.py` that has been
59-
battle-tested in production environments.
60-
61-
- **Validation Infrastructure:** Comprehensive CI testing matrix being developed to cover:
62-
- Various Linux/Windows environments
63-
- Python packaging formats (wheels, conda)
64-
- CUDA Toolkit versions
65-
66-
- **Roadmap:** Planned refactoring to:
67-
- Unify library discovery logic
68-
- Improve maintainability
69-
- Better enforce search priority
70-
- Expand platform support
71-
7248
## Maintenance Requirements
7349

7450
These key components must be updated for new CUDA Toolkit releases:

0 commit comments

Comments
 (0)