8000 [CD] Fix slim-wheel cuda_nvrtc import problem by atalman · Pull Request #145582 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[CD] Fix slim-wheel cuda_nvrtc import problem #145582

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[CD] Fix slim-wheel cuda_nvrtc import problem
  • Loading branch information
atalman committed Jan 24, 2025
commit f06e208e6fe09b86ebff9bf940b81fc56fdae4f2
7 changes: 4 additions & 3 deletions torch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,17 @@ def _load_global_deps() -> None:
# shipped as wheel, which results in OS picking wrong/older version of nvjitlink library
# if `LD_LIBRARY_PATH` is defined
# See https://github.com/pytorch/pytorch/issues/138460
if version.cuda not in ["12.4", "12.6"]: # type: ignore[name-defined]
return
# Similar issue as above exist for cuda_nvrtc for reference
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: exists

# See https://github.com/pytorch/pytorch/issues/145580
try:
with open("/proc/self/maps") as f:
_maps = f.read()
# libtorch_global_deps.so always depends in cudart, check if its installed via wheel
if "nvidia/cuda_runtime/lib/libcudart.so" not in _maps:
return
# If all abovementioned conditions are met, preload nvjitlink
# If all abovementioned conditions are met, preload nvjitlink and nvrtc
_preload_cuda_deps("nvjitlink", "libnvJitLink.so.*[0-9]")
_preload_cuda_deps("cuda_nvrtc", "libnvrtc.so.*[0-9]")
except Exception:
pass

Expand Down
Loading
0