Skip to content
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

simplify GPU detection in docker launch script #2064

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions scripts/run_docker_gpu.sh
Original file line number Diff line number Diff line change
@@ -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"