Commit 06c10bba authored by Harrison Saturley-Hall's avatar Harrison Saturley-Hall Committed by GitHub
Browse files

ci: enable copy-pr-bot, change trigger for internal CI, and optimizations for public CI (#203)

parent 21b795e8
enabled: true
\ No newline at end of file
......@@ -26,7 +26,8 @@ on:
jobs:
build-test:
runs-on: ${{ fromJSON(vars.PR_FASTCHECK_RUNNERS) }}
runs-on:
group: Fastchecker
strategy:
matrix:
framework:
......@@ -40,36 +41,15 @@ jobs:
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Define Image Tag
id: define_image_tag
run: |
echo "image_tag=${{ steps.login-ecr.outputs.registry }}/${{ github.repository }}:latest-${{ matrix.framework }}" >> $GITHUB_OUTPUT
- name: Decide on cache
id: which_caches
run: |
set +e
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "Not pushing to container image cache"
echo "cache_to_location=" >> $GITHUB_OUTPUT
else
echo "Pushing ${{ steps.define_image_tag.outputs.image_tag }} to container image cache"
echo "cache_to_location=--cache-to \"type=registry,ref=${{ steps.define_image_tag.outputs.image_tag }},image-manifest=true,mode=max\"" >> $GITHUB_OUTPUT
fi
echo "cache_from_location=--cache-from \"type=registry,ref=${{ steps.define_image_tag.outputs.image_tag }}\"" >> $GITHUB_OUTPUT
echo "image_tag=dynamo:latest-${{ matrix.framework }}" >> $GITHUB_OUTPUT
- name: Build image
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
run: |
./container/build.sh --tag ${{ steps.define_image_tag.outputs.image_tag }} --target dev --framework ${{ matrix.framework }} ${{ steps.which_caches.outputs.cache_from_location }} ${{ steps.which_caches.outputs.cache_to_location }}
./container/build.sh --tag ${{ steps.define_image_tag.outputs.image_tag }} --target ci_minimum --framework ${{ matrix.framework }}
- name: Run pytest
env:
PYTEST_MARKS: "pre_merge or mypy"
......
......@@ -19,8 +19,7 @@ on:
push:
branches:
- main
pull_request:
- "pull-request/[0-9]+"
jobs:
mirror_repo:
......
......@@ -7,6 +7,8 @@ ARG BASE_IMAGE_TAG="25.01-cuda12.8-devel-ubuntu24.04"
ARG RUNTIME_IMAGE="nvcr.io/nvidia/cuda"
ARG RUNTIME_IMAGE_TAG="12.8.1-runtime-ubuntu24.04"
ARG GENAI_PERF_TAG="25d0188713adc47868d6b3f22426375237a90529"
FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG} AS nixl_base
WORKDIR /opt/nixl
# Add a cache hint that only changes when the nixl commit changes
......@@ -16,8 +18,11 @@ RUN echo "NIXL commit: ${NIXL_COMMIT}" > /opt/nixl/commit.txt
# Copy the nixl source
COPY --from=nixl . .
# Main build stage
FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG} AS dev
##################################
########## Build Image ###########
##################################
FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG} AS build
USER root
......@@ -83,16 +88,6 @@ RUN cd /usr/local/src && \
./DEBS/libibverbs* ./DEBS/ibverbs-providers* ./DEBS/librdmacm* ./DEBS/libibumad* && \
rm -rf /var/lib/apt/lists/* /usr/local/src/* mofed.tgz
# Build and install Perf Analyzer for benchmarking
RUN apt-get update -y && apt-get -y install rapidjson-dev zlib1g-dev
RUN git clone https://github.com/triton-inference-server/perf_analyzer.git
ARG GENAI_PERF_TAG="25d0188713adc47868d6b3f22426375237a90529"
RUN git -C perf_analyzer checkout ${GENAI_PERF_TAG}
RUN mkdir perf_analyzer/build
RUN cmake -B perf_analyzer/build -S perf_analyzer -D TRITON_ENABLE_PERF_ANALYZER_OPENAI=ON
RUN cmake --build perf_analyzer/build -- -j8
ENV PATH="$(pwd)/perf_analyzer/build/perf_analyzer/src/perf-analyzer-build:${PATH}"
ENV LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda/lib64 \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
......@@ -163,7 +158,8 @@ RUN ls /opt/nixl
# Install utilities
RUN apt update -y && apt install -y git wget curl nvtop tmux vim
# nats
RUN wget https://github.com/nats-io/nats-server/releases/download/v2.10.24/nats-server-v2.10.24-amd64.deb && dpkg -i nats-server-v2.10.24-amd64.deb && rm nats-server-v2.10.24-amd64.deb
RUN wget https://github.com/nats-io/nats-server/releases/download/v2.10.24/nats-server-v2.10.24-amd64.deb && \
dpkg -i nats-server-v2.10.24-amd64.deb && rm nats-server-v2.10.24-amd64.deb
# etcd
ENV ETCD_VERSION="v3.5.18"
RUN wget https://github.com/etcd-io/etcd/releases/download/$ETCD_VERSION/etcd-$ETCD_VERSION-linux-amd64.tar.gz -O /tmp/etcd.tar.gz && \
......@@ -209,10 +205,6 @@ RUN --mount=type=bind,source=./container/deps/,target=/tmp/deps \
wheel pack . --dest-dir /workspace/dist && \
uv pip install /workspace/dist/vllm-*.whl
# Install genai-perf for benchmarking
RUN uv pip install "git+https://github.com/triton-inference-server/perf_analyzer.git@${GENAI_PERF_TAG}#subdirectory=genai-perf"
RUN uv pip uninstall tritonclient
# Install test dependencies
RUN --mount=type=bind,source=./container/deps/requirements.test.txt,target=/tmp/requirements.txt \
uv pip install --requirement /tmp/requirements.txt
......@@ -293,16 +285,57 @@ RUN --mount=type=bind,source=./container/launch_message.txt,target=/workspace/la
sed '/^#\s/d' /workspace/launch_message.txt > ~/.launch_screen && \
echo "cat ~/.launch_screen" >> ~/.bashrc
# FIXME: Copy more specific folders in for dev/debug after directory restructure
CMD []
#######################################
########## CI Minimum Image ###########
#######################################
FROM build AS ci_minimum
COPY . /workspace
ENTRYPOINT ["/opt/nvidia/nvidia_entrypoint.sh"]
##########################################
########## Perf Analyzer Image ###########
##########################################
FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG} AS perf_analyzer
CMD []
ARG GENAI_PERF_TAG
WORKDIR /workspace
# Build and install Perf Analyzer for benchmarking
RUN apt-get update -y && apt-get -y install cmake g++ libssl-dev python3 rapidjson-dev zlib1g-dev
RUN git clone https://github.com/triton-inference-server/perf_analyzer.git
RUN git -C perf_analyzer checkout ${GENAI_PERF_TAG}
RUN mkdir perf_analyzer/build
RUN cmake -B perf_analyzer/build -S perf_analyzer -D TRITON_ENABLE_PERF_ANALYZER_OPENAI=ON
RUN cmake --build perf_analyzer/build -- -j8
RUN mkdir bin && \
cp -r perf_analyzer/build/perf_analyzer/src/perf-analyzer-build /workspace/bin/
########################################
########## RUNTIME CONTAINER ###########
########## Development Image ###########
########################################
FROM build AS dev
ARG GENAI_PERF_TAG
COPY --from=perf_analyzer /workspace/bin/perf-analyzer-build /workspace/benchmarking
# Install genai-perf for benchmarking
ENV PATH="/workspace/benchmarking:${PATH}"
RUN uv pip install "git+https://github.com/triton-inference-server/perf_analyzer.git@${GENAI_PERF_TAG}#subdirectory=genai-perf"
RUN uv pip uninstall tritonclient
COPY . /workspace
ENTRYPOINT ["/opt/nvidia/nvidia_entrypoint.sh"]
CMD []
####################################
########## Runtime Image ###########
####################################
FROM ${RUNTIME_IMAGE}:${RUNTIME_IMAGE_TAG} AS runtime
......@@ -312,18 +345,18 @@ ENV VIRTUAL_ENV=/opt/dynamo/venv
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Copy NIXL
COPY --from=dev /usr/local/nixl /usr/local/nixl
COPY --from=build /usr/local/nixl /usr/local/nixl
ENV LD_LIBRARY_PATH=/usr/local/nixl/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
ENV PYTHONPATH=/usr/local/nixl/lib/python3/dist-packages/:/opt/nixl/test/python/:$PYTHONPATH
# Setup the python environment
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
RUN uv venv $VIRTUAL_ENV --python 3.12 && \
ln -s $(find / -name libpython3.12.so*) /usr/lib && \
RUN RUN apt-get install python3-dev && \
uv venv $VIRTUAL_ENV --python 3.12 && \
echo "source $VIRTUAL_ENV/bin/activate" >> ~/.bashrc
# Install the wheels
COPY --from=dev /workspace/dist/*.whl wheelhouse/
COPY --from=build /workspace/dist/*.whl wheelhouse/
RUN uv pip install ai-dynamo[vllm] --find-links wheelhouse && \
rm -r wheelhouse
......@@ -336,7 +369,7 @@ RUN --mount=type=bind,source=./container/launch_message.txt,target=/workspace/la
echo "cat ~/.launch_screen" >> ~/.bashrc
# Copy examples
COPY --from=dev /workspace/deploy/examples examples/
COPY ./deploy/examples examples/
# dynamo run in=text out=mistralrs Qwen/Qwen2.5-3B-Instruct
ENTRYPOINT [/bin/sh]
CMD []
\ No newline at end of file
......@@ -349,7 +349,7 @@ if [ -z "$RUN_PREFIX" ]; then
set -x
fi
$RUN_PREFIX docker buildx build -f $DOCKERFILE $TARGET_STR $PLATFORM $BUILD_ARGS $CACHE_FROM $CACHE_TO --output type=docker $TAG $LATEST_TAG $BUILD_CONTEXT_ARG $BUILD_CONTEXT $NO_CACHE
$RUN_PREFIX docker build -f $DOCKERFILE $TARGET_STR $PLATFORM $BUILD_ARGS $CACHE_FROM $CACHE_TO $TAG $LATEST_TAG $BUILD_CONTEXT_ARG $BUILD_CONTEXT $NO_CACHE
{ set +x; } 2>/dev/null
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment