-
Notifications
You must be signed in to change notification settings - Fork 1
/
launch.sh
32 lines (29 loc) · 891 Bytes
/
launch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
syntax_error(){
echo "sh launch sh build|start gpu|cpu"
}
if [ $# -ne 2 ]; then
syntax_error;
fi
if [ "$1" = "build" ]; then
docker-compose build tensorflow-compiler-$2;
elif [ "$1" = start ]; then
mkdir -p tensorflow;
if [ "$2" = "gpu" ]; then
docker run -it --rm \
--gpus all \
--device /dev/nvidia0 --device /dev/nvidia-modeset \
--device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools \
--device /dev/nvidiactl --network host \
-v "$(realpath ./tensorflow):/tmp/tensorflow-pkg" \
tensorflow-compiler_tensorflow-compiler-gpu;
elif [ "$2" = "cpu" ]; then
docker run -it --rm \
-v "$(realpath ./tensorflow):/tmp/tensorflow-pkg" \
tensorflow-compiler_tensorflow-compiler-cpu;
else
syntax_error;
fi
else
syntax_error;
fi