@@ -73,7 +73,32 @@ RUN apt-get update -y && \
7373
7474WORKDIR /workspace
7575
76- ### TODO: Bring back UCX EFA setup once we are confident it works with IB devices
76+ ### UCX EFA Setup ###
77+ RUN rm -rf /opt/hpcx/ucx
78+ RUN rm -rf /usr/local/ucx
79+ RUN cd /usr/local/src && \
80+ git clone https://github.com/openucx/ucx.git && \
81+ cd ucx && \
82+ git checkout v1.19.x && \
83+ ./autogen.sh && ./configure \
84+ --prefix=/usr/local/ucx \
85+ --enable-shared \
86+ --disable-static \
87+ --disable-doxygen-doc \
88+ --enable-optimizations \
89+ --enable-cma \
90+ --enable-devel-headers \
91+ --with-cuda=/usr/local/cuda \
92+ --with-verbs \
93+ --with-efa \
94+ --with-dm \
95+ --with-gdrcopy=/usr/local \
96+ --enable-mt && \
97+ make -j && \
98+ make -j install-strip && \
99+ ldconfig
100+
101+ ENV LD_LIBRARY_PATH=/usr/lib:/usr/local/ucx/lib:$LD_LIBRARY_PATH
77102ENV CPATH=/usr/include:$CPATH
78103ENV PATH=/usr/bin:$PATH
79104ENV PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
@@ -126,21 +151,22 @@ ENV VIRTUAL_ENV=/opt/dynamo/venv
126151ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
127152
128153# Install NIXL Python module
129- # TODO: Move gds_path selection based on arch into NIXL build
130- RUN if [ "$ARCH" = "arm64" ]; then \
131- cd /opt/nixl && uv pip install . --config-settings=setup-args="-Dgds_path=/usr/local/cuda/targets/sbsa-linux"; \
132- else \
133- cd /opt/nixl && uv pip install . ; \
134- fi
154+ RUN cd /opt/nixl && uv build . --out-dir /workspace/wheels/nixl
155+
156+ # Install the wheel
157+ # TODO: Move NIXL wheel install to the wheel_builder stage
158+ RUN uv pip install /workspace/wheels/nixl/*.whl
135159
136160# Install sglang
137- # This commit references a NIXL fix that was releasted after the 0.4.8.post1 release https://github.com/sgl-project/sglang/pull/7330
161+ # This commit references a NIXL fix that was released after the 0.4.8.post1 release https://github.com/sgl-project/sglang/pull/7330
162+ #TODO: Built wheel should become an artifact which can be cached and reused in subsequent builds
138163ARG SGLANG_COMMIT="bb9b608c86ebad7d9d01e29fe058bc184dc7285f"
139164RUN --mount=type=cache,target=/root/.cache/uv \
140165 cd /opt && \
141166 git clone https://github.com/sgl-project/sglang.git && \
142167 cd sglang && \
143168 git checkout ${SGLANG_COMMIT} && \
169+ # Install in editable mode for development
144170 uv pip install -e "python[all]"
145171
146172# Set env var that allows for forceful shutdown of inflight requests in SGL's TokenizerManager
@@ -379,20 +405,43 @@ ENV DYNAMO_HOME=/workspace
379405ENV VIRTUAL_ENV=/opt/dynamo/venv
380406ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
381407
408+ ### COPY NATS & ETCD ###
409+ # Copy nats and etcd from base image
410+ COPY --from=base /usr/bin/nats-server /usr/bin/nats-server
411+ COPY --from=base /usr/local/bin/etcd/ /usr/local/bin/etcd/
412+ ENV PATH=/usr/local/bin/etcd/:$PATH
413+
414+ # Copy UCX from base image as plugin for NIXL
415+ # Copy NIXL source from base image (required for NIXL plugins)
416+ COPY --from=base /usr/local/ucx /usr/local/ucx
417+ COPY --from=base /usr/local/nixl /usr/local/nixl
418+ ARG ARCH_ALT
419+ ENV NIXL_PLUGIN_DIR=/usr/local/nixl/lib/${ARCH_ALT}-linux-gnu/plugins
420+ ENV LD_LIBRARY_PATH=/usr/local/nixl/lib/${ARCH_ALT}-linux-gnu:/usr/local/nixl/lib/${ARCH_ALT}-linux-gnu/plugins:/usr/local/ucx/lib:$LD_LIBRARY_PATH
421+
382422# Setup the python environment
383423COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
384424RUN apt-get update && \
385- DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3-dev && \
425+ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential python3-dev libnuma -dev && \
386426 rm -rf /var/lib/apt/lists/* && \
387427 uv venv $VIRTUAL_ENV --python 3.12 && \
388428 echo "source $VIRTUAL_ENV/bin/activate" >> ~/.bashrc
389429
430+ # Install SGLang and related packages (sgl-kernel, einops, sentencepiece) since they are not included in the runtime wheel
431+ # https://github.com/sgl-project/sglang/blob/v0.4.9.post1/python/pyproject.toml#L18-51
432+ RUN uv pip install "sglang[runtime_common]>=0.4.9.post1" && \
433+ uv pip install einops && \
434+ uv pip install sgl-kernel==0.2.4 && \
435+ uv pip install sentencepiece
436+
390437# Install the wheels and symlink executables to /usr/local/bin so dynamo components can use them
391438# Dynamo components currently do not have the VIRTUAL_ENV in their PATH, so we need to symlink the executables
392439COPY --from=wheel_builder /workspace/dist/*.whl wheelhouse/
393- RUN uv pip install ai-dynamo[vllm] --find-links wheelhouse && \
394- ln -sf $VIRTUAL_ENV/bin/* /usr/local/bin/ && \
395- rm -r wheelhouse
440+ COPY --from=base /workspace/wheels/nixl/*.whl wheelhouse/
441+ RUN uv pip install ai-dynamo --find-links wheelhouse && \
442+ uv pip install ai-dynamo-runtime --find-links wheelhouse && \
443+ uv pip install nixl --find-links wheelhouse && \
444+ ln -sf $VIRTUAL_ENV/bin/* /usr/local/bin/
396445
397446# Tell vllm to use the Dynamo LLM C API for KV Cache Routing
398447ENV VLLM_KV_CAPI_PATH="/opt/dynamo/bindings/lib/libdynamo_llm_capi.so"
@@ -402,8 +451,9 @@ RUN --mount=type=bind,source=./container/launch_message.txt,target=/workspace/la
402451 sed '/^#\s/d' /workspace/launch_message.txt > ~/.launch_screen && \
403452 echo "cat ~/.launch_screen" >> ~/.bashrc
404453
405- # Copy examples
406- COPY ./examples examples/
454+ # Copy examples and set up Python path
455+ COPY . /workspace
456+ ENV PYTHONPATH=/workspace/examples/sglang/utils:$PYTHONPATH
407457
408- ENTRYPOINT [ "/usr/bin/bash" ]
458+ ENTRYPOINT ["/opt/nvidia/nvidia_entrypoint.sh" ]
409459CMD []
0 commit comments