- 先更新软件源:
apt-get update
- 安装LLVM:
$ wget -c http://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
$ tar xJvf clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
$ vim ~/.bashrc
export PATH=$PATH:/path/to/....../clang+llvm-6.0.1-x86_64-linux-gnu-ubuntu-16.04/bin
$ source ~/.bashrc
3. 安装TVM
git clone --recursive https://github.com/dmlc/tvm
apt-get install -y python python-dev python-setuptools gcc libtinfo-dev zlib1g-dev
mkdir build
cp cmake/config.cmake build
然后,修改build/config.cmake:
set(USE_CUDA OFF) 设置为 set(USE_CUDA ON)
set(USE_LLVM OFF) 设置为 set(USE_LLVM ON)
完成后,运行一下代码:
cd build
cmake ..
make -j4
至此,编译完成,获得很多.so文件,并修改配置:
vim ~/.bashrc
# 写入如下路径:
export TVM_PATH=/home/path/to/tvm
export PYTHONPATH=$TVM_PATH/python:$TVM_PATH/topi/python:$TVM_PATH/nnvm/python:${PYTHONPATH}
# 更新
source ~/.bashrc