From 0bd5a3fed772b58270224600fb901b551c6e3eaf Mon Sep 17 00:00:00 2001 From: atalman Date: Tue, 19 Dec 2023 13:53:08 +0000 Subject: [PATCH] [releng] Docker release Refactor Push nightly tags step. Move cuda and cudnn version to docker tag rather then name (#116097) Follow up after : https://github.com/pytorch/pytorch/pull/116070 This PR does 2 things. 1. Refactor Push nightly tags step, don't need to extract CUDA_VERSION anymore. New tag should be in this format: ``${PYTORCH_VERSION}-cuda$(CUDA_VERSION_SHORT)-cudnn$(CUDNN_VERSION)-runtime`` 2. Move cuda$(CUDA_VERSION_SHORT)-cudnn$(CUDNN_VERSION) from docker name to tag Pull Request resolved: https://github.com/pytorch/pytorch/pull/116097 Approved by: https://github.com/jeanschmidt --- .github/workflows/docker-release.yml | 5 +++-- docker.Makefile | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index a49a5189cbd..3081c787aef 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -114,10 +114,11 @@ jobs: - name: Push nightly tags if: ${{ github.event.ref == 'refs/heads/nightly' && matrix.image_type == 'runtime' }} run: | - PYTORCH_DOCKER_TAG="${PYTORCH_VERSION}-runtime" - CUDA_VERSION=$(python3 -c "import re;print(re.search('CUDA_VERSION\s+=\s+([0-9\.]+)',open('docker.Makefile').read())[1],end='')") + PYTORCH_DOCKER_TAG="${PYTORCH_VERSION}-cuda$(CUDA_VERSION_SHORT)-cudnn$(CUDNN_VERSION)-runtime" + PYTORCH_NIGHTLY_COMMIT=$(docker run ghcr.io/pytorch/pytorch-nightly:"${PYTORCH_DOCKER_TAG}" \ python -c 'import torch; print(torch.version.git_version[:7],end="")') + docker tag ghcr.io/pytorch/pytorch-nightly:"${PYTORCH_DOCKER_TAG}" \ ghcr.io/pytorch/pytorch-nightly:"${PYTORCH_NIGHTLY_COMMIT}-cu${CUDA_VERSION}" docker push ghcr.io/pytorch/pytorch-nightly:"${PYTORCH_NIGHTLY_COMMIT}-cu${CUDA_VERSION}" diff --git a/docker.Makefile b/docker.Makefile index 1053f2c91fc..0129ca447ab 100644 --- a/docker.Makefile +++ b/docker.Makefile @@ -1,16 +1,16 @@ DOCKER_REGISTRY ?= docker.io DOCKER_ORG ?= $(shell docker info 2>/dev/null | sed '/Username:/!d;s/.* //') DOCKER_IMAGE ?= pytorch -CUDA_VERSION_SHORT ?= 12.1 -CUDA_VERSION ?= 12.1.1 -CUDNN_VERSION ?= 8 -DOCKER_FULL_NAME = $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE)-cuda$(CUDA_VERSION_SHORT)-cudnn$(CUDNN_VERSION) +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.1 +CUDA_VERSION ?= 12.1.1 +CUDNN_VERSION ?= 8 BASE_RUNTIME = ubuntu:22.04 BASE_DEVEL = nvidia/cuda:$(CUDA_VERSION)-cudnn$(CUDNN_VERSION)-devel-ubuntu22.04 CMAKE_VARS ?= @@ -72,25 +72,25 @@ all: devel-image .PHONY: devel-image devel-image: BASE_IMAGE := $(BASE_DEVEL) -devel-image: DOCKER_TAG := $(PYTORCH_VERSION)-devel +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)-devel +devel-push: DOCKER_TAG := $(PYTORCH_VERSION)-cuda$(CUDA_VERSION_SHORT)-cudnn$(CUDNN_VERSION)-devel devel-push: $(DOCKER_PUSH) .PHONY: runtime-image runtime-image: BASE_IMAGE := $(BASE_RUNTIME) -runtime-image: DOCKER_TAG := $(PYTORCH_VERSION)-runtime +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)-runtime +runtime-push: DOCKER_TAG := $(PYTORCH_VERSION)-cuda$(CUDA_VERSION_SHORT)-cudnn$(CUDNN_VERSION)-runtime runtime-push: $(DOCKER_PUSH)