Skip to content

Commit f16be83

Browse files
fix: trtllm container - ENV var used before declaration (#2277)
1 parent 599595a commit f16be83

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

container/Dockerfile.tensorrt_llm

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,25 @@ CMD []
353353

354354
FROM ${RUNTIME_IMAGE}:${RUNTIME_IMAGE_TAG} AS runtime
355355

356+
WORKDIR /workspace
357+
356358
ARG ARCH_ALT
357359

358-
WORKDIR /workspace
359360
ENV DYNAMO_HOME=/workspace
360361
ENV VIRTUAL_ENV=/opt/dynamo/venv
361362
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
363+
ENV NIXL_PREFIX=/opt/nvidia/nvda_nixl
364+
ENV NIXL_LIB_DIR=$NIXL_PREFIX/lib/${ARCH_ALT}-linux-gnu
365+
ENV NIXL_PLUGIN_DIR=$NIXL_LIB_DIR/plugins
366+
ENV LD_LIBRARY_PATH=\
367+
$NIXL_LIB_DIR:\
368+
$NIXL_PLUGIN_DIR:\
369+
/usr/local/ucx/lib:\
370+
/usr/local/ucx/lib/ucx:\
371+
/opt/hpcx/ompi/lib:\
372+
$LD_LIBRARY_PATH
373+
ENV PATH=/opt/hpcx/ompi/bin:/usr/local/bin/etcd/:/usr/local/cuda/nvvm/bin:$PATH
374+
ENV OPAL_PREFIX=/opt/hpcx/ompi
362375

363376
# Install apt dependencies
364377
# openssh-client, openssh-server are needed for OpenMPI
@@ -453,21 +466,6 @@ COPY --from=build /usr/local/lib/python3.12/dist-packages/flash_attn /usr/local/
453466
COPY --from=build /usr/local/lib/python3.12/dist-packages/flash_attn-${FLASH_ATTN_VER}.dist-info /usr/local/lib/python3.12/dist-packages/flash_attn-${FLASH_ATTN_VER}.dist-info
454467
COPY --from=build /usr/local/lib/python3.12/dist-packages/flash_attn_2_cuda.cpython-312-*-linux-gnu.so /usr/local/lib/python3.12/dist-packages/
455468

456-
# Setup environment variables
457-
ARG ARCH_ALT
458-
ENV NIXL_PREFIX=/opt/nvidia/nvda_nixl
459-
ENV NIXL_LIB_DIR=$NIXL_PREFIX/lib/${ARCH_ALT}-linux-gnu
460-
ENV NIXL_PLUGIN_DIR=$NIXL_LIB_DIR/plugins
461-
462-
ENV LD_LIBRARY_PATH=\
463-
$NIXL_LIB_DIR:\
464-
$NIXL_PLUGIN_DIR:\
465-
/usr/local/ucx/lib:\
466-
/usr/local/ucx/lib/ucx:\
467-
/opt/hpcx/ompi/lib:\
468-
$LD_LIBRARY_PATH
469-
ENV PATH=/opt/hpcx/ompi/bin:/usr/local/bin/etcd/:/usr/local/cuda/nvvm/bin:$PATH
470-
ENV OPAL_PREFIX=/opt/hpcx/ompi
471469

472470
# Install TensorRT-LLM (same as in build stage)
473471
ARG HAS_TRTLLM_CONTEXT=0
@@ -476,8 +474,8 @@ ARG TENSORRTLLM_INDEX_URL="https://pypi.python.org/simple"
476474

477475
# Copy Dynamo wheels into wheelhouse
478476
# Copy metrics binary from wheel_builder image, not part of ai-dynamo wheel
479-
COPY --from=dev /workspace/wheels/nixl/*.whl wheelhouse/
480-
COPY --from=wheel_builder /workspace/dist/*.whl wheelhouse/
477+
COPY --from=dev /workspace/wheels/nixl/*.whl /workspace/wheelhouse/
478+
COPY --from=wheel_builder /workspace/dist/*.whl /workspace/wheelhouse/
481479
COPY --from=dev /workspace/target/release/metrics /usr/local/bin/metrics
482480

483481
# NOTE: If a package (tensorrt_llm) exists on both --index-url and --extra-index-url,
@@ -488,7 +486,7 @@ RUN uv pip install --extra-index-url "${TENSORRTLLM_INDEX_URL}" "${TENSORRTLLM_P
488486
if [ "$ARCH" = "amd64" ]; then \
489487
pip install "triton==3.3.1"; \
490488
fi; \
491-
uv pip install ai-dynamo nixl --find-links wheelhouse
489+
uv pip install ai-dynamo nixl --find-links /workspace/wheelhouse
492490

493491
# Copy benchmarks, backends and tests for CI
494492
# TODO: Remove this once we have a functional CI image built on top of the runtime image

0 commit comments

Comments
 (0)