forked from NVIDIA/DALI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.deps
150 lines (135 loc) · 6.7 KB
/
Dockerfile.deps
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
#########################################################################################
## Stage 1: build DALI dependencies
## We would prefer to use publicly maintained manylinux1 (CentOS 5 derivative), but
## there are CXX11 ABI problems with the rh-devtoolset2 included with it, so we
## have switched to a "manylinux3" base that is just a minimally altered manylinux1
## built from CentOS 7 (w/ devtoolset3) instead of CentOS 5. You can switch back
## to manylinux1 (or any other base you like) by changing FROM_IMAGE_NAME below
## or by passing an argument of the form `--build-arg FROM_IMAGE_NAME=myimage:mytag`
## to `docker build -f Dockerfile.deps ... .`
#########################################################################################
#ARG FROM_IMAGE_NAME=quay.io/pypa/manylinux1_x86_64
ARG FROM_IMAGE_NAME=gitlab-master.nvidia.com:5005/dl/dali/manylinux:manylinux3_x86_64
FROM ${FROM_IMAGE_NAME}
# Install yum Dependencies
RUN yum install -y zip wget yasm
# Don't want the short-unicode version for Python 2.7
RUN rm -f /opt/python/cp27-cp27m
# Boost
RUN BOOST_VERSION=1.66.0 && \
cd /usr/local && \
curl -L https://dl.bintray.com/boostorg/release/1.66.0/source/boost_${BOOST_VERSION//./_}.tar.gz | tar -xzf - && \
ln -s ../boost_${BOOST_VERSION//./_}/boost include/boost
# CMake
RUN CMAKE_VERSION=3.5 && \
CMAKE_BUILD=3.5.0 && \
curl -L https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_BUILD}.tar.gz | tar -xzf - && \
cd /cmake-${CMAKE_BUILD} && \
./bootstrap --parallel=$(grep ^processor /proc/cpuinfo | wc -l) && \
make -j"$(grep ^processor /proc/cpuinfo | wc -l)" install && \
rm -rf /cmake-${CMAKE_BUILD}
# protobuf v3.5.1
RUN PROTOBUF_VERSION=3.5.1 && \
curl -L https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-all-${PROTOBUF_VERSION}.tar.gz | tar -xzf - && \
cd /protobuf-${PROTOBUF_VERSION} && \
./autogen.sh && \
./configure CXXFLAGS="-fPIC" --prefix=/usr/local --disable-shared 2>&1 > /dev/null && \
make -j"$(grep ^processor /proc/cpuinfo | wc -l)" install 2>&1 > /dev/null && \
rm -rf /protobuf-${PROTOBUF_VERSION}
# LMDB
COPY docker/Makefile-lmdb.patch /tmp
RUN LMDB_VERSION=0.9.22 && \
git clone -b LMDB_${LMDB_VERSION} --single-branch https://github.com/LMDB/lmdb && \
cd /lmdb/libraries/liblmdb && \
patch -p3 < /tmp/Makefile-lmdb.patch && \
rm -f /tmp/Makefile-lmdb.patch && \
make -j"$(grep ^processor /proc/cpuinfo | wc -l)" install && \
rm -rf /lmdb
# OpenCV
RUN OPENCV_VERSION=3.4.3 && \
curl -L https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.tar.gz | tar -xzf - && \
cd /opencv-${OPENCV_VERSION} && mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_SHARED_LIBS=OFF \
-DWITH_CUDA=OFF -DWITH_1394=OFF -DWITH_IPP=OFF -DWITH_OPENCL=OFF -DWITH_GTK=OFF \
-DBUILD_DOCS=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_PNG=ON \
-DBUILD_opencv_cudalegacy=OFF -DBUILD_opencv_stitching=OFF .. && \
make -j"$(grep ^processor /proc/cpuinfo | wc -l)" install && \
rm -rf /opencv-${OPENCV_VERSION}
# libjpeg-turbo
#
# Note: the preceding OpenCV installation intentionally does NOT use libjpeg-turbo.
# DALI will directly call libjpeg-turbo first, and if it fails, DALI will fall back
# to OpenCV, which in turn will call its bundled (built-from-source) libjpeg.
# To be extra sure OpenCV doesn't pick up libjpeg-turbo (in which case we'd have no
# fallback), libjpeg-turbo is built and installed _after_ OpenCV.
#
RUN JPEG_TURBO_VERSION=1.5.3 && \
curl -L https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_TURBO_VERSION}.tar.gz | tar -xzf - && \
cd /libjpeg-turbo-${JPEG_TURBO_VERSION} && \
autoreconf -fiv && \
./configure --enable-shared --prefix=/usr/local 2>&1 >/dev/null && \
make -j"$(grep ^processor /proc/cpuinfo | wc -l)" install 2>&1 >/dev/null && \
rm -rf /libjpeg-turbo-${JPEG_TURBO_VERSION}
# Clang
RUN CLANG_VERSION=6.0.1 && \
cd /usr/local && \
wget http://releases.llvm.org/${CLANG_VERSION}/clang+llvm-${CLANG_VERSION}-x86_64-linux-sles11.3.tar.xz && \
tar -xJf clang+llvm-${CLANG_VERSION}-x86_64-linux-sles11.3.tar.xz --strip 1 && \
rm clang+llvm-${CLANG_VERSION}-x86_64-linux-sles11.3.tar.xz
ENV NVIDIA_DRIVER_CAPABILITIES=video,compute,utility
# FMpeg
RUN FFMPEG_VERSION=3.4.2 && \
cd /tmp && wget -q http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
tar xf ffmpeg-$FFMPEG_VERSION.tar.bz2 && \
rm ffmpeg-$FFMPEG_VERSION.tar.bz2 && \
cd ffmpeg-$FFMPEG_VERSION && \
./configure \
--prefix=/usr/local \
--disable-static \
--disable-all \
--disable-autodetect \
--disable-iconv \
--enable-shared \
--enable-avformat \
--enable-avcodec \
--enable-avfilter \
--enable-protocol=file \
--enable-demuxer=mov,matroska \
--enable-bsf=h264_mp4toannexb,hevc_mp4toannexb && \
make -j"$(grep ^processor /proc/cpuinfo | wc -l)" && make install && \
cd /tmp && rm -rf ffmpeg-$FFMPEG_VERSION
# CUDA
ARG USE_CUDA_VERSION=9
# 9.x
RUN if [ ${USE_CUDA_VERSION} == "9" ] ; then \
# CUDA sdk
CUDA_VERSION=9.0 && \
CUDA_BUILD=9.0.176_384.81 && \
curl -LO https://developer.nvidia.com/compute/cuda/${CUDA_VERSION}/Prod/local_installers/cuda_${CUDA_BUILD}_linux-run && \
chmod +x cuda_${CUDA_BUILD}_linux-run && \
./cuda_${CUDA_BUILD}_linux-run --silent --no-opengl-libs --toolkit && \
rm -f cuda_${CUDA_BUILD}_linux-run; \
# nvJpeg
NVJPEG_VERSION=0.2.0 && \
NVJPEG_BUILD=9.0-v${NVJPEG_VERSION} && \
curl -L https://developer.download.nvidia.com/compute/redist/libnvjpeg/cuda-linux64-nvjpeg-${NVJPEG_BUILD}.tar.gz | tar -xzf - && \
cd /cuda-linux64-nvjpeg/ && \
mv lib64/libnvjpeg*.a* /usr/local/lib/ && \
mv include/nvjpeg.h /usr/local/include/ && \
rm -rf /cuda-linux64-nvjpeg; \
# 10.x
elif [ ${USE_CUDA_VERSION} == "10" ] ; then \
# CUDA sdk
CUDA_VERSION=10.0 && \
CUDA_BUILD=10.0.130_410.48 && \
curl -LO https://developer.nvidia.com/compute/cuda/${CUDA_VERSION}/Prod/local_installers/cuda_${CUDA_BUILD}_linux && \
chmod +x cuda_${CUDA_BUILD}_linux && \
./cuda_${CUDA_BUILD}_linux --silent --no-opengl-libs --toolkit && \
rm -f cuda_${CUDA_BUILD}_linux; \
# CUDA 10 has nvJpeg embedded, no need to download it separately
else \
echo "**************************************************************" && \
echo "Wrong value of 'USE_CUDA_VERSION', only 9 and 10 are supported" && \
echo "**************************************************************" && exit 1 ;\
fi