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

AMD Dockerfile additions #168

Merged
merged 3 commits into from
Sep 27, 2024
Merged
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
31 changes: 29 additions & 2 deletions Dockerfile.rocm.ubi
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,29 @@ ENV VLLM_INSTALL_PUNICA_KERNELS=1
RUN --mount=type=cache,target=/root/.cache/ccache \
--mount=type=cache,target=/root/.cache/pip \
--mount=type=cache,target=/root/.cache/uv \
env CFLAGS="-march=haswell" \
CXXFLAGS="$CFLAGS $CXXFLAGS" \
CMAKE_BUILD_TYPE=Release \
uv pip install -v -U \
ninja "cmake>=3.26" packaging && \
python3 setup.py bdist_wheel --dist-dir=dist

#################### libsodium Build IMAGE ####################
FROM rocm_base as libsodium-builder

RUN microdnf install -y gcc gzip tar \
&& microdnf clean all

WORKDIR /usr/src/libsodium

ARG LIBSODIUM_VERSION=1.0.20
RUN curl -LO https://github.com/jedisct1/libsodium/releases/download/${LIBSODIUM_VERSION}-RELEASE/libsodium-${LIBSODIUM_VERSION}.tar.gz \
&& tar -xzvf libsodium*.tar.gz \
&& rm -f libsodium*.tar.gz \
&& mv libsodium*/* ./

RUN CFLAGS="-O3 -Wall -Werror=format-security -Wno-unused-function -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection"\ ./configure --prefix="/usr/" --libdir=/usr/lib64 && make -j $MAX_JOBS && make check

##################################################################################################

FROM rocm_base AS vllm-openai
Expand All @@ -162,6 +181,11 @@ ENV PATH=$VIRTUAL_ENV/bin:$PATH
RUN microdnf install -y --setopt=install_weak_deps=0 --nodocs gcc && \
microdnf clean all

# Install libsodium for Tensorizer encryption
RUN --mount=type=bind,from=libsodium-builder,src=/usr/src/libsodium,target=/usr/src/libsodium \
cd /usr/src/libsodium \
&& make install

RUN --mount=type=bind,from=build_amdsmi,src=/install,target=/install/amdsmi/ \
--mount=type=bind,from=build_flashattention,src=/install,target=/install/flashattention \
--mount=type=bind,from=build_vllm,src=/workspace/dist,target=/install/vllm/ \
Expand All @@ -178,7 +202,9 @@ RUN --mount=type=bind,from=build_amdsmi,src=/install,target=/install/amdsmi/ \
RUN umask 002 && \
useradd --uid 2000 --gid 0 vllm && \
mkdir -p /licenses && \
chmod g+rwx $HOME /usr/src /workspace
chmod g+rwx $HOME /usr/src /workspace && \
RH-steve-grubb marked this conversation as resolved.
Show resolved Hide resolved
chmod 0775 /var/log/rocm_smi_lib && \
chmod 0664 /var/log/rocm_smi_lib/*

COPY LICENSE /licenses/vllm.md
COPY examples/*.jinja /app/data/template/
Expand All @@ -199,7 +225,8 @@ ENV HF_HUB_OFFLINE=1 \
FLASH_ATTENTION_USE_TRITON_ROCM="TRUE" \
OUTLINES_CACHE_DIR=/tmp/outlines \
NUMBA_CACHE_DIR=/tmp/numba \
TRITON_CACHE_DIR=/tmp/triton
TRITON_CACHE_DIR=/tmp/triton \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/vllm/lib/python3.12/site-packages/pillow.libs/:/opt/vllm/lib/python3.12/site-packages/numpy.libs/"

# Switch to the non-root user
USER 2000
Expand Down
Loading