Tvm
1 Installation
1.1 Build the Shared Library
1.1.1 Requirements
-
A recent c++ compiler supporting C++14 (g++5 or higher)
# We should install gcc-7 and g++-7 because we use cudatoolkit-10. sudo apt install gcc-7 g++-7 # Set current gcc and g++ pointing to gcc-7 and g++-7 # sudo update-alternatives --install <link> <name> <path> <priority> sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7 # sudo update-alternatives --config <name> # Choose the proper priority. sudo update-alternatives --config gcc sudo update-alternatives --config g++
-
Cmake
sudo apt install cmake
-
LLVM 4.0 or higher
sudo apt install llvm-10-dev
1.1.2 Build
-
Create a build directory where tvm is installed and copy the
cmake/config.cmake
to the directory:# In the directory where tvm is installed mkdir build cp cmake/config.cmake build
-
Edit
config.cmake
to customize the compilation options:- Change
set(USE_CUDA OFF)
toset(USE_CUDA ON)
to enable CUDA. - Set
set(USE_GRAPH_RUNTIME ON)
andset(USE_GRAPH_RUNTIME_DEBUG ON)
to help with debugging. - Set
set(USE_LLVM ON)
.
- Change
-
Build the shared library.
# In the directory where tvm is installed cd build cmake .. make -j4
1.2 Python Package Installation
# Add follow commands to ~/.zshrc.
export TVM_HOME=/path/to/tvm
export PYTHONPATH=$TVM_HOME/python:$PYTHONPATH
1.3 Dependences
-
Use RPC tracker:
conda install tornado
-
Test c++ with GTest:
git clone git@github.com:google/googletest.git cd googletest mkdir build cd build cmake .. make sudo make install