Dockerfile.sglang-wideep 5.01 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

16
ARG SGLANG_IMAGE_TAG="v0.5.0rc0-cu126"
17

ishandhanani's avatar
ishandhanani committed
18
FROM lmsysorg/sglang:${SGLANG_IMAGE_TAG}
19

ishandhanani's avatar
ishandhanani committed
20
21
22
23
ARG MODE="hopper"
ARG ARCH="amd64"
ARG ARCH_ALT="x86_64"
ARG NIXL_UCX_REF="v1.19.x"
24
ARG NIXL_TAG="0.5.0"
ishandhanani's avatar
ishandhanani committed
25
26
27
ARG CMAKE_VERSION="3.31.8"
ARG RUST_VERSION="1.87.0"
ARG CARGO_BUILD_JOBS="16"
28

29
RUN apt-get update -y && \
ishandhanani's avatar
ishandhanani committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
    apt-get install -y \
      cmake meson ninja-build pybind11-dev patchelf net-tools \
      build-essential protobuf-compiler libssl-dev pkg-config \
      clang libclang-dev git rapidjson-dev zlib1g-dev && \
    pip install --break-system-packages meson-python wheel build

# Build UCX + NIXL for x86/hopper until its fully tested on GB200
RUN if [ "$MODE" = "hopper" ]; then \
      apt-get install -y --no-install-recommends \
        libibverbs-dev rdma-core ibverbs-utils libibumad-dev \
        libnuma-dev librdmacm-dev ibverbs-providers autoconf libtool && \
      # UCX from source
      rm -rf /opt/hpcx/ucx /usr/local/ucx && \
      cd /usr/local/src && \
      git clone https://github.com/openucx/ucx.git && \
      cd ucx && git checkout $NIXL_UCX_REF && \
      ./autogen.sh && \
      ./configure \
        --prefix=/usr/local/ucx \
        --enable-shared \
        --disable-static \
        --disable-doxygen-doc \
        --enable-optimizations \
        --enable-cma \
        --enable-devel-headers \
        --with-cuda=/usr/local/cuda \
        --with-verbs \
        --with-efa \
        --with-dm \
        --with-gdrcopy=/usr/local \
        --enable-mt && \
      make -j && make install-strip && ldconfig && \
      # NIXL
      git clone https://github.com/ai-dynamo/nixl.git /opt/nixl && \
      cd /opt/nixl && git checkout $NIXL_TAG && \
      pip install --break-system-packages . \
        --config-settings="setup-args=-Ducx_path=/usr/local/ucx"; \
    fi
68
69
70

ENV LD_LIBRARY_PATH=/usr/lib:/usr/local/ucx/lib:$LD_LIBRARY_PATH

ishandhanani's avatar
ishandhanani committed
71
# Dynamo
72
WORKDIR /sgl-workspace
73
RUN git clone https://github.com/ai-dynamo/dynamo.git
74
75
76

ENV RUSTUP_HOME=/usr/local/rustup \
    CARGO_HOME=/usr/local/cargo \
ishandhanani's avatar
ishandhanani committed
77
    PATH=/usr/local/cargo/bin:$PATH
78

ishandhanani's avatar
ishandhanani committed
79
80
RUN wget --tries=3 --waitretry=5 \
    "https://static.rust-lang.org/rustup/archive/1.28.1/${ARCH_ALT}-unknown-linux-gnu/rustup-init" && \
81
    chmod +x rustup-init && \
ishandhanani's avatar
ishandhanani committed
82
83
84
85
86
    ./rustup-init -y \
      --no-modify-path \
      --profile minimal \
      --default-toolchain $RUST_VERSION \
      --default-host ${ARCH_ALT}-unknown-linux-gnu && \
87
88
89
90
    rm rustup-init && \
    chmod -R a+w $RUSTUP_HOME $CARGO_HOME

ARG CARGO_BUILD_JOBS
ishandhanani's avatar
ishandhanani committed
91
92
93
ENV CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS}

RUN cd dynamo && cargo build --release
94

ishandhanani's avatar
ishandhanani committed
95
96
97
98
RUN cd dynamo/lib/bindings/python && \
    pip install --break-system-packages -e . && \
    cd /sgl-workspace/dynamo && \
    pip install --break-system-packages .
99

ishandhanani's avatar
ishandhanani committed
100
RUN pip install --break-system-packages sglang-router==0.1.5
101

ishandhanani's avatar
ishandhanani committed
102
103
104
RUN wget --tries=3 --waitretry=5 \
      https://github.com/nats-io/nats-server/releases/download/v2.10.28/\
nats-server-v2.10.28-${ARCH}.deb && \
105
    dpkg -i nats-server-v2.10.28-${ARCH}.deb && rm nats-server-v2.10.28-${ARCH}.deb
106

107
ENV ETCD_VERSION="v3.5.21"
ishandhanani's avatar
ishandhanani committed
108
109
110
RUN wget --tries=3 --waitretry=5 \
      https://github.com/etcd-io/etcd/releases/download/${ETCD_VERSION}/\
etcd-${ETCD_VERSION}-linux-${ARCH}.tar.gz -O /tmp/etcd.tar.gz && \
111
    mkdir -p /usr/local/bin/etcd && \
ishandhanani's avatar
ishandhanani committed
112
113
    tar -xzf /tmp/etcd.tar.gz \
        -C /usr/local/bin/etcd --strip-components=1 && \
114
115
    rm /tmp/etcd.tar.gz

ishandhanani's avatar
ishandhanani committed
116
ENV PATH=/usr/local/bin/etcd:$PATH
117

ishandhanani's avatar
ishandhanani committed
118
# GenAI Perf
119
120
RUN apt-get purge -y cmake

ishandhanani's avatar
ishandhanani committed
121
122
123
124
125
126
127
128
129
RUN mkdir /sgl-workspace/cmake_build && \
    cd /sgl-workspace/cmake_build && \
    wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/\
cmake-${CMAKE_VERSION}-linux-$(uname -m).tar.gz && \
    tar -xzf cmake-${CMAKE_VERSION}-linux-$(uname -m).tar.gz && \
    mv cmake-${CMAKE_VERSION}-linux-$(uname -m) custom_cmake && \
    rm cmake-${CMAKE_VERSION}-linux-$(uname -m).tar.gz

ENV PATH=/sgl-workspace/cmake_build/custom_cmake/bin:$PATH
130
131
RUN cmake --version

ishandhanani's avatar
ishandhanani committed
132
133
RUN git clone --depth=1 \
      https://github.com/triton-inference-server/perf_analyzer.git && \
134
135
    mkdir perf_analyzer/build && \
    cmake -B perf_analyzer/build -S perf_analyzer && \
ishandhanani's avatar
ishandhanani committed
136
    cmake --build perf_analyzer/build -- -j$(nproc)
137
138
139
140

ENV PATH=/sgl-workspace/perf_analyzer/build/perf_analyzer/src/perf-analyzer-build:$PATH
RUN pip install --break-system-packages genai-perf

ishandhanani's avatar
ishandhanani committed
141
142
# Enable forceful shutdown of inflight requests
ENV SGL_FORCE_SHUTDOWN=1
143

144
WORKDIR /sgl-workspace/dynamo/components/backends/sglang