-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmaskrcnn_dockerfile_rhel
366 lines (305 loc) · 8.18 KB
/
maskrcnn_dockerfile_rhel
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# mlcc -i RHEL7.6,CUDA10.0,Numpy
# mlcc version: 20181224a: Feb 9 2019
# Install up-to-date RHEL 7.6
FROM registry.access.redhat.com/rhel7.6
RUN set -vx \
\
&& echo "7.6" > /etc/yum/vars/releasever \
&& yum-config-manager --enable rhel-7-server-optional-rpms \
\
&& yum -y -v -t install "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm" \
\
&& yum clean all \
&& yum -y update \
\
&& cd /var/cache \
&& /bin/rm -rf dnf yum
# Install Basic OS Tools
RUN set -vx \
\
&& echo -e '\
set -vx \n\
for (( TRY=1; TRY<=11; TRY++ )); do \n\
yum -y -v install $@ \n\
result=$? \n\
for PKG in $@ ; do \n\
yum list installed | grep "^$PKG" \n\
(( result += $? )) \n\
done \n\
if (( $result == 0 )); then \n\
/bin/rm -rf /var/cache/yum \n\
/bin/rm -rf /var/cache/dnf \n\
exit 0 \n\
fi \n\
sleep 10 \n\
done \n\
exit 1 \n' \
> /tmp/yum_install.sh \
\
&& chmod +x /tmp/yum_install.sh \
\
&& cd /usr/local \
&& /bin/rm -rf lib64 \
&& ln -s lib lib64 \
\
&& /tmp/yum_install.sh \
binutils \
bzip2 \
findutils \
gcc \
gcc-c++ \
gcc-gfortran \
git \
gzip \
make \
patch \
pciutils \
unzip \
vim-enhanced \
wget \
xz \
zip
# Install gcc7.4
RUN set -vx \
&& mkdir -p /tmp/gcc_tmp_build_dir; \
cd /tmp/gcc_tmp_build_dir; \
\
wget -q "https://ftp.gnu.org/gnu/gcc/gcc-5.5.0/gcc-5.5.0.tar.xz"; \
wget -q "https://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2"; \
wget -q "https://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2"; \
wget -q "https://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz"; \
wget -q "https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2"; \
\
tar -xf gcc-5.5.0.tar.xz; \
tar -xf gmp-6.1.0.tar.bz2; \
tar -xf mpfr-3.1.4.tar.bz2; \
tar -xf mpc-1.0.3.tar.gz; \
tar -xf isl-0.18.tar.bz2; \
\
ln -s /tmp/gcc_tmp_build_dir/gmp-6.1.0 gcc-5.5.0/gmp; \
ln -s /tmp/gcc_tmp_build_dir/mpfr-3.1.4 gcc-5.5.0/mpfr; \
ln -s /tmp/gcc_tmp_build_dir/mpc-1.0.3 gcc-5.5.0/mpc; \
ln -s /tmp/gcc_tmp_build_dir/isl-0.18 gcc-5.5.0/isl; \
\
gcc-5.5.0/configure --disable-multilib --enable-languages=c,c++,fortran --prefix=/usr/local; \
make -j`getconf _NPROCESSORS_ONLN`; \
make install-strip; \
\
cd /tmp; \
/bin/rm -rf /tmp/gcc_tmp_build_dir
ENV \
CC="/usr/local/bin/gcc" \
CXX="/usr/local/bin/g++" \
LD_LIBRARY_PATH="/usr/local/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
# Install Python3.6.8
RUN set -vx \
\
&& /tmp/yum_install.sh \
bzip2-devel \
expat-devel \
gdbm-devel \
libdb4-devel \
libffi-devel \
ncurses-devel \
openssl-devel \
readline-devel \
sqlite-devel \
tk-devel \
xz-devel \
zlib-devel \
&& cd /var/cache \
&& /bin/rm -rf dnf yum \
\
&& cd /tmp \
&& wget "https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz" \
&& tar -xf Python*.xz \
&& /bin/rm Python*.xz \
&& cd /tmp/Python* \
&& ./configure \
--enable-optimizations \
--enable-shared \
--prefix=/usr/local \
--with-ensurepip=install \
LDFLAGS="-Wl,-rpath /usr/local/lib" \
&& make -j`getconf _NPROCESSORS_ONLN` install \
\
&& cd /usr/local/include \
&& PYTHON_INC_DIR_NAME=`ls -d python*` \
&& ALT_PYTHON_INC_DIR_NAME=${PYTHON_INC_DIR_NAME%m} \
&& if [ "$ALT_PYTHON_INC_DIR_NAME" != "$PYTHON_INC_DIR_NAME" ]; then \
ln -s "$PYTHON_INC_DIR_NAME" "$ALT_PYTHON_INC_DIR_NAME"; \
fi \
\
&& cd /tmp \
&& /bin/rm -r /tmp/Python* \
\
&& /usr/local/bin/pip3 -v install --upgrade \
pip \
setuptools \
\
&& if python --version > /dev/null 2>&1; then \
whereis python; \
else \
cd /usr/local/bin; \
ln -s python3 python; \
fi
# Install CMake v3.13.3
RUN set -vx \
\
&& cd /tmp \
&& wget "https://cmake.org/files/v3.13/cmake-3.13.3.tar.gz" \
&& tar -xf cmake*.gz \
&& /bin/rm cmake*.gz \
&& cd /tmp/cmake* \
&& ./bootstrap \
&& make -j`getconf _NPROCESSORS_ONLN` install \
&& cd /tmp \
&& /bin/rm -rf /tmp/cmake* \
&& cmake --version
RUN date; df -h
# Install CUDA 10.1
RUN set -vx \
\
&& echo -e '\
exec > /etc/yum.repos.d/cuda.repo \n\
echo [cuda] \n\
echo name=cuda \n\
if [ -f /etc/fedora-release ]; then \n\
echo baseurl="http://developer.download.nvidia.com/compute/cuda/repos/fedora27/x86_64" \n\
else \n\
echo baseurl="http://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64" \n\
fi \n\
echo enabled=1 \n\
echo gpgcheck=0 \n' \
>> /tmp/Make_CUDA_Repo.sh \
&& sh /tmp/Make_CUDA_Repo.sh \
\
&& /tmp/yum_install.sh cuda-10-1 \
\
&& echo -e '\
\n\
export CUDA_HOME=/usr/local/cuda \n\
export CUDA_PATH=/usr/local/cuda \n\
export PATH=/usr/local/cuda/bin:/usr/local/bin:/usr/bin:${PATH} \n\
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \n\
\n' \
>> ~/.bashrc
ENV \
CUDA_VERSION="10.1" \
CUDA_HOME="/usr/local/cuda" \
CUDA_PATH="/usr/local/cuda" \
PATH="/usr/local/cuda/bin:/usr/local/bin:/usr/bin:${PATH:+:${PATH}}" \
LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
# Install NVIDIA NCCL
RUN set -vx \
\
&& cd /tmp \
&& git clone --depth 1 "https://github.com/NVIDIA/nccl.git" --branch=v2.4.6-1 \
&& cd /tmp/nccl \
\
&& if grep install Makefile ; then \
echo "Makefile already has install target"; \
else \
echo "install: src.install" >> Makefile; \
fi \
\
&& make -j`getconf _NPROCESSORS_ONLN` src.build \
&& make -j`getconf _NPROCESSORS_ONLN` install \
\
&& cd /tmp \
&& /bin/rm -rf /tmp/nccl* \
\
&& ldconfig
# Install NVIDIA cuDNN
RUN set -vx \
\
&& cd /tmp \
\
&& echo -e '\
set -vx \n\
if [ -d "/usr/local/cuda-10.1" ]; then \n\
#USING 7.4.1 to match NVIDIA's NGC CUDNN version
CUDNN_VER="v7.5.0/cudnn-10.1-linux-x64-v7.5.0.56.tgz" \n\
elif [ -d "/usr/local/cuda-9.2" ]; then \n\
CUDNN_VER="v7.4.2/cudnn-9.2-linux-x64-v7.4.2.24.tgz" \n\
elif [ -d "/usr/local/cuda-9.1" ]; then \n\
CUDNN_VER="v7.1.3/cudnn-9.1-linux-x64-v7.1.tgz" \n\
elif [ -d "/usr/local/cuda-9.0" ]; then \n\
CUDNN_VER="v7.4.2/cudnn-9.0-linux-x64-v7.4.2.24.tgz" \n\
elif [ -d "/usr/local/cuda-8.0" ]; then \n\
CUDNN_VER="v7.1.3/cudnn-8.0-linux-x64-v7.1.tgz" \n\
else \n\
CUDNN_VER="idk_cudnn_version" \n\
fi \n\
echo "http://developer.download.nvidia.com/compute/redist/cudnn/$CUDNN_VER" \n' \
> /tmp/select_cudnn.sh \
\
&& wget `sh /tmp/select_cudnn.sh` \
\
&& tar -xvf cudnn*.tgz \
&& cd /tmp/cuda \
\
&& mv include/cudnn.h /usr/local/cuda/include \
&& mv lib64/lib* /usr/local/cuda/lib64 \
\
&& cd /tmp \
&& /bin/rm -rf /tmp/cud* \
\
&& ldconfig
RUN date; df -h
# Install Numpy
RUN set -vx \
\
&& /usr/local/bin/pip3 -v install \
numpy==1.17.2 \
\
&& /usr/local/bin/python3 -c 'import numpy'
RUN date; df -h
# Build PyTorch from NGC code
RUN pip install tqdm pyyaml
WORKDIR /opt/pytorch
COPY pytorch .
WORKDIR /opt/pytorch/pytorch
ENV PYTORCH_BUILD_VERSION=1.1.0a0+828a6a3 PYTORCH_VERSION=1.1.0a0+828a6a3 PYTORCH_BUILD_NUMBER=0
RUN python3 setup.py install \
&& cp -a /opt/pytorch/pytorch/third_party/ideep/mkl-dnn/external/mklml_lnx*/lib/* /usr/local/lib64 \
&& python3 setup.py clean \
&& rm -rf /opt/pytorch/pytorch/build
RUN pip3 install pillow==6.2.1
WORKDIR /opt/pytorch/vision
RUN python3 setup.py install \
&& python3 setup.py clean
#Install NVIDIA apex
WORKDIR /opt/pytorch/apex
RUN rm -rf build \
&& python3 setup.py install --cuda_ext --cpp_ext \
&& rm -rf build
RUN yum -y install openmpi3
WORKDIR /opt
ENV COCOAPI_VERSION=2.0+nv0.3.1
RUN export COCOAPI_TAG=$(echo ${COCOAPI_VERSION} | sed 's/^.*+n//') \
&& pip install --no-cache-dir git+https://github.com/nvidia/cocoapi.git@${COCOAPI_TAG}#subdirectory=PythonAPI
# install numactl
# Install dependencies for system configuration logger
RUN yum -y install numactl \
infiniband-diags \
pciutils
# Install Python dependencies
WORKDIR /workspace/object_detection
COPY maskrcnn/requirements.txt .
RUN pip install --no-cache-dir https://github.com/mlperf/training/archive/6289993e1e9f0f5c4534336df83ff199bd0cdb75.zip#subdirectory=compliance \
&& pip install --no-cache-dir -r requirements.txt
# Copy detectron code and build
COPY maskrcnn .
RUN rm -rf pytorch \
&& pip install --verbose -e .
ENV OMP_NUM_THREADS=1
ENV OPENCV_FOR_THREADS_NUM=1
ENV NVIDIA_PYTORCH_VERSION="RHEL"
ENV OPENMPI_VERSION=3.0.2
ENV CUDA_DRIVER_VERSION=418.67
ENV NCCL_VERSION=2.3.7
ENV CUDNN_VERSION=7.4
ENV CUBLAS_VERSION=10.0.130
ENV TRT_VERSION=none
ENV DALI_VERSION=none