Skip to content

Commit

Permalink
added cd251 image per issue pytorch#3278
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonsmithio committed Aug 5, 2024
1 parent 3233f44 commit bbcf3e3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
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 @@ -45,7 +45,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 @@ -79,6 +78,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 @@ -119,7 +119,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 @@ -165,7 +164,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 @@ -220,7 +218,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 @@ -100,6 +100,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 @@ -6,7 +6,7 @@ MACHINE=cpu
BRANCH_NAME="master"
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 @@ -16,7 +16,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 @@ -54,7 +54,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 @@ -110,27 +110,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 @@ -189,10 +192,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

0 comments on commit bbcf3e3

Please sign in to comment.