Skip to content

Commit b7c64a1

Browse files
sanowlaraffin
andauthored
Simplify GPU detection in docker launch script (#2064)
Co-authored-by: Antonin RAFFIN <[email protected]>
1 parent 2b529e5 commit b7c64a1

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

scripts/run_docker_gpu.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
#!/bin/bash
22
# Launch an experiment using the docker gpu image
3-
43
cmd_line="$@"
5-
64
echo "Executing in the docker (gpu image):"
75
echo $cmd_line
86

9-
# TODO: always use new-style once sufficiently widely used (probably 2021 onwards)
10-
if [ -x "$(which nvidia-docker)" ]; then
11-
# old-style nvidia-docker2
12-
NVIDIA_ARG="--runtime=nvidia"
13-
else
14-
NVIDIA_ARG="--gpus all"
15-
fi
7+
# Using new-style GPU argument
8+
NVIDIA_ARG="--gpus all"
169

1710
docker run -it ${NVIDIA_ARG} --rm --network host --ipc=host \
18-
--mount src=$(pwd),target=/home/mamba/stable-baselines3,type=bind stablebaselines/stable-baselines3:latest \
19-
bash -c "cd /home/mamba/stable-baselines3/ && $cmd_line"
11+
--mount src=$(pwd),target=/home/mamba/stable-baselines3,type=bind stablebaselines/stable-baselines3:latest \
12+
bash -c "cd /home/mamba/stable-baselines3/ && $cmd_line"

0 commit comments

Comments
 (0)