-
Notifications
You must be signed in to change notification settings - Fork 9
/
summary.sh
executable file
·220 lines (206 loc) · 10.1 KB
/
summary.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#!/bin/bash
set +x
set -e
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
cd "$(dirname "$0")"
for cmd in bc docker find git grep jq sed xargs; do
! which "$cmd" >/dev/null || continue
printf '\033[31m[ERROR] Missing command "%s".\033[0m\n' "$cmd" >&2
exit 1
done
[ "$DOCKER_IMAGE" ] || DOCKER_IMAGE='roasterproject/centos'
if ! [ "$SUMMARIZING_IN_CONTAINER" ]; then
printf '## New features\n\n'
printf '%s ...\n\n' '-'
printf '## Docker collection\n\n'
for dist in CentOS Debian Ubuntu; do
img="$(sed 's/\/\/*/\//' <<< "/$DOCKER_IMAGE" | sed 's/\/*$//' | sed 's/\/[^\/]*$//' | sed 's/^\///')/$(tr 'A-Z' 'a-z' <<< "$dist")"
! grep "^$(sed 's/\([\\\/\.\-]\)/\\\1/g' <<< "$img"):" <<< "$DOCKER_IMAGE:" >/dev/null || img="$DOCKER_IMAGE"
printf '%s `%s`\n' '-' "$img"
done
printf '\n'
printf '### Size (gzipped/decompressed)\n\n'
for dist in CentOS Debian Ubuntu; do
img="$(sed 's/\/\/*/\//' <<< "/$DOCKER_IMAGE" | sed 's/\/*$//' | sed 's/\/[^\/]*$//' | sed 's/^\///')/$(tr 'A-Z' 'a-z' <<< "$dist")"
! grep "^$(sed 's/\([\\\/\.\-]\)/\\\1/g' <<< "$img"):" <<< "$dist:" || img="$dist"
sudo docker images -q "$img" | grep '[^[:space:]]' >/dev/null || continue
printf '%s %s: %s/%s GiB, %s%% space efficiency\n' \
'-' \
"$dist" \
"$(sudo docker manifest inspect "$img" \
| jq -er '.layers[].size' \
| paste -sd+ - \
| sed 's/\(..*\)/(\1\+2\^29)\/2^30/' \
| bc \
)" \
"$(sudo docker inspect "$img" \
| jq -er '.[0].Size' \
| grep -v 'null' \
| xargs -r printf '(%s+2^29)/2^30\n' \
| bc \
| sed 's/^[[:space:]]*$/N\/A/' \
)" \
"$(DOCKER_IMAGE="$img" ./docker_efficiency.sh 2>&1 >/dev/null \
| grep '\[INFO\]' \
| sed -n 's/.* Space efficiency \([0-9\.]*\) *%.*/\1/p' \
)"
done
printf '\n'
sudo docker run --entrypoint '' --rm -e SUMMARIZING_IN_CONTAINER=true -it -v "$(pwd):$(pwd):ro" "$DOCKER_IMAGE" "$(pwd)/$(basename "$0")"
else
[ ! -e '/etc/os-release' ] || . <(sed 's/^\(..*\)/export DISTRO_\1/' '/etc/os-release')
printf '## Roaster info\n\n'
(
set -e
cd '/etc/roaster/scripts'
git describe --tags | xargs printf '%s Version: %s\n\n' '-'
if ! git diff --exit-code --name-only >/dev/null; then
printf '### Build-time changes\n\n'
printf '```\n'
git --no-pager diff
printf '```\n\n'
fi
)
printf '## Highlights\n\n'
case "$DISTRO_ID" in
"centos" | "fedora" | "rhel" | "scientific")
printf '%s GCC\n' '-'
printf ' - %s: ' "$DISTRO_ID"
! which scl >/dev/null 2>&1 \
|| scl -l \
| grep '^devtoolset\-[1-9][0-9]*' \
| sort -rV \
| xargs -I{} scl enable {} 'gcc --version | head -n1' \
| cut -d' ' -f3 \
| paste -sd/ \
| xargs -r printf '%s (SCL devtoolset) and '
gcc --version | head -n1 | cut -d' ' -f3 | xargs printf '%s\n'
printf '%s Python\n' '-'
printf ' - %s: ' "$DISTRO_ID"
! which scl >/dev/null 2>&1 \
|| scl -l \
| grep '^rh-python[1-9][0-9]*' \
| sort -rV \
| xargs -I{} scl enable {} 'python3 --version' \
| cut -d' ' -f2 \
| paste -sd/ \
| xargs -r printf '%s (SCL rh-python) and '
python3 --version | cut -d' ' -f2 | xargs printf '%s\n'
for tuple in \
'LLVM,roaster-llvm,' \
'CMake,roaster-cmake,' \
'CCache,roaster-ccache,' \
'CUDA,cuda-libraries-devel-*,' \
'cuDNN,libcudnn*-devel, ' \
'TensorRT,libnvinfer-devel, ' \
'NCCL,libnccl-devel, ' \
'OpenMPI,roaster-ompi,' \
'UCX,roaster-ucx, ' \
'Intel MPI,intel-oneapi-mpi-devel,' \
'MKL,intel-oneapi-mkl-devel' \
'Eigen,roaster-eigen,' \
'OpenBLAS,roaster-openblas,' \
'Boost,roaster-boost,' \
'Protobuf,roaster-protobuf,' \
'Pybind,roaster-pybind11,' \
'gRPC,roaster-grpc,' \
'RocksDB,roaster-rocksdb,' \
'TexLive,roaster-texlive,' \
'Qt,qt5-qtbase-devel,' \
'OpenCV,roaster-opencv,'
do
cut -d, -f2 <<< "$tuple," \
| xargs rpm -qa 2>/dev/null \
| sed -n 's/.*\-\([0-9][[:alnum:]\.]*\)\-[0-9][^\-]*$/\1/p' \
| sort -rV \
| head -n1 \
| xargs -r printf '%s- %s %s\n' "$(cut -d, -f3 <<< "$tuple,,")" "$(cut -d, -f1 <<< "$tuple")"
done
;;
"debian" | "linuxmint" | "ubuntu")
printf '%s GCC\n' '-'
find '/usr/bin' -maxdepth 1 -name 'gcc-*' -not -type d \
| xargs -n1 basename \
| grep -e '^gcc$' -e '^gcc-[1-9][0-9]*$' \
| sed 's/$/ \-\-version | head \-n1/' \
| sh \
| cut -d' ' -f4 \
| sort -rV \
| paste -sd/ \
| xargs printf ' - %s: %s\n' "$DISTRO_ID"
printf '%s Python\n' '-'
python3 --version | cut -d' ' -f2 | xargs printf ' - %s: %s\n' "$DISTRO_ID"
for tuple in \
'LLVM,roaster-llvm,' \
'CMake,roaster-cmake,' \
'CCache,roaster-ccache,' \
'CUDA,cuda-libraries-dev-*,' \
'cuDNN,libcudnn*-dev, ' \
'TensorRT,libnvinfer-dev, ' \
'NCCL,libnccl-dev, ' \
'OpenMPI,roaster-ompi,' \
'UCX,roaster-ucx, ' \
'Intel MPI,intel-oneapi-mpi-devel,' \
'MKL,intel-oneapi-mkl-devel' \
'Eigen,roaster-eigen,' \
'OpenBLAS,roaster-openblas,' \
'Boost,roaster-boost,' \
'Protobuf,roaster-protobuf,' \
'Pybind,roaster-pybind11,' \
'gRPC,roaster-grpc,' \
'RocksDB,roaster-rocksdb,' \
'TexLive,roaster-texlive,' \
'Qt,qtbase5-dev,' \
'OpenCV,roaster-opencv,'
do
cut -d, -f2 <<< "$tuple," \
| xargs dpkg -l 2>/dev/null \
| grep '^ii[[:space:]]' \
| sed 's/[[:space:]][[:space:]]*/ /g' \
| cut -d' ' -f3 \
| cut -d- -f1 \
| sort -rV \
| head -n1 \
| xargs -r printf '%s- %s %s\n' "$(cut -d, -f3 <<< "$tuple,,")" "$(cut -d, -f1 <<< "$tuple")"
done
;;
esac
for tuple in \
'ONNX,onnx,' \
'PyTorch,torch,' \
'ONNXRuntime,onnxruntime,'
do
cat <(if which scl >/dev/null 2>&1; then scl enable rh-python38 'python3 -m pip list --format=json'; fi) \
<(python3 -m pip list --format=json) \
| jq -er '.[] | select(."name" == "'"$(cut -d, -f2 <<< "$tuple,")"'").version' \
| head -n1 \
| xargs printf '%s- %s %s\n' "$(cut -d, -f3 <<< "$tuple,,")" "$(cut -d, -f1 <<< "$tuple")"
done
printf '\n'
printf '## Roaster packages\n\n'
printf '```\n'
case "$DISTRO_ID" in
"centos" | "fedora" | "rhel" | "scientific")
rpm -qa 'roaster-*' | sort
;;
"debian" | "linuxmint" | "ubuntu")
dpkg -l 'roaster-*' | grep '^ii' | sed 's/ */ /g' | cut -d' ' -f2,3
;;
esac
printf '```\n\n'
printf '### Nvidia packages\n\n'
printf '```\n'
case "$DISTRO_ID" in
"centos" | "fedora" | "rhel" | "scientific")
rpm -qa 'cuda*' | sort
rpm -qa 'libcudnn*' | sort
rpm -qa 'libnvinfer*' | sort
rpm -qa 'libnccl*' | sort
;;
"debian" | "linuxmint" | "ubuntu")
dpkg -l {cuda,lib{cudnn,nvinfer,nccl}}'*' | grep '^ii' | sed 's/ */ /g' | cut -d' ' -f2,3
;;
esac
printf '```\n\n'
fi
trap - SIGTERM SIGINT EXIT