Skip to content

Commit

Permalink
Adding CI docker arguments evaluation to map appropriate device
Browse files Browse the repository at this point in the history
  • Loading branch information
mc-nv committed Oct 4, 2022
1 parent d5424fe commit d293325
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions qa/common/gen_qa_custom_ops
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ PYTORCH_IMAGE=${PYTORCH_IMAGE:=nvcr.io/nvidia/pytorch:$TRITON_VERSION-py3}

CUDA_DEVICE=${RUNNER_ID:=0}

[[ $RUNNER_GPUS =~ ^[0-9] ]] && DOCKER_GPU_ARGS=$(eval $NV_DOCKER_ARGS) || DOCKER_GPU_ARGS="--gpus device=$CUDA_DEVICE"

###
HOST_BUILD_DIR=${HOST_BUILD_DIR:=/tmp}
HOST_SRCDIR=$HOST_BUILD_DIR/gen_srcdir
Expand Down Expand Up @@ -103,7 +105,7 @@ if [ $? -ne 0 ]; then
fi

docker pull $TENSORFLOW_IMAGE
docker run --gpus device=$CUDA_DEVICE --rm --entrypoint $SRCDIR/$TFSCRIPT \
docker run $DOCKER_GPU_ARGS --rm --entrypoint $SRCDIR/$TFSCRIPT \
--mount type=bind,source=$HOST_SRCDIR,target=$SRCDIR \
--mount type=bind,source=$HOST_DESTDIR/tf_custom_ops,target=$DESTDIR \
$TENSORFLOW_IMAGE
Expand All @@ -129,7 +131,7 @@ if [ $? -ne 0 ]; then
fi

docker pull $PYTORCH_IMAGE
docker run --gpus device=$CUDA_DEVICE --rm --entrypoint $SRCDIR/$PYTSCRIPT \
docker run $DOCKER_GPU_ARGS --rm --entrypoint $SRCDIR/$PYTSCRIPT \
--mount type=bind,source=$HOST_SRCDIR,target=$SRCDIR \
--mount type=bind,source=$HOST_DESTDIR/libtorch_custom_ops,target=$DESTDIR \
$PYTORCH_IMAGE
Expand Down
12 changes: 7 additions & 5 deletions qa/common/gen_qa_model_repository
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ TENSORFLOW_IMAGE=${TENSORFLOW_IMAGE:=nvcr.io/nvidia/tensorflow:$TRITON_VERSION-t
TENSORRT_IMAGE=${TENSORRT_IMAGE:=nvcr.io/nvidia/tensorrt:$TRITON_VERSION-py3}
CUDA_DEVICE=${RUNNER_ID:=0}

[[ $RUNNER_GPUS =~ ^[0-9] ]] && DOCKER_GPU_ARGS=$(eval $NV_DOCKER_ARGS) || DOCKER_GPU_ARGS="--gpus device=$CUDA_DEVICE"

###
HOST_BUILD_DIR=${HOST_BUILD_DIR:=/tmp}
HOST_SRCDIR=$HOST_BUILD_DIR/gen_srcdir
Expand Down Expand Up @@ -232,7 +234,7 @@ if [ $? -ne 0 ]; then
fi

docker pull $UBUNTU_IMAGE
docker run --gpus device=$CUDA_DEVICE --rm --entrypoint $SRCDIR/$OPENVINOSCRIPT \
docker run $DOCKER_GPU_ARGS --rm --entrypoint $SRCDIR/$OPENVINOSCRIPT \
--mount type=bind,source=$HOST_SRCDIR,target=$SRCDIR \
--mount type=bind,source=$HOST_DESTDIR,target=$DESTDIR \
--mount type=bind,source=$HOST_VARDESTDIR,target=$VARDESTDIR \
Expand Down Expand Up @@ -299,7 +301,7 @@ if [ $? -ne 0 ]; then
fi

docker pull $UBUNTU_IMAGE
docker run --gpus device=$CUDA_DEVICE --rm --entrypoint $SRCDIR/$ONNXSCRIPT \
docker run $DOCKER_GPU_ARGS --rm --entrypoint $SRCDIR/$ONNXSCRIPT \
--mount type=bind,source=$HOST_SRCDIR,target=$SRCDIR \
--mount type=bind,source=$HOST_DESTDIR,target=$DESTDIR \
--mount type=bind,source=$HOST_VARDESTDIR,target=$VARDESTDIR \
Expand Down Expand Up @@ -350,7 +352,7 @@ if [ $? -ne 0 ]; then
fi

docker pull $PYTORCH_IMAGE
docker run --gpus device=$CUDA_DEVICE --rm --entrypoint $SRCDIR/$TORCHSCRIPT \
docker run $DOCKER_GPU_ARGS --rm --entrypoint $SRCDIR/$TORCHSCRIPT \
--mount type=bind,source=$HOST_SRCDIR,target=$SRCDIR \
--mount type=bind,source=$HOST_DESTDIR,target=$DESTDIR \
--mount type=bind,source=$HOST_VARDESTDIR,target=$VARDESTDIR \
Expand Down Expand Up @@ -409,7 +411,7 @@ if [ $? -ne 0 ]; then
fi

docker pull $TENSORFLOW_IMAGE
docker run --gpus device=$CUDA_DEVICE --rm --entrypoint $SRCDIR/$TFSCRIPT \
docker run $DOCKER_GPU_ARGS --rm --entrypoint $SRCDIR/$TFSCRIPT \
--mount type=bind,source=$HOST_SRCDIR,target=$SRCDIR \
--mount type=bind,source=$HOST_DESTDIR,target=$DESTDIR \
--mount type=bind,source=$HOST_VARDESTDIR,target=$VARDESTDIR \
Expand Down Expand Up @@ -484,7 +486,7 @@ if [ $? -ne 0 ]; then
fi

docker pull $TENSORRT_IMAGE
docker run --gpus device=$CUDA_DEVICE --rm --entrypoint $SRCDIR/$TRTSCRIPT \
docker run $DOCKER_GPU_ARGS --rm --entrypoint $SRCDIR/$TRTSCRIPT \
--mount type=bind,source=$HOST_SRCDIR,target=$SRCDIR \
--mount type=bind,source=$HOST_DESTDIR,target=$DESTDIR \
--mount type=bind,source=$HOST_VARDESTDIR,target=$VARDESTDIR \
Expand Down

0 comments on commit d293325

Please sign in to comment.