Skip to content

Commit 993aef0

Browse files
committed
1 parent 832ad7c commit 993aef0

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

qa/common/gen_jetson_trt_models

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,20 @@ TENSORRT_IMAGE=${TENSORRT_IMAGE:=nvcr.io/nvidia/tensorrt:$TRITON_VERSION-py3-igp
4242
UBUNTU_IMAGE=${UBUNTU_IMAGE:=ubuntu:24.04}
4343

4444
# Set CI specific parameters
45-
DOCKER_GPU_ARGS=${DOCKER_GPU_ARGS:-$([[ $RUNNER_GPUS =~ ^[0-9] ]] && eval $NV_DOCKER_ARGS || echo "--gpus $NVIDIA_VISIBLE_DEVICES" )}
45+
define_docker_gpu_args() {
46+
# If RUNNER_GPUS is set and starts with a digit, use NV_DOCKER_ARGS
47+
if [[ -v RUNNER_GPUS && $RUNNER_GPUS =~ ^[0-9] ]]; then
48+
eval echo $NV_DOCKER_ARGS
49+
# Handle special values for NVIDIA_VISIBLE_DEVICES
50+
elif [[ "$NVIDIA_VISIBLE_DEVICES" == "all" ]]; then
51+
echo "--gpus all"
52+
elif [[ "$NVIDIA_VISIBLE_DEVICES" == "none" ]]; then
53+
echo ""
54+
else
55+
echo "--gpus '\"device=$NVIDIA_VISIBLE_DEVICES\"'"
56+
fi
57+
}
58+
DOCKER_GPU_ARGS=${DOCKER_GPU_ARGS:-$(compute_docker_gpu_args)}
4659

4760
############################################################################
4861
# Check if Docker volume exists

qa/common/gen_qa_model_repository

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,23 @@ PROJECT_NAME=${PROJECT_NAME:=tritonserver}
8080
log_message.status "define: Docker engine parameters"
8181
DOCKER_VOLUME=${DOCKER_VOLUME:=volume.gen_qa_model_repository.${CI_JOB_ID}}
8282
DOCKER_VOLUME_CONTAINER=${DOCKER_VOLUME}.gen_qa_model_repository.${CI_JOB_ID}
83-
DOCKER_GPU_ARGS=${DOCKER_GPU_ARGS:-$([[ -v RUNNER_GPUS && $RUNNER_GPUS =~ ^[0-9] ]] && eval $NV_DOCKER_ARGS || echo "--runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES" )}
83+
84+
# Compute Docker GPU arguments based on environment
85+
define_docker_gpu_args() {
86+
# If RUNNER_GPUS is set and starts with a digit, use NV_DOCKER_ARGS
87+
if [[ -v RUNNER_GPUS && $RUNNER_GPUS =~ ^[0-9] ]]; then
88+
eval echo $NV_DOCKER_ARGS
89+
# Handle special values for NVIDIA_VISIBLE_DEVICES
90+
elif [[ "$NVIDIA_VISIBLE_DEVICES" == "all" ]]; then
91+
echo "--gpus all"
92+
elif [[ "$NVIDIA_VISIBLE_DEVICES" == "none" ]]; then
93+
echo ""
94+
# Default: use device parameter with proper quoting
95+
else
96+
echo "--gpus '\"device=$NVIDIA_VISIBLE_DEVICES\"'"
97+
fi
98+
}
99+
DOCKER_GPU_ARGS=${DOCKER_GPU_ARGS:-$(compute_docker_gpu_args)}
84100

85101
function define_model_output_directories() {
86102
log_message.status "define: model output directories"

0 commit comments

Comments
 (0)