forked from flashlight/flashlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-CPU-Base
89 lines (87 loc) · 4.45 KB
/
Dockerfile-CPU-Base
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
# ==================================================================
# module list
# ------------------------------------------------------------------
# Ubuntu 18.04
# OpenMPI latest (apt)
# cmake 3.10 (git)
# MKL 2018.4-057 (apt)
# arrayfire 3.7.1 (git, CPU backend)
# MKLDNN 4bdffc2 (git)
# Gloo b7e0906 (git)
# ==================================================================
FROM ubuntu:18.04
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
build-essential \
ca-certificates \
wget \
git \
vim \
emacs \
nano \
htop \
g++ \
# for MKL
apt-transport-https \
gpg-agent gnupg2 \
# for arrayfire CPU backend
# OpenBLAS
libopenblas-dev libfftw3-dev liblapacke-dev \
# ATLAS
libatlas3-base libatlas-base-dev libfftw3-dev liblapacke-dev \
# ssh for OpenMPI
openssh-server openssh-client \
# OpenMPI
libopenmpi-dev libomp-dev openmpi-bin && \
# ==================================================================
# cmake 3.10 (for MKLDNN)
# ------------------------------------------------------------------
apt-get purge -y cmake && \
# for cmake
DEBIAN_FRONTEND=noninteractive $APT_INSTALL zlib1g-dev libcurl4-openssl-dev && \
cd /tmp && wget https://cmake.org/files/v3.10/cmake-3.10.3.tar.gz && \
tar -xzvf cmake-3.10.3.tar.gz && cd cmake-3.10.3 && \
./bootstrap --system-curl && \
make -j$(nproc) && make install && cmake --version && \
# ==================================================================
# MKL https://software.intel.com/en-us/mkl
# ------------------------------------------------------------------
cd /tmp && wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
# for build in March 2020 this row should be removed to prevent from the error
# E: Failed to fetch https://apt.repos.intel.com/intelpython/binary/Packages Writing more data than expected (15520 > 15023) E: Some index files failed to download. They have been ignored, or old ones used instead.
# wget https://apt.repos.intel.com/setup/intelproducts.list -O /etc/apt/sources.list.d/intelproducts.list && \
sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list' && \
apt-get update && DEBIAN_FRONTEND=noninteractive $APT_INSTALL intel-mkl-64bit-2018.4-057 && \
export MKLROOT=/opt/intel/mkl && \
# ==================================================================
# arrayfire with CPU backend https://github.com/arrayfire/arrayfire/wiki/
# ------------------------------------------------------------------
cd /tmp && git clone --recursive https://github.com/arrayfire/arrayfire.git && \
wget https://dl.bintray.com/boostorg/release/1.70.0/source/boost_1_70_0.tar.gz && tar xf boost_1_70_0.tar.gz && \
cd arrayfire && git checkout v3.7.1 && git submodule update --init --recursive && \
mkdir build && cd build && \
CXXFLAGS=-DOS_LNX cmake .. -DCMAKE_BUILD_TYPE=Release -DAF_BUILD_CUDA=OFF -DAF_BUILD_OPENCL=OFF -DAF_BUILD_EXAMPLES=OFF -DBOOST_INCLUDEDIR=/tmp/boost_1_70_0 && \
make -j$(nproc) && make install && \
# ==================================================================
# MKLDNN https://github.com/intel/mkl-dnn/
# ------------------------------------------------------------------
cd /tmp && git clone https://github.com/intel/mkl-dnn.git && \
cd mkl-dnn && git checkout 4bdffc2 && mkdir -p build && cd build && \
cmake .. -DMKLDNN_USE_MKL=FULL && \
make -j$(nproc) && make install && \
# ==================================================================
# Gloo https://github.com/facebookincubator/gloo.git
# ------------------------------------------------------------------
cd /tmp && git clone https://github.com/facebookincubator/gloo.git && \
cd gloo && git checkout b7e0906 && mkdir build && cd build && \
cmake .. -DUSE_MPI=ON && \
make -j$(nproc) && make install && \
# ==================================================================
# config & cleanup
# ------------------------------------------------------------------
ldconfig && \
apt-get clean && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/* /tmp/* ~/*