-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[None][feat] Use a shell context to install dependancies #7383
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
Merged
MartinMarciniszyn
merged 36 commits into
NVIDIA:main
from
v-shobhit:dev/shobhitv/shell-build-ctx
Sep 10, 2025
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
3c8ac96
Add and use install.sh
v-shobhit 4b5b5fa
Clear the pip constraints
v-shobhit ead95a6
fail on error
v-shobhit 846ca6f
Make install.sh executable
v-shobhit 1a2b1bc
update enroot/Makefile
v-shobhit be25635
Address comment
v-shobhit 719d46a
fix end of files
v-shobhit d444aa4
allow unset variables
v-shobhit bc55715
Add run_sqsh target
v-shobhit 3877e05
Document enroot flow
v-shobhit 38409bd
fix typo
v-shobhit 4f4bb4d
fix docker build layering
v-shobhit 85bca7c
address comments
v-shobhit f65f93b
remove temp workaround
v-shobhit 91fc4e1
add vars
v-shobhit 8b0171f
clean up srun command
v-shobhit 981d489
clean up
v-shobhit 762a66b
fix variable export
v-shobhit 82bddf6
Merge branch 'main' into dev/shobhitv/shell-build-ctx
nvzhihanj ec3cf54
address comment
v-shobhit 67fcaba
attempt fix CI
v-shobhit 134d831
Merge branch 'main' into dev/shobhitv/shell-build-ctx
v-shobhit 349e17d
Merge branch 'main' into dev/shobhitv/shell-build-ctx
nvzhihanj 3ee39e5
Update current_image_tags.properties
v-shobhit 80b542e
Merge branch 'main' into dev/shobhitv/shell-build-ctx
v-shobhit faf0a66
Update current_image_tags.properties
v-shobhit 6ba3720
address review
v-shobhit 0148f97
review - keep pytorch comment
v-shobhit a387c11
Update install.sh
v-shobhit 39d02b3
Update install.sh
v-shobhit 42f44b0
Update Dockerfile.multi
v-shobhit b27a7b8
TensorRT-LLM -> TensorRT LLM
v-shobhit 6c66a1c
Update Dockerfile.multi
v-shobhit a80a5c4
Update Dockerfile.multi
v-shobhit 6318484
remove hyphen
v-shobhit 39b1df3
add missing 'rm'
v-shobhit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
venkywonka marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| #!/bin/bash | ||
| set -Eeo pipefail | ||
| shopt -s nullglob | ||
| trap 'echo "[install.sh] Error on line $LINENO" >&2' ERR | ||
v-shobhit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Resolve script directory for robust relative pathing | ||
| SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
|
|
||
| # Default values | ||
| base=0 | ||
| cmake=0 | ||
| ccache=0 | ||
| cuda_toolkit=0 | ||
| tensorrt=0 | ||
| polygraphy=0 | ||
| mpi4py=0 | ||
| pytorch=0 | ||
| opencv=0 | ||
| protobuf=0 | ||
|
|
||
| while [[ $# -gt 0 ]]; do | ||
| case $1 in | ||
| --base) | ||
| base=1 | ||
| shift 1 | ||
| ;; | ||
| --cmake) | ||
| cmake=1 | ||
| shift 1 | ||
| ;; | ||
| --ccache) | ||
| ccache=1 | ||
| shift 1 | ||
| ;; | ||
| --cuda_toolkit) | ||
| cuda_toolkit=1 | ||
| shift 1 | ||
| ;; | ||
| --tensorrt) | ||
| tensorrt=1 | ||
| shift 1 | ||
v-shobhit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ;; | ||
| --polygraphy) | ||
| polygraphy=1 | ||
| shift 1 | ||
| ;; | ||
| --mpi4py) | ||
| mpi4py=1 | ||
| shift 1 | ||
| ;; | ||
| --pytorch) | ||
| pytorch=1 | ||
| shift 1 | ||
| ;; | ||
| --opencv) | ||
| opencv=1 | ||
| shift 1 | ||
| ;; | ||
| --protobuf) | ||
| protobuf=1 | ||
| shift 1 | ||
| ;; | ||
| --all) | ||
| base=1 | ||
| cmake=1 | ||
| ccache=1 | ||
| cuda_toolkit=1 | ||
| tensorrt=1 | ||
| polygraphy=1 | ||
| mpi4py=1 | ||
| pytorch=1 | ||
| opencv=1 | ||
| protobuf=1 | ||
| shift 1 | ||
| ;; | ||
| *) | ||
| echo "Unknown option: $1" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| if [ $base -eq 1 ]; then | ||
| echo "Installing base dependencies..." | ||
| # Clean up the pip constraint file from the base NGC PyTorch image. | ||
| [ -f /etc/pip/constraint.txt ] && : > /etc/pip/constraint.txt || true | ||
|
|
||
| echo "Using Python version: $PYTHON_VERSION" | ||
| GITHUB_MIRROR=$GITHUB_MIRROR bash $SCRIPT_DIR/install_base.sh $PYTHON_VERSION | ||
| fi | ||
|
|
||
| if [ $cmake -eq 1 ]; then | ||
| echo "Installing CMake..." | ||
| GITHUB_MIRROR=$GITHUB_MIRROR bash $SCRIPT_DIR/install_cmake.sh | ||
| fi | ||
|
|
||
| if [ $ccache -eq 1 ]; then | ||
| echo "Installing ccache..." | ||
| GITHUB_MIRROR=$GITHUB_MIRROR bash $SCRIPT_DIR/install_ccache.sh | ||
| fi | ||
|
|
||
| if [ $cuda_toolkit -eq 1 ]; then | ||
| echo "Installing CUDA toolkit..." | ||
| bash $SCRIPT_DIR/install_cuda_toolkit.sh | ||
| fi | ||
|
|
||
| if [ $tensorrt -eq 1 ]; then | ||
| echo "Installing TensorRT..." | ||
| bash $SCRIPT_DIR/install_tensorrt.sh \ | ||
| --TRT_VER=${TRT_VER} \ | ||
| --CUDA_VER=${CUDA_VER} \ | ||
| --CUDNN_VER=${CUDNN_VER} \ | ||
| --NCCL_VER=${NCCL_VER} \ | ||
| --CUBLAS_VER=${CUBLAS_VER} | ||
| fi | ||
|
|
||
| if [ $polygraphy -eq 1 ]; then | ||
| echo "Installing Polygraphy..." | ||
| bash $SCRIPT_DIR/install_polygraphy.sh | ||
| fi | ||
|
|
||
| if [ $mpi4py -eq 1 ]; then | ||
| echo "Installing mpi4py..." | ||
| GITHUB_MIRROR=$GITHUB_MIRROR bash $SCRIPT_DIR/install_mpi4py.sh | ||
| fi | ||
|
|
||
| if [ $pytorch -eq 1 ]; then | ||
| echo "Installing PyTorch..." | ||
| bash $SCRIPT_DIR/install_pytorch.sh $TORCH_INSTALL_TYPE | ||
| fi | ||
|
|
||
| if [ $opencv -eq 1 ]; then | ||
| echo "Installing OpenCV..." | ||
| pip3 uninstall -y opencv | ||
| rm -rf /usr/local/lib/python3*/dist-packages/cv2/ | ||
| pip3 install opencv-python-headless --force-reinstall --no-deps --no-cache-dir | ||
| fi | ||
|
|
||
| # WARs against security issues inherited from pytorch:25.06 | ||
| # * https://github.com/advisories/GHSA-8qvm-5x2c-j2w7 | ||
| if [ $protobuf -eq 1 ]; then | ||
| pip3 install --upgrade --no-cache-dir \ | ||
| "protobuf>=4.25.8" | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| ifndef MAKEFILE_PYXIS_INCLUDED | ||
| MAKEFILE_PYXIS_INCLUDED := 1 | ||
|
|
||
| BASE_IMAGE ?= $(shell grep '^ARG BASE_IMAGE=' ../docker/Dockerfile.multi | grep -o '=.*' | tr -d '="') | ||
| BASE_TAG ?= $(shell grep '^ARG BASE_TAG=' ../docker/Dockerfile.multi | grep -o '=.*' | tr -d '="') | ||
| SQSH_PATH ?= tensorrt_llm.devel.sqsh | ||
| SOURCE_DIR ?= $(shell readlink -f ..) | ||
| CODE_DIR ?= /code/tensorrt_llm | ||
| RUN_CMD ?= --pty bash | ||
|
|
||
| PYTHON_VERSION ?= 3.12.3 | ||
| TORCH_INSTALL_TYPE ?= skip | ||
| GITHUB_MIRROR ?= | ||
| CUDA_VERSION ?= | ||
| CUDNN_VERSION ?= | ||
| NCCL_VERSION ?= | ||
| CUBLAS_VERSION ?= | ||
| TRT_VERSION ?= | ||
|
|
||
| build_sqsh: | ||
| @echo "Building trtllm sqsh image." | ||
| @echo "Base image: $(BASE_IMAGE):$(BASE_TAG)" | ||
| @echo "Location: $(SQSH_PATH)" | ||
|
|
||
| srun \ | ||
| --container-image "$(BASE_IMAGE):$(BASE_TAG)" \ | ||
| --container-save "$(SQSH_PATH)" \ | ||
| --container-mounts "$(SOURCE_DIR):$(CODE_DIR)" --container-workdir $(CODE_DIR)/docker/common \ | ||
| --container-mount-home --container-remap-root \ | ||
| --export PYTHON_VERSION=$(PYTHON_VERSION),GITHUB_MIRROR=$(GITHUB_MIRROR),TORCH_INSTALL_TYPE=$(TORCH_INSTALL_TYPE),CUDA_VER=$(CUDA_VERSION),CUDNN_VER=$(CUDNN_VERSION),NCCL_VER=$(NCCL_VERSION),CUBLAS_VER=$(CUBLAS_VERSION),TRT_VER=$(TRT_VERSION) \ | ||
| ./install.sh --all | ||
|
|
||
| run_sqsh: | ||
| @echo "Running srun job step with:" | ||
| @echo " sqsh image: $(SQSH_PATH)" | ||
| @echo " run command: $(RUN_CMD)" | ||
|
|
||
| srun \ | ||
| --container-image "$(SQSH_PATH)" \ | ||
| --container-mounts "$(SOURCE_DIR):$(CODE_DIR)" --container-workdir $(CODE_DIR) \ | ||
| --container-mount-home --container-remap-root \ | ||
| --export PYTORCH_CUDA_ALLOC_CONF=garbage_collection_threshold:0.99999 \ | ||
venkywonka marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $(RUN_CMD) | ||
|
|
||
| endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.