forked from flashlight/wav2letter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-CUDA
142 lines (138 loc) · 6.1 KB
/
Dockerfile-CUDA
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
# ==================================================================
# module list
# ------------------------------------------------------------------
# Ubuntu 16.04
# CUDA 9.2
# CuDNN 7-dev
# arrayfire 3.6.2 (git, CUDA backend)
# OpenMPI latest (apt)
# flashlight master (git, CUDA backend)
# python 3.6 (apt)
# libsndfile bef2abc (git)
# MKL 2018.4.057 (apt)
# FFTW latest (apt)
# KenLM e47088d (git)
# GLOG latest (apt)
# gflags latest (apt)
# python 3.6 (apt)
# ==================================================================
FROM nvidia/cuda:9.2-cudnn7-devel-ubuntu16.04
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
rm -rf /var/lib/apt/lists/* \
/etc/apt/sources.list.d/cuda.list \
/etc/apt/sources.list.d/nvidia-ml.list && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
build-essential \
ca-certificates \
cmake \
wget \
git \
vim \
emacs \
nano \
htop \
g++ \
# ssh for OpenMPI
openssh-server openssh-client \
# OpenMPI
libopenmpi-dev libomp-dev \
# nccl: for flashlight
libnccl2 libnccl-dev \
# for libsndfile
autoconf automake autogen build-essential libasound2-dev \
libflac-dev libogg-dev libtool libvorbis-dev pkg-config python \
# for Intel's Math Kernel Library (MKL)
cpio \
# FFTW
libfftw3-dev \
# for kenlm
zlib1g-dev libbz2-dev liblzma-dev libboost-all-dev \
# gflags
libgflags-dev libgflags2v5 \
# for glog
libgoogle-glog-dev libgoogle-glog0v5 \
# for receipts data processing
sox && \
# ==================================================================
# python (for receipts data processing)
# ------------------------------------------------------------------
PIP_INSTALL="python3 -m pip --no-cache-dir install --upgrade" && \
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
software-properties-common \
&& \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
python3.6 \
python3.6-dev \
&& \
wget -O ~/get-pip.py \
https://bootstrap.pypa.io/get-pip.py && \
python3.6 ~/get-pip.py && \
ln -s /usr/bin/python3.6 /usr/local/bin/python3 && \
ln -s /usr/bin/python3.6 /usr/local/bin/python && \
$PIP_INSTALL \
setuptools \
&& \
$PIP_INSTALL \
sox \
tqdm && \
# ==================================================================
# arrayfire https://github.com/arrayfire/arrayfire/wiki/
# ------------------------------------------------------------------
cd /tmp && git clone --recursive https://github.com/arrayfire/arrayfire.git && \
cd arrayfire && git checkout v3.6.2 && \
mkdir build && cd build && \
CXXFLAGS=-DOS_LNX cmake .. -DCMAKE_BUILD_TYPE=Release -DAF_BUILD_CPU=OFF -DAF_BUILD_OPENCL=OFF -DAF_BUILD_EXAMPLES=OFF && \
make -j8 && \
make install && \
# ==================================================================
# flashlight https://github.com/facebookresearch/flashlight.git
# ------------------------------------------------------------------
# If the driver is not found (during docker build) the cuda driver api need to be linked against the
# libcuda.so stub located in the lib[64]/stubs directory
ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/lib/x86_64-linux-gnu/libcuda.so.1 && \
cd /root && git clone --recursive https://github.com/facebookresearch/flashlight.git && \
cd /root/flashlight && mkdir -p build && \
cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DFLASHLIGHT_BACKEND=CUDA && \
make -j8 && make install && \
# ==================================================================
# libsndfile https://github.com/erikd/libsndfile.git
# ------------------------------------------------------------------
cd /tmp && git clone https://github.com/erikd/libsndfile.git && \
cd libsndfile && git checkout bef2abc9e888142203953addc31c50a192e496e5 && \
./autogen.sh && ./configure --enable-werror && \
make && make check && make install && \
# ==================================================================
# 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 && \
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 && \
# ==================================================================
# KenLM https://github.com/kpu/kenlm
# ------------------------------------------------------------------
cd /root && git clone https://github.com/kpu/kenlm.git && \
cd kenlm && git checkout e47088ddfae810a5ee4c8a9923b5f8071bed1ae8 && \
mkdir build && cd build && \
cmake .. && \
make -j8 && make install && \
# ==================================================================
# config & cleanup
# ------------------------------------------------------------------
ldconfig && \
apt-get clean && \
apt-get autoremove && \
rm -rf /var/lib/apt/lists/* /tmp/*
RUN mkdir /root/wav2letter
COPY . /root/wav2letter
# ==================================================================
# wav2letter with GPU backend
# ------------------------------------------------------------------
RUN export MKLROOT=/opt/intel/mkl && export KENLM_ROOT_DIR=/root/kenlm && \
cd /root/wav2letter && mkdir -p build && \
cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DW2L_CRITERION_BACKEND=CUDA && \
make -j8