-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify GPU detection in docker launch script (#2064)
Co-authored-by: Antonin RAFFIN <[email protected]>
- Loading branch information
Showing
1 changed file
with
4 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |