Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit 5b66f1e

Browse files
committed
Dockerfile.ubi: misc improvements
- get rid cuda-devel stage, use cuda 12.4 - add build flags - remove useless installs
1 parent f722b3e commit 5b66f1e

File tree

1 file changed

+10
-53
lines changed

1 file changed

+10
-53
lines changed

Dockerfile.ubi

Lines changed: 10 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ ARG PYTHON_VERSION=3.11
44

55
ARG TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.6 8.9 9.0+PTX"
66

7-
87
## Base Layer ##################################################################
98
FROM registry.access.redhat.com/ubi9/ubi-minimal:${BASE_UBI_IMAGE_TAG} as base
109
ARG PYTHON_VERSION
@@ -39,61 +38,19 @@ RUN microdnf install -y \
3938
## CUDA Base ###################################################################
4039
FROM python-install as cuda-base
4140

42-
# The Nvidia operator won't allow deploying on CUDA 12.0 hosts if
43-
# this env var is set to 12.2.0, even though it's compatible
44-
#ENV CUDA_VERSION=12.2.0 \
45-
ENV CUDA_VERSION=12.0.0 \
46-
NV_CUDA_LIB_VERSION=12.2.0-1 \
47-
NVIDIA_VISIBLE_DEVICES=all \
48-
NVIDIA_DRIVER_CAPABILITIES=compute,utility \
49-
NV_CUDA_CUDART_VERSION=12.2.53-1 \
50-
NV_CUDA_COMPAT_VERSION=535.104.12
51-
5241
RUN curl -Lo /etc/yum.repos.d/cuda-rhel9.repo \
5342
https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo
5443

5544
RUN microdnf install -y \
56-
cuda-cudart-12-2-${NV_CUDA_CUDART_VERSION} \
57-
cuda-compat-12-2-${NV_CUDA_COMPAT_VERSION} \
58-
&& microdnf clean all
45+
cuda-nvcc-12-4 cuda-nvtx-12-4 cuda-libraries-devel-12-4 && \
46+
microdnf clean all
5947

60-
61-
ARG CUDA_HOME="/usr/local/cuda"
62-
ENV CUDA_HOME=${CUDA_HOME}\
48+
ENV CUDA_HOME="/usr/local/cuda" \
6349
PATH="${CUDA_HOME}/bin:${PATH}" \
6450
LD_LIBRARY_PATH="${CUDA_HOME}/lib64:${CUDA_HOME}/extras/CUPTI/lib64:${LD_LIBRARY_PATH}"
6551

66-
67-
## CUDA Development ############################################################
68-
FROM cuda-base as cuda-devel
69-
70-
ENV NV_CUDA_CUDART_DEV_VERSION=12.2.53-1 \
71-
NV_NVML_DEV_VERSION=12.2.81-1 \
72-
NV_LIBCUBLAS_DEV_VERSION=12.2.1.16-1 \
73-
NV_LIBNPP_DEV_VERSION=12.1.1.14-1 \
74-
NV_LIBNCCL_DEV_PACKAGE_VERSION=2.18.5-1+cuda12.2
75-
76-
RUN microdnf install -y \
77-
cuda-command-line-tools-12-2-${NV_CUDA_LIB_VERSION} \
78-
cuda-libraries-devel-12-2-${NV_CUDA_LIB_VERSION} \
79-
cuda-minimal-build-12-2-${NV_CUDA_LIB_VERSION} \
80-
cuda-cudart-devel-12-2-${NV_CUDA_CUDART_DEV_VERSION} \
81-
cuda-nvml-devel-12-2-${NV_NVML_DEV_VERSION} \
82-
libcublas-devel-12-2-${NV_LIBCUBLAS_DEV_VERSION} \
83-
libnpp-devel-12-2-${NV_LIBNPP_DEV_VERSION} \
84-
libnccl-devel-${NV_LIBNCCL_DEV_PACKAGE_VERSION} \
85-
&& microdnf clean all
86-
87-
ENV LIBRARY_PATH="$CUDA_HOME/lib64/stubs"
88-
89-
# Workaround for https://github.com/openai/triton/issues/2507 and
90-
# https://github.com/pytorch/pytorch/issues/107960 -- hopefully
91-
# this won't be needed for future versions of this docker image
92-
# or future versions of triton.
93-
RUN ldconfig /usr/local/cuda-12.2/compat/
94-
9552
## Python cuda base #################################################################
96-
FROM cuda-devel AS python-cuda-base
53+
FROM cuda-base AS python-cuda-base
9754

9855
ENV VIRTUAL_ENV=/opt/vllm
9956
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
@@ -128,7 +85,8 @@ RUN --mount=type=cache,target=/root/.cache/pip \
12885
pip install -r requirements-build.txt
12986

13087
# install compiler cache to speed up compilation leveraging local or remote caching
131-
RUN rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && rpm -ql epel-release && microdnf install -y ccache && microdnf clean all
88+
# git is required for the cutlass kernels
89+
RUN rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && rpm -ql epel-release && microdnf install -y git ccache && microdnf clean all
13290
# install build dependencies
13391

13492
# copy input files
@@ -162,13 +120,12 @@ COPY vllm vllm
162120
ENV CCACHE_DIR=/root/.cache/ccache
163121
RUN --mount=type=cache,target=/root/.cache/ccache \
164122
--mount=type=cache,target=/root/.cache/pip \
165-
CMAKE_BUILD_TYPE=Release python3 setup.py bdist_wheel --dist-dir=dist
123+
env CFLAGS="-march=haswell" \
124+
CXXFLAGS="$CFLAGS $CXXFLAGS" \
125+
CMAKE_BUILD_TYPE=Release \
126+
python3 setup.py bdist_wheel --dist-dir=dist
166127

167128
## Release #####################################################################
168-
# Note from the non-UBI Dockerfile:
169-
# We used base cuda image because pytorch installs its own cuda libraries.
170-
# However pynccl depends on cuda libraries so we had to switch to the runtime image
171-
# In the future it would be nice to get a container with pytorch and cuda without duplicating cuda
172129
FROM python-install AS vllm-openai
173130

174131
WORKDIR /workspace

0 commit comments

Comments
 (0)