Files
pytorch/docker.Makefile
atalman 1e88a725f2 [BE] Drop CUDA < 12.6 support from CI/CD and raise the declared minimum (#192257)
`CUDA_ARCHES = ["12.6", "13.0", "13.2"]`, so nothing below 12.6 is built or
shipped any more. This removes the CI/CD leftovers and makes the minimum
explicit.

## Changes

| file | change |
|---|---|
| `cmake/public/cuda.cmake` | require CUDA **12.6**, was 12.1 |
| `.ci/docker/build.sh` | drop the `pytorch-linux-jammy-cuda12.4-cudnn9-py3-gcc11` image config |
| `.ci/docker/common/install_cuda.sh` | drop `install_124()` and its `12.4` dispatch arm |
| `.ci/docker/manywheel/Dockerfile_2_28` | `ARG BASE_CUDA_VERSION` default `11.8` → `12.6` |
| `docker.Makefile` | `CUDA_VERSION` `12.1.1` → `12.6.3`, `CUDA_VERSION_SHORT` `12.1` → `12.6` |
| `README.md` | Dockerfile prose said CUDA 12.1 |

### Notes on each

- **The 12.4 image config is orphaned.** `grep -rn "cuda12\.4" .github/ .ci/`
  returns only the definition in `build.sh` itself — no workflow and no
  `docker-builds.yml` entry ever requests it, so it has not been built. With it
  gone, `install_124()` has no remaining caller (verified: `grep -rn install_124`
  is empty after the change).
- **`docker.Makefile` was actively broken.** The 12.1 default made
  `CUDA_PATH = cu121`, and the Dockerfile installs torch from
  `download.pytorch.org/whl/$CUDA_PATH` — an index that no longer receives
  builds. 12.6.3 matches the version `install_126()` installs.
- **`ARG BASE_CUDA_VERSION=11.8`** was the only stale default in that file; the
  three other stages (`cuda`, `magma`, `cpu_final`) already default to 12.6.

## Scope

**Raising the cmake minimum narrows the source-build range**: building against
CUDA 12.1–12.5 now fails fast with `PyTorch requires CUDA 12.6 or above` instead
of compiling an untested configuration. That is the intended, user-visible part
of this change — flagging it explicitly for reviewers.

The **C++ `CUDA_VERSION` preprocessor guards are deliberately untouched.** There
are 34 such guard lines under 12060 in `aten/`, `torch/` and `c10/` (26 ×
`12040`, 4 × `12000`, 2 × `12030`, 1 × `12050`, 1 × `11060`). Removing those
branches touches kernel and runtime code and each site needs the correct branch
kept, so it belongs in its own reviewed change.

## Test plan

`bash -n` clean on both edited shell scripts. No dangling references to the
removed image config or install function. Nothing else in the tree selects CUDA
< 12.6.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/192257
Approved by: https://github.com/ngimel, https://github.com/tinglvv
2026-08-07 22:20:43 +00:00

127 lines
3.9 KiB
Makefile

DOCKER_REGISTRY ?= docker.io
DOCKER_ORG ?= $(shell docker info 2>/dev/null | sed '/Username:/!d;s/.* //')
DOCKER_IMAGE ?= pytorch
DOCKER_FULL_NAME = $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE)
ifeq ("$(DOCKER_ORG)","")
$(warning WARNING: No docker user found using results from whoami)
DOCKER_ORG = $(shell whoami)
endif
CUDA_VERSION_SHORT ?= 12.6
CUDA_VERSION ?= 12.6.3
CUDNN_VERSION ?= 9
BASE_RUNTIME = ubuntu:24.04
BASE_DEVEL = ubuntu:24.04
CMAKE_VARS ?=
# The conda channel to use to install cudatoolkit
CUDA_CHANNEL = nvidia
# The conda channel to use to install pytorch / torchvision
INSTALL_CHANNEL ?= whl
CUDA_PATH ?= cpu
ifneq ("$(CUDA_VERSION_SHORT)","cpu")
CUDA_PATH = cu$(subst .,,$(CUDA_VERSION_SHORT))
endif
PYTHON_VERSION ?= 3.11
# Match versions that start with v followed by a number, to avoid matching with tags like ciflow
PYTORCH_VERSION ?= $(shell git describe --tags --always --match "v[1-9]*.*")
# Can be either official / dev
BUILD_TYPE ?= dev
BUILD_PROGRESS ?= auto
# Intentionally left blank
TRITON_VERSION ?=
BUILD_ARGS = --build-arg BASE_IMAGE=$(BASE_IMAGE) \
--build-arg PYTHON_VERSION=$(PYTHON_VERSION) \
--build-arg CUDA_VERSION=$(CUDA_VERSION) \
--build-arg CUDA_PATH=$(CUDA_PATH) \
--build-arg PYTORCH_VERSION=$(PYTORCH_VERSION) \
--build-arg INSTALL_CHANNEL=$(INSTALL_CHANNEL) \
--build-arg TRITON_VERSION=$(TRITON_VERSION) \
--build-arg BUILD_TYPE=$(BUILD_TYPE) \
--build-arg CMAKE_VARS="$(CMAKE_VARS)"
EXTRA_DOCKER_BUILD_FLAGS ?=
BUILD ?= build
# Intentionally left blank
PLATFORMS_FLAG ?=
PUSH_FLAG ?=
USE_BUILDX ?=
BUILD_PLATFORMS ?=
WITH_PUSH ?= false
# Setup buildx flags
ifneq ("$(USE_BUILDX)","")
BUILD = buildx build
ifneq ("$(BUILD_PLATFORMS)","")
PLATFORMS_FLAG = --platform="$(BUILD_PLATFORMS)"
endif
# Only set platforms flags if using buildx
ifeq ("$(WITH_PUSH)","true")
PUSH_FLAG = --push
endif
endif
DOCKER_BUILD = docker $(BUILD) \
--progress=$(BUILD_PROGRESS) \
$(EXTRA_DOCKER_BUILD_FLAGS) \
$(PLATFORMS_FLAG) \
$(PUSH_FLAG) \
--target $(BUILD_TYPE) \
-t $(DOCKER_FULL_NAME):$(DOCKER_TAG) \
$(BUILD_ARGS) .
DOCKER_PUSH = docker push $(DOCKER_FULL_NAME):$(DOCKER_TAG)
.PHONY: all
all: devel-image
.PHONY: devel-image
devel-image: BASE_IMAGE := $(BASE_DEVEL)
devel-image: BUILD_TYPE := dev
devel-image: DOCKER_TAG := $(PYTORCH_VERSION)-cuda$(CUDA_VERSION_SHORT)-cudnn$(CUDNN_VERSION)-devel
devel-image:
$(DOCKER_BUILD)
.PHONY: devel-push
devel-push: BASE_IMAGE := $(BASE_DEVEL)
devel-push: DOCKER_TAG := $(PYTORCH_VERSION)-cuda$(CUDA_VERSION_SHORT)-cudnn$(CUDNN_VERSION)-devel
devel-push:
$(DOCKER_PUSH)
ifeq ("$(CUDA_VERSION_SHORT)","cpu")
.PHONY: runtime-image
runtime-image: BASE_IMAGE := $(BASE_RUNTIME)
runtime-image: BUILD_TYPE := official
runtime-image: DOCKER_TAG := $(PYTORCH_VERSION)-runtime
runtime-image:
$(DOCKER_BUILD)
.PHONY: runtime-push
runtime-push: BASE_IMAGE := $(BASE_RUNTIME)
runtime-push: DOCKER_TAG := $(PYTORCH_VERSION)-runtime
runtime-push:
$(DOCKER_PUSH)
else
.PHONY: runtime-image
runtime-image: BASE_IMAGE := $(BASE_RUNTIME)
runtime-image: BUILD_TYPE := official
runtime-image: DOCKER_TAG := $(PYTORCH_VERSION)-cuda$(CUDA_VERSION_SHORT)-cudnn$(CUDNN_VERSION)-runtime
runtime-image:
$(DOCKER_BUILD)
.PHONY: runtime-push
runtime-push: BASE_IMAGE := $(BASE_RUNTIME)
runtime-push: DOCKER_TAG := $(PYTORCH_VERSION)-cuda$(CUDA_VERSION_SHORT)-cudnn$(CUDNN_VERSION)-runtime
runtime-push:
$(DOCKER_PUSH)
endif
.PHONY: clean
clean:
-docker rmi -f $(shell docker images -q $(DOCKER_FULL_NAME))