Repository navigation
Conversation
…t be obtained The 2.14.0 PEP 517 sdist cannot build with CUDA unless USE_SYSTEM_NCCL is set. Since pytorch#146073 NCCL is not a submodule but cloned at configure time from a tag read out of .ci/docker/ci_commit_pins/nccl*.txt. The sdist configuration from pytorch#190192 deliberately leaves third_party/nccl out (shipping a fetched tree would freeze the default pin even where the cu126 pin applies) and, in the same change, excludes all of .ci, which takes the pin files with it. cmake/PreBuildSteps.cmake then silently skips the clone, and the build dies later in cmake/External/nccl.cmake with ExternalProject's "No download info given for 'nccl_external'", which names neither the cause nor a way out. 2.13.0 was the last sdist that built, only because it still used setuptools and shipped the pre-cloned NCCL tree. The fix keeps the pytorch#190192 decision and makes the fetch work instead: the two pin files join the sdist include list, where an include match beats the .ci/** exclude. An sdist build now clones NCCL exactly like a git checkout does, with the CUDA-version-specific pin honoured. The second half is diagnostics. The pre-build step now warns when neither third_party/nccl nor a pin file exists, and nccl.cmake fails with a message naming the three ways out (provide the sources, set USE_SYSTEM_NCCL=1, or set USE_NCCL=0) before declaring the ExternalProject. The hard failure lives in nccl.cmake rather than in the pre-build step because the pre-build step runs before CUDA is decided: a CPU-only build from a tree without the pin must keep working, and making the pre-build step fatal would have broken it. Not addressed here: the plain pytorch-vX.tar.gz strips .ci as well and builds only because the release workflow pre-clones NCCL at the default pin, so a CUDA 12.6 build from it silently gets the default NCCL. Moving the pins out of .ci (as third_party/eigen_pin.txt already is) fixes both artifacts uniformly, but touches .ci/docker and therefore forces a Docker image rebuild; that is a follow-up, and this small change is the one to cherry-pick into a 2.14 patch release. Fixes pytorch#152532. Test Plan: sdist contents, built from this tree: ``` uv run --no-project --python 3.12 --with build python -m build --sdist --outdir /tmp/sdist-out . tar tzf /tmp/sdist-out/torch-*.tar.gz | grep -E '/\.ci/' # exactly the two nccl pin files tar tzf /tmp/sdist-out/torch-*.tar.gz | grep -c 'third_party/nccl/' # 0 ``` CMake behaviour, driven through a minimal project that includes the two files from a fake source tree (no third_party/nccl, no .ci): ``` cmake -S fake -B build -DUSE_SYSTEM_LIBS=ON # PreBuildSteps: warning, configure continues cmake -S fake -B build -DUSE_SYSTEM_LIBS=ON -DUSE_SYSTEM_NCCL=ON # silent cmake -S fake -B build -DUSE_SYSTEM_LIBS=ON -DUSE_NCCL=OFF # silent mkdir -p fake/third_party/nccl && cmake -S fake -B build -DUSE_SYSTEM_LIBS=ON # silent cmake -S fake-including-nccl.cmake -B build # fatal with the new message; passes once third_party/nccl/Makefile exists lintrunner pyproject.toml cmake/PreBuildSteps.cmake cmake/External/nccl.cmake ``` Authored with an AI assistant. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The plain pytorch-vX.tar.gz has stripped .ci since the workflow was added in pytorch#63022, with no recorded reason; since pytorch#146073 that directory holds the NCCL pins the configure step reads. The tarball builds today only because the workflow pre-clones third_party/nccl at the default pin (pytorch#156615), so a build that selects the cu126 pin gets the default NCCL without any notice, and a tree whose NCCL directory is removed cannot re-clone at all. Copy the two pin files back after the strip, so the tarball carries the same pins as the sdist (previous commit) and no other .ci content. The pre-cloned tree stays: the tarball exists for offline, complete source builds, and the pins make it self-describing for a later check of the clone against the selected pin. Test Plan: The staging lines run against a mock tree (.ci with pins plus an unrelated script, third_party/nccl, .gitmodules): the result holds exactly .ci/docker/ci_commit_pins/{nccl.txt,nccl-cu126.txt}, byte-identical to the source, no other .ci file, no .git* entries, and third_party/nccl intact. ``` lintrunner .github/workflows/create_release.yml ``` Not exercised here: the workflow itself, which only runs on release tags and nightly. Authored with an AI assistant. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/197544
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ You can merge normally! (2 Unrelated Failures)As of commit c4229d6 with merge base 1a70a6e ( CRCR (non-blocking) - The following CRCR downstream CI jobs failed but are non-blocking:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Agree with the idea but installing to .ci seems dangerous and error prone should we just move the pin somewhere for OSS easy enough. |
|
@Skylion007, I agree with that in principle and would like it as a follow-up PR (c.f. the description:
), but I think I was not clear enough why I did not do this here, so let me explain better. This PR is meant to fix purely the packaging issue to allow us to fix past releases by re-uploading without changes in the build code in a documented and coherent manner. The long-term fix is absolutely as you suggested. |
|
@pytorchmergebot merge -f "all looks good, lets merge" |
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 |
Fixes #152532.
Since #146073 NCCL is not a submodule but cloned at configure time from a tag in
.ci/docker/ci_commit_pins/nccl*.txt. Neither release source artifact has ever shipped those files: the plain tarball strips.ci(since #63022, no recorded reason) and the PEP 517 sdist excludes it (#190192). A survey of all 16 archives from v2.7.0 to v2.14.0 confirms this; what varies is only whetherthird_party/ncclis present. The 2.14.0 sdist is the first artifact since 2.7.x with neither, because #190192 also stopped shipping the pre-cloned NCCL tree (deliberately: a snapshot freezes the default pin even where the cu126 pin applies). Configure then fails incmake/External/nccl.cmakewith ExternalProject's "No download info given for 'nccl_external'", which names neither cause nor remedy.Two commits:
nccl.cmakefails with a message naming the ways out (provide the sources,USE_SYSTEM_NCCL=1, orUSE_NCCL=0). The fatal check lives innccl.cmakerather than the pre-build step because the latter runs before CUDA is decided; a CPU-only build from a pin-less tree keeps working..cistrip, so both artifacts carry the pins and nothing else from.ci. The pre-clonedthird_party/ncclstays: the tarball exists for offline, complete-source builds.Official wheels use system NCCL, so pip users are unaffected; this is for people building from the source archives. Small enough to cherry-pick into a 2.14 patch release.
Offered for this PR if wanted: a check in the pre-build step that compares an existing
third_party/nccl(itsmakefiles/version.mk) against the selected pin and warns on mismatch. That is what would make a cu126 build from the plain tarball notice it got the default NCCL, and it also catches a developer checkout whose clone predates a pin bump. Left out for now to keep the change minimal.Follow-up, separate PR: move the pins out of
.cinext tothird_party/eigen_pin.txt, which makes both include exceptions above unnecessary. It touchesinstall_nccl.shand five Dockerfiles under.ci/docker, so it forces a Docker image rebuild and should ride the next planned one.Test plan: see the commit messages. sdist built from this tree contains exactly
nccl.txtandnccl-cu126.txtunder.ci, byte-identical to the tree, and nothird_party/nccl; the CMake behaviour was driven through a minimal project in a fake source tree for all five cases; the tarball staging lines were run against a mock tree. Not exercised: the release workflow itself (release tags and nightly only) and an end-to-end CUDA build from the sdist.