Dockerfile.demo_opencl 3.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
# 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"
33
RUN apt-get install -y apt-utils sudo
34 35 36 37 38 39
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"
40
# RUN apt-get install -y libgtest-dev
41 42 43 44
# 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
45
RUN pip3 install setuptools numpy pytest cython decorator scipy tornado psutil xgboost
46 47 48 49 50 51 52 53 54

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"
55
RUN apt-get install -y libcogl-dev libegl1 libgles1 libglfw3-dev
56 57 58 59 60 61 62 63 64
# 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} && \
65
	git clone --depth=1 https://github.com/dmlc/tvm --recursive
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
#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