-
Notifications
You must be signed in to change notification settings - Fork 77
fix: load the CUDA runtime on Windows, and never let the P2P probe be fatal #216
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
Open
an80sPWNstar
wants to merge
1
commit into
pollockjj:main
Choose a base branch
from
an80sPWNstar:fix/windows-cuda-runtime-p2p
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
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.
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.
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: pollockjj/ComfyUI-MultiGPU
Length of output: 13908
🏁 Script executed:
Repository: pollockjj/ComfyUI-MultiGPU
Length of output: 46584
🌐 Web query:
NVIDIA CUDA Linux libcudart.so.12 soname versioned library official documentation💡 Result:
In the context of the NVIDIA CUDA Toolkit on Linux, libcudart.so.12 is the SONAME for the CUDA Runtime shared library [1][2]. The SONAME (Shared Object Name) is a logical name used by the dynamic linker to identify the library version at runtime [3]. For CUDA 12.x releases, the SONAME is specifically libcudart.so.12 [1][2]. This ensures that applications linked against the CUDA 12 runtime can locate and load the library correctly at execution time, provided it is available in the system's library search path (e.g., LD_LIBRARY_PATH or /etc/ld.so.conf) [3][4]. Key Technical Details: - Versioning Strategy: The CUDA Runtime (libcudart) ABI is tied to the major release of the CUDA Toolkit [5]. Starting with CUDA 11.0, the major version is bumped with each major release [5]. Consequently, all minor and patch releases within the 12.x series share the same SONAME (libcudart.so.12), ensuring backward compatibility for the ABI within that major version [2][5]. - File vs. SONAME: While the SONAME is libcudart.so.12, the actual shared library file on disk typically includes a full version string (e.g., libcudart.so.12.x.xxx) [6][7]. The dynamic linker uses the SONAME as a symbolic link to this specific file [3]. - Development and Linking: During compilation, build systems link against the SONAME to ensure runtime compatibility [1][4]. Developers can verify the SONAME of a library file using the readelf command: readelf -d libcudart.so | grep SONAME [1][6]. Official documentation for specific CUDA versions, including installation guides and API references, can be found in the NVIDIA CUDA Documentation archive [8][9][10]. Official release notes also track the versioning of CUDA libraries across releases [11].
Citations:
🌐 Web query:
PyPI nvidia-cuda-runtime-cu12 libcudart.so.12 package contents official💡 Result:
The nvidia-cuda-runtime-cu12 package available on PyPI is an official NVIDIA-provided package [1][2] designed to provide CUDA runtime components for Python environments. Package Contents The package primarily contains the CUDA Runtime native libraries [1][2]. When installed, these libraries are placed within the Python site-packages directory, making the runtime environment (including files such as libcudart.so.12 on Linux) accessible to dependent applications and libraries like CuPy or other Python-based machine learning frameworks [3]. In addition to the runtime shared objects, the package also includes relevant header files required for runtime compilation, which are located in the include directory within the package's site-packages path [3]. Key Technical Details 1. Official Distribution: The package is published by the "Nvidia CUDA Installer Team" [1][2] and is available on the official PyPI index [1] and the NVIDIA NGC PyPI repository [4][5]. 2. Purpose: It acts as a mechanism to distribute the necessary CUDA runtime files required for Python-based projects without requiring a full system-wide installation of the CUDA Toolkit [3]. 3. Installation: It is commonly installed via pip [6][4] and is often used alongside other CUDA-related wheels to resolve dependencies for deep learning and computing tasks [7]. If you are specifically looking for the libcudart.so.12 library, it is bundled within the wheel archives for Linux platforms [8]. You can verify the presence and path of these files in your own environment after installation by checking the contents of the nvidia/cuda_runtime directory within your Python site-packages [3].
Citations:
🏁 Script executed:
Repository: pollockjj/ComfyUI-MultiGPU
Length of output: 687
🌐 Web query:
site:github.com/NVIDIA cuda-python libcudart.so.12 cuda_runtime lib explicit path💡 Result:
The
cuda-pythonlibrary uses an internal mechanism calledpathfinderto automatically discover and load CUDA runtime libraries likelibcudart.so.12[1][2]. Because this process is automated and cached, there is no direct, standard user API to force an "explicit path" for dynamic loading in the way one might manually usectypes.CDLL('/path/to/lib')[1][3]. Key details regarding library discovery: 1. Automatic Discovery Logic:pathfindersearches for libraries in a defined order, which typically includes: - Pythonsite-packages(wherenvidia-cuda-runtime-cuXXwheels are installed) [4][1]. -CUDA_HOMEorCUDA_PATHenvironment variables [5][6]. - System standard loader paths (e.g.,LD_LIBRARY_PATHon Linux,PATHon Windows) [1][2]. - A "CTK root canary probe" that attempts to locate the CUDA Toolkit installation by resolving the path of a known library (cudart) if it is already reachable [7]. 2. Why Explicit Paths are Challenged: - Thecuda.pathfinder.load_nvidia_dynamic_lib(libname)function, which performs the loading, is decorated withfunctools.cache[3]. This means it returns a shared, cached handle [3]. Manually attempting to load a library with a different, explicit path and then manually managing that handle can lead to conflicts, crashes, or failures to resolve symbols, as the library loader assumes control over the lifecycle of these handles [3]. - The library is designed to prioritize internal consistency by discovering libraries relative to the detected toolkit root rather than relying on manual, potentially conflicting path overrides [1][7]. If you are encountering issues withcuda-pythonfailing to find the correctlibcudart.so.12, the recommended approach is to ensure your environment is correctly configured: - Set theCUDA_HOMEorCUDA_PATHenvironment variable to the root of your desired CUDA Toolkit installation [5]. - Ensure the appropriate NVIDIA-provided Python wheels are installed in your current environment, as these are prioritized by the discovery logic [4][1]. - Avoid manually invokingdlcloseorFreeLibraryon handles returned bypathfinder, as this will destabilize the cached state [3].Citations:
load_with_system_searchtries to load old libraries first NVIDIA/cuda-python#839load_nvidia_dynamic_libresult implies "never close the handle". NVIDIA/cuda-python#1011Load versioned POSIX CUDA runtime libraries.
When the PyTorch probe is unavailable or fails,
_get_libcudart()tries only unversioned POSIX names. A system exposing onlylibcudart.so.12orlibcudart.so.11.0then returnsFalse, andcan_access_peer()caches that result. This forces CPU staging even when P2P is available.Add versioned sonames before the unversioned fallback. If NVIDIA CUDA runtime wheels are supported, also search their package library path; a bare soname does not find a wheel-local library unless that path is already configured in the dynamic linker.
🤖 Prompt for AI Agents