Skip to content
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

Added cu125 image to support Ubuntu 24.04 #3281

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 4 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# https://docs.docker.com/develop/develop-images/build_enhancements/


ARG BASE_IMAGE=ubuntu:rolling
ARG BASE_IMAGE=ubuntu:24.04

# Note:
# Define here the default python version to be used in all later build-stages as default.
Expand All @@ -25,10 +25,10 @@ ARG BASE_IMAGE=ubuntu:rolling
# that don't let the build fail, but break current version handling logic and result
# in images with wrong python version. To fix that, we will restate the ARG PYTHON_VERSION
# on each build-stage.
ARG PYTHON_VERSION=3.9
ARG PYTHON_VERSION=3.12

FROM ${BASE_IMAGE} AS compile-image
ARG BASE_IMAGE=ubuntu:rolling
ARG BASE_IMAGE=ubuntu:24.04
ARG PYTHON_VERSION
ARG BUILD_NIGHTLY
ARG BUILD_FROM_SRC
Expand All @@ -46,7 +46,6 @@ RUN --mount=type=cache,id=apt-dev,target=/var/cache/apt \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
ca-certificates \
g++ \
python3-distutils \
python$PYTHON_VERSION \
python$PYTHON_VERSION-dev \
python$PYTHON_VERSION-venv \
Expand Down Expand Up @@ -80,6 +79,7 @@ RUN \
WORKDIR "serve"

RUN cp docker/dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh
#RUN cp dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh

RUN \
if echo "$BASE_IMAGE" | grep -q "cuda:"; then \
Expand Down Expand Up @@ -120,7 +120,6 @@ RUN --mount=type=cache,target=/var/cache/apt \
apt remove python-pip python3-pip && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
python$PYTHON_VERSION \
python3-distutils \
python$PYTHON_VERSION-dev \
python$PYTHON_VERSION-venv \
# using openjdk-17-jdk due to circular dependency(ca-certificates) bug in openjdk-17-jre-headless debian package
Expand Down Expand Up @@ -166,7 +165,6 @@ RUN --mount=type=cache,target=/var/cache/apt \
apt remove python-pip python3-pip && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
python$PYTHON_VERSION \
python3-distutils \
python$PYTHON_VERSION-dev \
python$PYTHON_VERSION-venv \
# using openjdk-17-jdk due to circular dependency(ca-certificates) bug in openjdk-17-jre-headless debian package
Expand Down Expand Up @@ -221,7 +219,6 @@ RUN --mount=type=cache,target=/var/cache/apt \
git \
python$PYTHON_VERSION \
python$PYTHON_VERSION-dev \
python3-distutils \
python$PYTHON_VERSION-venv \
# using openjdk-17-jdk due to circular dependency(ca-certificates) bug in openjdk-17-jre-headless debian package
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1009905
Expand Down
5 changes: 5 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ Creates a docker image with `torchserve` and `torch-model-archiver` installed fr
./build_image.sh -bt dev -b my_branch
```

- For creating GPU based image with cuda version 12.5:

```bash
./build_image.sh -bt dev -g -cv cu125
```

- For creating GPU based image with cuda version 11.3:

Expand Down
29 changes: 16 additions & 13 deletions docker/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ BRANCH_NAME="master"
REPO_URL="https://github.com/pytorch/serve.git"
DOCKER_TAG="pytorch/torchserve:latest-cpu"
BUILD_TYPE="production"
BASE_IMAGE="ubuntu:20.04"
BASE_IMAGE="ubuntu:22.04"
UPDATE_BASE_IMAGE=false
USE_CUSTOM_TAG=false
CUDA_VERSION=""
Expand All @@ -17,7 +17,7 @@ BUILD_CPP=false
BUILD_NIGHTLY=false
BUILD_FROM_SRC=false
LOCAL_CHANGES=true
PYTHON_VERSION=3.9
PYTHON_VERSION=3.12

for arg in "$@"
do
Expand Down Expand Up @@ -68,7 +68,7 @@ do
-g|--gpu)
MACHINE=gpu
DOCKER_TAG="pytorch/torchserve:latest-gpu"
BASE_IMAGE="nvidia/cuda:12.1.1-base-ubuntu20.04"
BASE_IMAGE="nvidia/cuda:12.1.1-base-ubuntu22.04"
CUDA_VERSION="cu121"
shift
;;
Expand Down Expand Up @@ -124,27 +124,30 @@ do
LOCAL_CHANGES=false
shift
;;
# With default ubuntu version 20.04
# With default ubuntu version 22.04
-cv|--cudaversion)
CUDA_VERSION="$2"
if [ "${CUDA_VERSION}" == "cu121" ];
if [ "${CUDA_VERSION}" == "cu125" ];
then
BASE_IMAGE="nvidia/cuda:12.1.0-base-ubuntu20.04"
BASE_IMAGE="nvidia/cuda:12.5.1-runtime-ubuntu24.04"
elif [ "${CUDA_VERSION}" == "cu121" ];
then
BASE_IMAGE="nvidia/cuda:12.1.0-base-ubuntu22.04"
elif [ "${CUDA_VERSION}" == "cu118" ];
then
BASE_IMAGE="nvidia/cuda:11.8.0-base-ubuntu20.04"
BASE_IMAGE="nvidia/cuda:11.8.0-base-ubuntu22.04"
elif [ "${CUDA_VERSION}" == "cu117" ];
then
BASE_IMAGE="nvidia/cuda:11.7.1-base-ubuntu20.04"
BASE_IMAGE="nvidia/cuda:11.7.1-base-ubuntu22.04"
elif [ "${CUDA_VERSION}" == "cu116" ];
then
BASE_IMAGE="nvidia/cuda:11.6.0-cudnn8-runtime-ubuntu20.04"
BASE_IMAGE="nvidia/cuda:11.6.0-cudnn8-runtime-ubuntu22.04"
elif [ "${CUDA_VERSION}" == "cu113" ];
then
BASE_IMAGE="nvidia/cuda:11.3.0-cudnn8-runtime-ubuntu20.04"
BASE_IMAGE="nvidia/cuda:11.3.0-cudnn8-runtime-ubuntu22.04"
elif [ "${CUDA_VERSION}" == "cu111" ];
then
BASE_IMAGE="nvidia/cuda:11.1.1-cudnn8-runtime-ubuntu20.04"
BASE_IMAGE="nvidia/cuda:11.1.1-cudnn8-runtime-ubuntu22.04"
elif [ "${CUDA_VERSION}" == "cu102" ];
then
BASE_IMAGE="nvidia/cuda:10.2-cudnn8-runtime-ubuntu18.04"
Expand Down Expand Up @@ -203,10 +206,10 @@ then
then
if [ "${CUDA_VERSION}" == "cu121" ];
then
BASE_IMAGE="nvidia/cuda:12.1.1-devel-ubuntu20.04"
BASE_IMAGE="nvidia/cuda:12.1.1-devel-ubuntu22.04"
elif [ "${CUDA_VERSION}" == "cu118" ];
then
BASE_IMAGE="nvidia/cuda:11.8.0-devel-ubuntu20.04"
BASE_IMAGE="nvidia/cuda:11.8.0-devel-ubuntu22.04"
else
echo "Cuda version $CUDA_VERSION is not supported for CPP"
exit 1
Expand Down
1 change: 1 addition & 0 deletions ts_scripts/install_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ def get_brew_version():
"cu117",
"cu118",
"cu121",
"cu125",
],
help="CUDA version for torch",
)
Expand Down