Repository navigation
Conversation
CUDA Linux wheel builds now always use nvidia libs from pypi (small wheels) instead of conditionally bundling CUDA shared libraries. This removes the PYTORCH_EXTRA_INSTALL_REQUIREMENTS check from build_cuda.sh and the entire large-wheel bundling code path (~90 lines of DEPS_LIST entries). Static linking flags are set to 0 by default since we no longer need the bundling path. Also removes CUDA 12.8 and 12.9 from the CUDA arch version case statement as these versions are no longer shipped. Authored with Claude.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/180612
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 3 Cancelled JobsAs of commit dd654ec with merge base 5c3f8fd ( NEW FAILURE - The following job has failed:
CANCELLED JOBS - The following jobs were cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
| if [[ $CUDA_VERSION == 13* ]]; then | ||
| export TORCH_NVCC_FLAGS="$TORCH_NVCC_FLAGS -compress-mode=size" | ||
| fi | ||
| if [[ -z "$PYTORCH_EXTRA_INSTALL_REQUIREMENTS" ]]; then |
There was a problem hiding this comment.
If one expect to always have it defined, I would probably error out, probably at the start of the script
Address review feedback: since CUDA wheels now always depend on nvidia pypi packages, fail fast at the start of build_cuda.sh if PYTORCH_EXTRA_INSTALL_REQUIREMENTS is not defined rather than silently producing a wheel with missing runtime dependencies. Authored with Claude.
|
@pytorchmergebot merge -f "all looks good" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
This PR needs a
|
…8/12.9 (pytorch#180612) ## Summary - CUDA Linux wheel builds now always use nvidia libs from pypi (small wheels) instead of conditionally bundling CUDA shared libraries into the wheel - Removed the PYTORCH_EXTRA_INSTALL_REQUIREMENTS check from build_cuda.sh and the entire large-wheel bundling code path (~90 lines of DEPS_LIST/DEPS_SONAME entries for cudnn, cublas, nvrtc, cupti, etc.) - Static linking flags (USE_STATIC_CUDNN, USE_STATIC_NCCL, ATEN_STATIC_CUDA, USE_CUDA_STATIC_LINK) default to 0; USE_CUPTI_SO defaults to 1 - Removed CUDA 12.8 and 12.9 from the TORCH_CUDA_ARCH_LIST case statement as these versions are no longer shipped Note: PYTORCH_EXTRA_INSTALL_REQUIREMENTS is still used in setup.py, generate_binary_build_matrix.py, binary_populate_env.sh, and workflow templates to define and propagate pip install requirements — only the build_cuda.sh branching on it is removed. ## Test plan - Verify CUDA 12.6 manywheel build succeeds with small wheel RPATHs - Verify CUDA 13.0/13.2 manywheel builds succeed - Verify wheel installs correctly and finds nvidia pypi packages at runtime - Confirm CUDA 12.8/12.9 builds are not triggered in CI matrix Pull Request resolved: pytorch#180612 Approved by: https://github.com/malfet
…8/12.9 (pytorch#180612) ## Summary - CUDA Linux wheel builds now always use nvidia libs from pypi (small wheels) instead of conditionally bundling CUDA shared libraries into the wheel - Removed the PYTORCH_EXTRA_INSTALL_REQUIREMENTS check from build_cuda.sh and the entire large-wheel bundling code path (~90 lines of DEPS_LIST/DEPS_SONAME entries for cudnn, cublas, nvrtc, cupti, etc.) - Static linking flags (USE_STATIC_CUDNN, USE_STATIC_NCCL, ATEN_STATIC_CUDA, USE_CUDA_STATIC_LINK) default to 0; USE_CUPTI_SO defaults to 1 - Removed CUDA 12.8 and 12.9 from the TORCH_CUDA_ARCH_LIST case statement as these versions are no longer shipped Note: PYTORCH_EXTRA_INSTALL_REQUIREMENTS is still used in setup.py, generate_binary_build_matrix.py, binary_populate_env.sh, and workflow templates to define and propagate pip install requirements — only the build_cuda.sh branching on it is removed. ## Test plan - Verify CUDA 12.6 manywheel build succeeds with small wheel RPATHs - Verify CUDA 13.0/13.2 manywheel builds succeed - Verify wheel installs correctly and finds nvidia pypi packages at runtime - Confirm CUDA 12.8/12.9 builds are not triggered in CI matrix Pull Request resolved: pytorch#180612 Approved by: https://github.com/malfet
…8/12.9 (pytorch#180612) ## Summary - CUDA Linux wheel builds now always use nvidia libs from pypi (small wheels) instead of conditionally bundling CUDA shared libraries into the wheel - Removed the PYTORCH_EXTRA_INSTALL_REQUIREMENTS check from build_cuda.sh and the entire large-wheel bundling code path (~90 lines of DEPS_LIST/DEPS_SONAME entries for cudnn, cublas, nvrtc, cupti, etc.) - Static linking flags (USE_STATIC_CUDNN, USE_STATIC_NCCL, ATEN_STATIC_CUDA, USE_CUDA_STATIC_LINK) default to 0; USE_CUPTI_SO defaults to 1 - Removed CUDA 12.8 and 12.9 from the TORCH_CUDA_ARCH_LIST case statement as these versions are no longer shipped Note: PYTORCH_EXTRA_INSTALL_REQUIREMENTS is still used in setup.py, generate_binary_build_matrix.py, binary_populate_env.sh, and workflow templates to define and propagate pip install requirements — only the build_cuda.sh branching on it is removed. ## Test plan - Verify CUDA 12.6 manywheel build succeeds with small wheel RPATHs - Verify CUDA 13.0/13.2 manywheel builds succeed - Verify wheel installs correctly and finds nvidia pypi packages at runtime - Confirm CUDA 12.8/12.9 builds are not triggered in CI matrix Pull Request resolved: pytorch#180612 Approved by: https://github.com/malfet
Fixes the "libnvshmem_host.so.3 => not found" regression (#183971) in the CUDA libtorch shared-with-deps tarball. Root cause: libtorch is now assembled by extracting torch/lib/ from the pip wheel (#174753). The wheel is a "small wheel" (#180612): its NVIDIA runtime deps -- libnvshmem_host.so.3, libcudart.so.13, libcublas, libcudnn, ... -- are not in torch/lib/ but supplied at runtime by the pip nvidia-* packages via an RPATH into site-packages/nvidia/*/lib. The libtorch tarball has no such packages, so the extracted libtorch/lib/ shipped torch's own libtorch_nvshmem.so (which hard-NEEDs libnvshmem_host.so.3) with nothing to satisfy it. Fix: for linux CUDA shared-with-deps, bundle_cuda_deps() copies the required NVIDIA runtime libraries into libtorch/lib/ before the RPATH rewrite. It resolves NEEDED entries transitively starting from the torch libs, copying any soname that exists under the CUDA toolkit dirs in the builder container (/usr/local/cuda/lib64 and the CUPTI dir). Only libraries found there are copied, so base system libs and the driver stub (libcuda.so.1) are correctly left to the runtime environment. fix_rpath() then stamps $ORIGIN on the copied libs so the flat lib/ is self-resolving. This restores the pre-#180612 self-contained tarball while leaving the pip wheel untouched/small. Chose a transitive NEEDED resolver over reinstating the old hardcoded DEPS_LIST so it auto-adapts to CUDA version and the static->dynamic linking changes, and self-filters system libs by construction. smoke_test_extract_libtorch.py gains check_regression_deps(): if a consumer lib is present (libtorch_nvshmem.so / libtorch_cuda.so), its NVIDIA runtime dep (libnvshmem_host.so* / libcudart.so*) must be bundled -- a direct guard against this regression recurring. Test Plan: Local static checks (no CUDA builder / wheel available on this host): ``` python3 -m py_compile .ci/libtorch/extract_libtorch_from_wheel.py python3 -m py_compile .ci/libtorch/smoke_test_extract_libtorch.py ``` Full validation is the libtorch-extract CI job on a CUDA config: the log should show "Bundled CUDA dep: libnvshmem_host.so.3 ..." (plus cudart/cublas/cudnn), the smoke test's check_regression_deps must pass, and `ldd libtorch_nvshmem.so` on the extracted tree must not report libnvshmem_host.so.3 as not found. Authored with assistance from an AI coding assistant (Claude). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Fixes the "libnvshmem_host.so.3 => not found" regression (#183971) in the CUDA libtorch shared-with-deps tarball. Root cause: libtorch is now assembled by extracting torch/lib/ from the pip wheel (#174753). The wheel is a "small wheel" (#180612): its NVIDIA runtime deps -- libnvshmem_host.so.3, libcudart.so.13, libcublas, libcudnn, ... -- are not in torch/lib/ but supplied at runtime by the pip nvidia-* packages via an RPATH into site-packages/nvidia/*/lib. The libtorch tarball has no such packages, so the extracted libtorch/lib/ shipped torch's own libtorch_nvshmem.so (which hard-NEEDs libnvshmem_host.so.3) with nothing to satisfy it. Fix: for linux CUDA shared-with-deps, bundle_cuda_deps() copies the required NVIDIA runtime libraries into libtorch/lib/ before the RPATH rewrite. It resolves NEEDED entries transitively starting from the torch libs, copying any soname that exists under the CUDA toolkit dirs in the builder container (/usr/local/cuda/lib64 and the CUPTI dir). Only libraries found there are copied, so base system libs and the driver stub (libcuda.so.1) are correctly left to the runtime environment. fix_rpath() then stamps $ORIGIN on the copied libs so the flat lib/ is self-resolving. This restores the pre-#180612 self-contained tarball while leaving the pip wheel untouched/small. Chose a transitive NEEDED resolver over reinstating the old hardcoded DEPS_LIST so it auto-adapts to CUDA version and the static->dynamic linking changes, and self-filters system libs by construction. smoke_test_extract_libtorch.py: now that the deps are bundled, restore the full ctypes.CDLL("libtorch.so") load in check_load() -- it resolves the entire NEEDED chain through the $ORIGIN RPATH, so a missing or mis-rpath'd bundled lib fails the test. This was previously removed (it failed on CUDA when deps were not bundled); with bundling it works, and since libcuda.so.1 is dlopen'd lazily by cudart (not a load-time NEEDED) it succeeds on a driverless builder. check_regression_deps() is kept as a fast, explicit guard with a clear message if a consumer lib (libtorch_nvshmem.so / libtorch_cuda.so) is present without its bundled NVIDIA runtime dep. Test Plan: Local static checks (no CUDA builder / wheel available on this host): ``` python3 -m py_compile .ci/libtorch/extract_libtorch_from_wheel.py python3 -m py_compile .ci/libtorch/smoke_test_extract_libtorch.py ``` Full validation is the libtorch-extract CI job on a CUDA config: the log should show "Bundled CUDA dep: libnvshmem_host.so.3 ..." (plus cudart/cublas/cudnn), and the smoke test's check_load must load libtorch.so with no "not found". Authored with assistance from an AI coding assistant (Claude). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Fixes the "libnvshmem_host.so.3 => not found" regression (#183971) in the CUDA libtorch shared-with-deps tarball. Root cause: libtorch is now assembled by extracting torch/lib/ from the pip wheel (#174753). The wheel is a "small wheel" (#180612): its NVIDIA runtime deps -- libnvshmem_host.so.3, libcudart.so.13, libcublas, libcudnn, ... -- are not in torch/lib/ but supplied at runtime by the pip nvidia-* packages via an RPATH into site-packages/nvidia/*/lib. The libtorch tarball has no such packages, so the extracted libtorch/lib/ shipped torch's own libtorch_nvshmem.so (which hard-NEEDs libnvshmem_host.so.3) with nothing to satisfy it. Fix: for linux CUDA shared-with-deps, bundle_cuda_deps() copies the required NVIDIA runtime libraries into libtorch/lib/ before the RPATH rewrite. It resolves NEEDED entries transitively starting from the torch libs, copying any soname that exists under the CUDA toolkit dirs in the builder container (/usr/local/cuda/lib64 and the CUPTI dir). Only libraries found there are copied, so base system libs and the driver stub (libcuda.so.1) are correctly left to the runtime environment. fix_rpath() then stamps $ORIGIN on the copied libs so the flat lib/ is self-resolving. This restores the pre-#180612 self-contained tarball while leaving the pip wheel untouched/small. Chose a transitive NEEDED resolver over reinstating the old hardcoded DEPS_LIST so it auto-adapts to CUDA version and the static->dynamic linking changes, and self-filters system libs by construction. smoke_test_extract_libtorch.py is a single ctypes.CDLL("libtorch.so") load: it resolves the whole NEEDED chain through the $ORIGIN RPATH, so a missing or mis-rpath'd bundled dep (torch or NVIDIA runtime) fails the test. Full dlopen was previously dropped because it failed when deps were not bundled; with bundling it works, and since libcuda.so.1 is dlopen'd lazily by cudart (not a load-time NEEDED) it succeeds on a driverless builder. Test Plan: Local static checks (no CUDA builder / wheel available on this host): ``` python3 -m py_compile .ci/libtorch/extract_libtorch_from_wheel.py python3 -m py_compile .ci/libtorch/smoke_test_extract_libtorch.py ``` Full validation is the libtorch-extract CI job on a CUDA config: the log should show "Bundled CUDA dep: libnvshmem_host.so.3 ..." (plus cudart/cublas/cudnn), and the smoke test must load libtorch.so with no "not found". Authored with assistance from an AI coding assistant (Claude). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Fixes the "libnvshmem_host.so.3 => not found" regression (#183971) in the CUDA libtorch shared-with-deps tarball. Root cause: libtorch is now assembled by extracting torch/lib/ from the pip wheel (#174753). The wheel is a "small wheel" (#180612): its NVIDIA runtime deps -- libnvshmem_host.so.3, libcudart.so.13, libcublas, libcudnn, ... -- are not in torch/lib/ but supplied at runtime by the pip nvidia-* packages via an RPATH into site-packages/nvidia/*/lib. The libtorch tarball has no such packages, so the extracted libtorch/lib/ shipped torch's own libtorch_nvshmem.so (which hard-NEEDs libnvshmem_host.so.3) with nothing to satisfy it. Fix: for linux CUDA shared-with-deps, bundle_cuda_deps() copies the required NVIDIA runtime libraries into libtorch/lib/ before the RPATH rewrite. It resolves NEEDED entries transitively starting from the torch libs, copying any soname that exists under the CUDA toolkit dirs in the builder container (/usr/local/cuda/lib64 and the CUPTI dir). Only libraries found there are copied, so base system libs and the driver stub (libcuda.so.1) are correctly left to the runtime environment. fix_rpath() then stamps $ORIGIN on the copied libs so the flat lib/ is self-resolving. This restores the pre-#180612 self-contained tarball while leaving the pip wheel untouched/small. Chose a transitive NEEDED resolver over reinstating the old hardcoded DEPS_LIST so it auto-adapts to CUDA version and the static->dynamic linking changes, and self-filters system libs by construction. smoke_test_extract_libtorch.py is a single ctypes.CDLL("libtorch.so") load: it resolves the whole NEEDED chain through the $ORIGIN RPATH, so a missing or mis-rpath'd bundled dep (torch or NVIDIA runtime) fails the test. Full dlopen was previously dropped because it failed when deps were not bundled; with bundling it works, and since libcuda.so.1 is dlopen'd lazily by cudart (not a load-time NEEDED) it succeeds on a driverless builder. Test Plan: Local static checks (no CUDA builder / wheel available on this host): ``` python3 -m py_compile .ci/libtorch/extract_libtorch_from_wheel.py python3 -m py_compile .ci/libtorch/smoke_test_extract_libtorch.py ``` Full validation is the libtorch-extract CI job on a CUDA config: the log should show "Bundled CUDA dep: libnvshmem_host.so.3 ..." (plus cudart/cublas/cudnn), and the smoke test must load libtorch.so with no "not found". Authored with assistance from an AI coding assistant (Claude). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Summary
Note: PYTORCH_EXTRA_INSTALL_REQUIREMENTS is still used in setup.py, generate_binary_build_matrix.py, binary_populate_env.sh, and workflow templates to define and propagate pip install requirements — only the build_cuda.sh branching on it is removed.
Test plan