-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.centos
107 lines (88 loc) · 3.9 KB
/
Dockerfile.centos
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
# syntax=docker/dockerfile:experimental
# Build this image: docker build -t halo:[version] .
#
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
RUN yum install -y zlib-devel curl-devel wget make bzip2 python3 \
which unzip git && \
yum clean all
RUN yum install -y centos-release-scl && \
yum install -y devtoolset-7-gcc-c++-7.3.1 && \
yum clean all
ARG BASE_IMAGE=${BASE_IMAGE}
SHELL ["/bin/bash", "-c"]
ENV NV_NVINFER_DEV_VERSION=8.2.5-1.cuda11.4
RUN if [[ ${BASE_IMAGE} =~ nvidia ]]; then \
yum update -y && \
yum install -y libnvinfer-plugin-devel-${NV_NVINFER_DEV_VERSION} \
libnvinfer-plugin8-${NV_NVINFER_DEV_VERSION} \
libnvinfer-devel-${NV_NVINFER_DEV_VERSION} \
libnvinfer8-${NV_NVINFER_DEV_VERSION} && \
yum clean all ; \
fi
SHELL ["/usr/bin/scl", "enable", "devtoolset-7"]
# Install cmake
ENV CMAKE_VERSION=3.16.7
WORKDIR /tmp/cmake
RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz && \
tar zxf cmake-${CMAKE_VERSION}.tar.gz && \
cd cmake-${CMAKE_VERSION} && \
./bootstrap --system-curl --parallel=48 && \
make -j all && \
make install && \
rm -rf /tmp/cmake
# Install Ninja
RUN cd /tmp && git clone https://github.com/ninja-build/ninja.git && \
cd ninja && \
git checkout v1.10.2 && cmake -G "Unix Makefiles" . && make -j && make install && \
rm -fr /tmp/ninja
# INSTALL Protobuf (static)
RUN cd /tmp && \
git clone --depth=1 https://github.com/protocolbuffers/protobuf.git -b v3.9.1 && \
cd protobuf/cmake && \
cmake -G Ninja . -Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_BUILD_SHARED_LIBS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON && \
ninja install && \
rm -fr /tmp/protobuf
# INSTALL glog
RUN cd /tmp && \
git clone --depth=1 https://github.com/google/glog.git -b v0.4.0 && \
cd glog && \
cmake -H. -Bbuild -G "Unix Makefiles" && cmake --build build && \
cmake --build build --target install && ldconfig && \
rm -fr /tmp/glog
# Build & Install DNNL (MKLDNN)
RUN cd /tmp && git clone --depth=1 https://github.com/intel/mkl-dnn.git --branch v1.7-rc && \
cd /tmp/mkl-dnn && \
cmake -G Ninja -DDNNL_BUILD_EXAMPLES=OFF -DDNNL_BUILD_TESTS=OFF -DDNNL_ENABLE_PRIMITIVE_CACHE=ON -DCMAKE_INSTALL_PREFIX=/opt/dnnl && \
ninja install
# Install Eigen
RUN cd /tmp && wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.bz2 && \
tar jxvf eigen-3.4.0.tar.bz2 && mv eigen-3.4.0 /opt
# Install XNNPack
RUN cd /tmp && git clone https://github.com/google/XNNPACK.git && \
cd /tmp/XNNPACK && git checkout -b tmp 90db69f681ea9abd1ced813c17c00007f14ce58b && \
mkdir /tmp/xnn_build_static && cd /tmp/xnn_build_static && \
cmake -G Ninja ../XNNPACK -DXNNPACK_LIBRARY_TYPE=static -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DXNNPACK_BUILD_TESTS=OFF -DXNNPACK_BUILD_BENCHMARKS=OFF -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/XNNPACK && \
ninja install
# Install Flatbuffer
RUN cd /tmp && \
git clone --depth=1 https://github.com/google/flatbuffers.git -b v1.12.0 && \
cd flatbuffers && \
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_BUILD_SHAREDLIB=ON && make -j && make install && \
rm -fr /tmp/flatbuffers
# Install ccache
RUN cd /tmp && \
wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/c/ccache-3.7.7-1.el7.x86_64.rpm && \
rpm -i ccache-3.7.7-1.el7.x86_64.rpm && rm /tmp/*.rpm
ENV CCACHE_DIR=/cache
RUN rpm --rebuilddb && yum install -y rpm-build && yum clean all
# Install models & test cases
COPY --from=registry-intl.us-west-1.aliyuncs.com/computation/halo:v0.1-model-zoo /models /models
COPY --from=registry-intl.us-west-1.aliyuncs.com/computation/halo:v0.1-model-zoo /unittests /unittests
WORKDIR /host
RUN echo "source scl_source enable devtoolset-7" >> /etc/bashrc
#ENTRYPOINT ["/usr/bin/scl", "enable", "devtoolset-7"]