-
Notifications
You must be signed in to change notification settings - Fork 158
EPIC: Path finder for CUDA components #451
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
Comments
cc @rwgk |
I expect our path finder is enough for these projects to drop the following code
|
Another question we need to answer is: In which module (binding or core) should we place the path finder? This seems like a high-level pythonic helper that is suitable for |
(discussed offline, tentatively slate this for beta 3, with the understanding that we might not make it) |
cc @cryos for vis (since you're also working on wheels) |
Tracking more relevant links to code that we want to offer an alternative for: |
Keith gave an expanded explanation on what's described in the epic body: #441 (comment). |
Tracking a related numba.cuda PR, for easy reference: NVIDIA/numba-cuda#155 |
It seems very straightforward to me. It'd be great to discuss. |
As of 2025-04-15 (808074d): These .so files exist under
These Windows .dll files are under https://developer.download.nvidia.com/compute/cuda/redist/ but are not supported by
|
I'm familiarizing myself with the content of https://developer.download.nvidia.com/compute/cuda/redist/ (to learn what .so and .dll files we have). A small side product: cuda/redist Matrix
|
Visual overview of shared library dependencies (GraphViz)
These were generated with: |
Tracking a key insight for easy future reference: I've verified that all CUDA libraries in version 12.8.1 (x86_64) have their Assuming this is the case for all 12.x releases, and future releases, this means we can reliably check if a shared library is already loaded by using the known import ctypes
import os
try:
handle = ctypes.CDLL("libnvvm.so.4", mode=os.RTLD_NOLOAD)
print("Library is already loaded.")
except OSError:
print("Library is not loaded yet.") According to ChatGPT, "this method is effective for standard system libraries and well-maintained third-party libraries that follow proper versioning practices." Full ChatGPT chat (very long) Script used to inspect
#!/bin/bash
find . -type f -name '*.so*' -print0 | while IFS= read -r -d '' f; do
type=$(test -L "$f" && echo SYMLINK || echo FILE)
soname=$(readelf -d "$f" 2>/dev/null | awk '/SONAME/ {gsub(/[][]/, "", $5); print $5; exit}')
echo "$f $type ${soname:-SONAME_NOT_SET}"
done |
Summary of
The first number is the count across all releases:
Commands used:
NOTE: The |
In 2025, there are many ways of installing CUDA to a Python environment. One key challenge here is that all header/library search logics implemented in the existing CUDA-enabled libraries (ex: #447) need to be modernized, taking into account that CUDA these days can be installed on a per-component basis (ex: I just want NVRTC and CCCL and nothing else). The consequence is that any prior arts that rely on checking if a certain piece exists (ex: nvcc, cuda.h, nvvm, ...) and generalizing it to assume the whole Toolkit exists based on known relative paths are no longer valid. Even Linux system package managers may not always behave as expected. (Though setting
CUDA_HOME
/CUDA_PATH
as a fallback might still be OK.)The CUDA Python team is well-positioned to take on the pain points so that all other Python libraries do not need to worry about packaging sources, layouts, and so on. It is our intention to support modern CUDA packages and deployment options in a JIT-compilation friendly way. What this means is that we should be able to return, on a per-component basis,
Something like (API design TBD)
This needs to cover
/usr/local/cuda
on Linux, as a fallbackOnce completed, this would also help us unify the treatment of loading shared libraries in
cuda.bindings
, which is currently divergent between Linux/Windows:The text was updated successfully, but these errors were encountered: