Skip to content

Instantly share code, notes, and snippets.

@xiw9
Created October 20, 2016 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xiw9/122ca2de8febd299ec2d23d53174b9c4 to your computer and use it in GitHub Desktop.
Save xiw9/122ca2de8febd299ec2d23d53174b9c4 to your computer and use it in GitHub Desktop.
Dockerfile-cntk
FROM xiw9/archlinux
MAINTAINER Xi Wang <xiwfdu@gmail.com>
LABEL com.nvidia.volumes.needed="nvidia_driver"
ENV CUDA_VERSION 8.0
LABEL com.nvidia.cuda.version="8.0"
RUN echo 'Server = http://mirrors.163.com/archlinux/$repo/os/$arch' > /etc/pacman.d/mirrorlist
RUN echo $' \n\
[archlinuxfr] \n\
SigLevel = Never \n\
Server = http://repo.archlinux.fr/$arch' >> /etc/pacman.conf
RUN pacman -Sy --noconfirm nano cuda yaourt python2-pip base-devel rsync
RUN pacman -Sd --nodeps --noconfirm nvidia-utils
RUN sed -i 's/EUID == 0/EUID == 100/g' /usr/bin/makepkg
RUN yaourt -S python2-numpy-openblas --noconfirm
RUN curl http://[**your mirror url**]/data/cudnn-8.0-linux-x64-v5.1.tgz > /tmp/cudnn-8.0-linux-x64-v5.1.tgz
RUN tar xvzf /tmp/cudnn-8.0-linux-x64-v5.1.tgz -C /opt
RUN ln -s /usr/bin/python2 /usr/bin/python
RUN pacman -Sy --noconfirm opencv ffmpeg openmpi libzip wget git boost python2-scipy nvidia-libgl libx264
RUN wget -q -O - https://github.com/NVlabs/cub/archive/1.4.1.tar.gz | tar -C /usr/local -xzf -
RUN mkdir /usr/local/CNTKCustomMKL && \
wget --no-verbose -O - https://www.cntk.ai/mkl/CNTKCustomMKL-Linux-2.tgz | \
tar -xzf - -C /usr/local/CNTKCustomMKL
RUN pip2 install pytest sphinx-rtd-theme Pillow
ENV BLAS=/usr/lib64/libopenblas.so
ENV LAPACK=/usr/lib64/libopenblas.so
WORKDIR /tmp
RUN wget -q https://archive.archlinux.org/packages/g/gcc-libs/gcc-libs-5.3.0-5-x86_64.pkg.tar.xz && \
wget -q https://archive.archlinux.org/packages/g/gcc/gcc-5.3.0-5-x86_64.pkg.tar.xz && \
wget -q https://archive.archlinux.org/packages/g/gcc-fortran/gcc-fortran-5.3.0-5-x86_64.pkg.tar.xz && \
pacman -U --noconfirm gcc-* && \
rm gcc-*
WORKDIR /cntk
RUN git clone --depth=1 -b master https://github.com/Microsoft/CNTK.git . && \
git submodule update --init --recursive && \
CONFIGURE_OPTS="\
--with-cuda=/opt/cuda \
--with-gdk-include=/opt/cuda/include \
--with-gdk-nvml-lib=/opt/cuda/lib64/stubs \
--with-cudnn=/opt \
--1bitsgd=yes" && \
mkdir -p build/gpu/release && \
cd build/gpu/release && \
../../../configure $CONFIGURE_OPTS --with-openblas=/usr && \
make -j"$(nproc)" all && \
cd ../../.. && \
mkdir -p build-mkl/gpu/release && \
cd build-mkl/gpu/release && \
../../../configure $CONFIGURE_OPTS --with-mkl=/usr/local/CNTKCustomMKL && \
make -j"$(nproc)" all
RUN cd Examples/Image/DataSets/CIFAR-10 && \
python install_cifar10.py && \
cd ../../../..
RUN cd Examples/Image/DataSets/MNIST && \
python install_mnist.py && \
cd ../../../..
RUN mkdir /run/lock
ENV PATH=/cntk/build-mkl/gpu/release/bin:$PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment