From b7c64a1aa4dd2fd3efed96e7a9ddb4d1f5c96112 Mon Sep 17 00:00:00 2001 From: San Date: Tue, 7 Jan 2025 16:58:28 +0300 Subject: [PATCH] Simplify GPU detection in docker launch script (#2064) Co-authored-by: Antonin RAFFIN --- scripts/run_docker_gpu.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/scripts/run_docker_gpu.sh b/scripts/run_docker_gpu.sh index fa8aae9..37b9ee9 100755 --- a/scripts/run_docker_gpu.sh +++ b/scripts/run_docker_gpu.sh @@ -1,19 +1,12 @@ #!/bin/bash # Launch an experiment using the docker gpu image - cmd_line="$@" - echo "Executing in the docker (gpu image):" echo $cmd_line -# TODO: always use new-style once sufficiently widely used (probably 2021 onwards) -if [ -x "$(which nvidia-docker)" ]; then - # old-style nvidia-docker2 - NVIDIA_ARG="--runtime=nvidia" -else - NVIDIA_ARG="--gpus all" -fi +# Using new-style GPU argument +NVIDIA_ARG="--gpus all" docker run -it ${NVIDIA_ARG} --rm --network host --ipc=host \ - --mount src=$(pwd),target=/home/mamba/stable-baselines3,type=bind stablebaselines/stable-baselines3:latest \ - bash -c "cd /home/mamba/stable-baselines3/ && $cmd_line" +--mount src=$(pwd),target=/home/mamba/stable-baselines3,type=bind stablebaselines/stable-baselines3:latest \ +bash -c "cd /home/mamba/stable-baselines3/ && $cmd_line" \ No newline at end of file