-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnvdrun.sh
executable file
·72 lines (58 loc) · 1.88 KB
/
nvdrun.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# nvdrun.sh
if [[ "$1" == "-h" ]] ; then
echo 'nvdrun.sh REGISTRY WORKGROUP FRAMEWORK TAG WORKSPACE [DATASET_DIR: optional]'
echo 'Example: nvdrun.sh XXXX.io tensorflow tensorflow 17.XX test [/tmp/datasets]'
exit 0
fi
if [[ $# -eq 0 ]] ; then
echo 'registry arg missing! - XXXX.io'
exit 0
fi
if [[ $# -eq 1 ]] ; then
echo 'workgroup arg missing! - tensorflow, nvidian, etc.'
exit 0
fi
if [[ $# -eq 2 ]] ; then
echo 'framework arg missing! - tensorflow, caffe2, etc.'
exit 0
fi
if [[ $# -eq 3 ]] ; then
echo 'framework tag arg missing! - 17.XX, latest, etc.'
exit 0
fi
if [[ $# -eq 4 ]] ; then
echo 'workspace arg missing! - workspace/$arg'
exit 0
fi
registry=$1
workgroup=$2
framework=$3
tag=$4
workspace=$5
if [[ $# -eq 5 ]] ; then
:
else
dataset_dir=$6
fi
mkdir -p /tmp/nvdrun/$framework
mkdir -p ~/ipaddrs
mkdir -p ~/nvdruns
ip addr > ~/ipaddrs/"${framework}_docker.ipaddr"
if [ ! -d ~/workspace/$workspace ]; then
echo 'workspace directory does not exist!'
exit 0
fi
if [[ $# -eq 5 ]] ; then
rsync -rv --exclude=.git ~/workspace/$workspace /tmp/nvdrun/$framework > /dev/null 2>&1
nvidia-docker run -v /tmp/nvdrun/$framework:/home/workspace --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 -ti -p 8888:8888 -p 6006:6006 $registry/$workgroup/$framework:$tag /bin/bash
else
if [ ! -d $dataset_dir ]; then
echo 'dataset directory does not exist!'
exit 0
fi
rsync -rv --exclude=.git ~/workspace/$workspace /tmp/nvdrun/$framework > /dev/null 2>&1
nvidia-docker run -v /tmp/nvdrun/$framework:/home/workspace -v $dataset_dir:/datasets --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 -ti -p 8888:8888 -p 6006:6006 $registry/$workgroup/$framework:$tag /bin/bash
fi
rsync -rv --exclude=.git /tmp/nvdrun/$framework ~/nvdruns > /dev/null 2>&1
rm ~/ipaddrs/"${framework}_docker.ipaddr"