2018-09-29 02:50:48 +03:00
|
|
|
# USAGE: sudo docker build libs/tvm -f libs/tvm/docker/Dockerfile.ocl -t l4b/tvm:ocl
|
|
|
|
|
|
|
|
# REFERENCE: https://docs.docker.com/engine/reference/builder
|
|
|
|
|
|
|
|
FROM ubuntu:18.04
|
|
|
|
|
|
|
|
RUN echo "Labelling this image"
|
|
|
|
LABEL Description="Docker image for TVM built with OpenCL & OpenGL support"
|
|
|
|
|
|
|
|
RUN echo "Preparing to install dependencies"
|
|
|
|
RUN apt-get update
|
|
|
|
# ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
|
|
|
|
|
|
|
RUN echo "Installing utility libraries"
|
2018-10-05 08:54:31 +03:00
|
|
|
RUN apt-get install -y apt-utils sudo
|
2018-09-29 02:50:48 +03:00
|
|
|
RUN apt-get install -y cmake g++ llvm
|
|
|
|
RUN apt-get install -y git
|
|
|
|
# make wget unzip libtinfo-dev libz-dev libcurl4-openssl-dev
|
|
|
|
RUN apt-get install -y libopenblas-dev
|
|
|
|
|
|
|
|
# RUN echo "Installing gtest"
|
2018-10-05 08:54:31 +03:00
|
|
|
# RUN apt-get install -y libgtest-dev
|
2018-09-29 02:50:48 +03:00
|
|
|
# RUN cd /usr/src/gtest && cmake CMakeLists.txt && make && cp *.a /usr/lib
|
|
|
|
|
|
|
|
RUN echo "Installing Python"
|
|
|
|
RUN apt-get install -y python3-dev python3-pip
|
|
|
|
RUN pip3 install setuptools numpy nose-timer cython decorator scipy tornado psutil xgboost
|
|
|
|
|
|
|
|
RUN echo "Installing Jupyter notebook"
|
|
|
|
RUN pip3 install matplotlib Image Pillow jupyter[notebook]
|
|
|
|
|
|
|
|
RUN echo "Installing OpenCL libraries"
|
|
|
|
RUN apt-get install -y libviennacl-dev mesa-opencl-icd ocl-icd-opencl-dev clinfo
|
|
|
|
RUN apt-get install -y libclblas-dev libclfft-dev libclsparse-dev
|
|
|
|
|
|
|
|
RUN echo "Installing OpenGL libraries"
|
2018-10-05 08:54:31 +03:00
|
|
|
RUN apt-get install -y libcogl-dev libegl1 libgles1 libglfw3-dev
|
2018-09-29 02:50:48 +03:00
|
|
|
# libglew-dev
|
|
|
|
|
|
|
|
RUN echo "Upgrading dependencies"
|
|
|
|
RUN apt-get upgrade -y
|
|
|
|
|
|
|
|
RUN echo "Cloning TVM source & submodules"
|
|
|
|
ENV TVM_PAR_DIR="/usr"
|
|
|
|
RUN mkdir -p TVM_PAR_DIR && \
|
|
|
|
cd ${TVM_PAR_DIR} && \
|
|
|
|
git clone https://github.com/dmlc/tvm --recursive
|
|
|
|
#RUN git submodule update --init --recursive
|
|
|
|
|
|
|
|
|
|
|
|
RUN echo "Building TVM"
|
|
|
|
#USE_BLAS: "openblas" | "mkl" | "atlas" | "apple" | "none"
|
|
|
|
ENV TVM_HOME="/usr/tvm"
|
|
|
|
ENV TVM_BUILD_DIR="${TVM_HOME}/build"
|
|
|
|
RUN mkdir -p ${TVM_BUILD_DIR} && \
|
|
|
|
cd ${TVM_BUILD_DIR} && \
|
|
|
|
cmake .. -DUSE_BLAS=openblas -DUSE_LLVM=ON -DUSE_OPENCL=ON -DUSE_OPENGL=ON && \
|
|
|
|
make -j6
|
|
|
|
|
|
|
|
RUN echo "Building Python package"
|
|
|
|
ENV PYTHONPATH=${TVM_HOME}/python:${TVM_HOME}/topi/python:${TVM_HOME}/nnvm/python:${PYTHONPATH}
|
|
|
|
RUN cd ${TVM_HOME}/python && python3 setup.py install --user
|
|
|
|
RUN cd ${TVM_HOME}/topi/python && python3 setup.py install --user
|
|
|
|
RUN cd ${TVM_HOME}/nnvm/python && python3 setup.py install --user
|