Skip to content

Instantly share code, notes, and snippets.

@rahul003
Last active June 1, 2018 23:31
Show Gist options
  • Save rahul003/921c6a39406c6be090f51b840d132af5 to your computer and use it in GitHub Desktop.
Save rahul003/921c6a39406c6be090f51b840d132af5 to your computer and use it in GitHub Desktop.
Setup Fast Build for MXNet on DLAMI v1 Ubuntu
sudo apt-get install -y ninja-build ccache
# ccache for better cached compilers
echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc
source ~/.bashrc
ccache -F 0
ccache -M 0
# OPTIONAL
# llvm-lit for omp build
sudo apt-get install -y python-pip
pip install lit
# OPTIONAL?
# remove protoc 3.x
conda uninstall libprotobuf
# now uses /usr/bin/protoc of version 2.6.1 which works with
# install openblas
sudo apt-get install -y libopenblas-dev liblapack-dev
# mkl full
mkdir -p ~/deps && cd ~/deps
wget http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/12414/l_mkl_2018.1.163.tgz
tar -xvf l_mkl_2018.1.163.tgz
bash l_mkl_2018.1.163/install.sh
# mkl old
# bash prepare_mkl.sh
# mkldnn
bash prepare_mkldnn.sh
# install ZMQ for multi machine training
sudo apt-get install -y libzmq3-dev
# jemalloc for faster mallocs
sudo apt-get install -y libjemalloc-dev
# libopencv
sudo apt-get install -y libopencv-dev
#libjpegturbo
sudo apt-get install -y autoconf automake libtool nasm && \
JPEG_TURBO_VERSION=1.5.2 && \
wget -q -O - 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 2>&1 >/dev/null && \
sudo make -j"$(nproc)" install 2>&1 >/dev/null && \
rm -rf libjpeg-turbo-${JPEG_TURBO_VERSION}
# set LIBJPEG_TURBO_PATH to /usr for confi.g.k
# USENCCL
sudo apt-key add /var/nccl-repo-2.1.15-ga-cuda9.0/7fa2af80.pub
#install network deb for nccl
sudo apt update
sudo apt install libnccl2 libnccl-dev
# cmake newer
mkdir -p ~/deps && cd ~/deps && wget https://cmake.org/files/v3.10/cmake-3.10.2-Linux-x86_64.sh && bash cmake-3.10.2-Linux-x86_64.sh
echo 'export PATH="~/deps/cmake-3.10.2-Linux-x86_64/bin/:$PATH"' | tee -a ~/.bashrc
# MKL: -DMKL_INCLUDE_DIR=/opt/intel/mkl/include -DMKLML_GNU_LIBRARY=../mkl/lib/libmklml_gnu.so
# Install all deps on all machines
# while read -u 10 host; do ssh -o "StrictHostKeyChecking no" $host "sudo apt-get -y install python-pip libopenblas-dev liblapack-dev libzmq3-dev libjemalloc-dev"; done 10<~/hosts
mkdir -p build
cmake -DCMAKE_BUILD_TYPE=Release -DUSE_GPERFTOOLS=OFF -DUSE_DIST_KVSTORE=ON -DUSE_SIGNAL_HANDLER=ON -GNinja .. && ninja
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment