CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ai-forever

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: ai-forever/sber-swap
Path: blob/main/apex/tests/docker_extension_builds/run.sh
Views: 792
1
#!/bin/bash
2
3
print_banner() {
4
printf "\n\n\n\e[30m\e[42m$1\e[0m\n\n\n\n"
5
}
6
7
print_green() {
8
printf "\e[30m\e[42m$1\e[0m\n"
9
}
10
11
print_red() {
12
printf "\e[30m\e[41m$1\e[0m\n"
13
}
14
15
images=(
16
"gitlab-master.nvidia.com:5005/dl/dgx/pytorch:19.08-py3-devel"
17
"gitlab-master.nvidia.com:5005/dl/dgx/pytorch:master-py3-devel"
18
"pytorch/pytorch:nightly-devel-cuda10.0-cudnn7"
19
"pytorch/pytorch:1.1.0-cuda10.0-cudnn7.5-devel"
20
"pytorch/pytorch:1.0.1-cuda10.0-cudnn7-devel"
21
"pytorch/pytorch:1.0-cuda10.0-cudnn7-devel"
22
"pytorch/pytorch:nightly-devel-cuda9.2-cudnn7"
23
)
24
25
branch="master"
26
27
# Associative array for exit codes
28
declare -A exit_codes
29
for image in images
30
do
31
exit_codes[$image]="None"
32
done
33
34
for image in "${images[@]}"
35
do
36
print_banner "$image"
37
set -x
38
docker pull $image
39
# Trying python setup.py install instead of pip install to ensure direct access to error codes.
40
# Maybe pip install would be ok too but this works.
41
docker run --runtime=nvidia --rm $image /bin/bash -c "yes | pip uninstall apex; yes | pip uninstall apex; git clone https://github.com/NVIDIA/apex.git; cd apex; git checkout $branch; set -e; python setup.py install --cuda_ext --cpp_ext"
42
exit_code=$?
43
set +x
44
if [ $exit_code != 0 ]
45
then
46
print_red "Exit code: $exit_code"
47
else
48
print_green "Exit code: $exit_code"
49
fi
50
exit_codes[$image]=$exit_code
51
done
52
53
success=0
54
for image in "${images[@]}"
55
do
56
exit_code=${exit_codes[$image]}
57
if [ $exit_code != 0 ]
58
then
59
print_red "$image : $exit_code"
60
success=1
61
else
62
print_green "$image : $exit_code"
63
fi
64
done
65
66
if [ $success != 0 ]
67
then
68
print_red "Overall status: failure"
69
else
70
print_green "Overall status: success"
71
fi
72
73
exit $success
74
75