Skip to content

Commit

Permalink
Merged in documents/sima.md (pull request apache#1)
Browse files Browse the repository at this point in the history
Updated SIMA.md to make sure we could build and link TVM correctly on
  • Loading branch information
JoeyChou-SiMa-ai authored and Mikael Sevenier committed Apr 15, 2020
2 parents 821540a + 01a81b5 commit 1ca5de0
Showing 1 changed file with 40 additions and 21 deletions.
61 changes: 40 additions & 21 deletions SIMA.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,79 +6,98 @@ The original instructions to install TVM are here: https://docs.tvm.ai/install/f
Here, we will simplify the steps so to get you started quickly on your Macs.

# Pre-requisites
Install Homebrew, miniconda, create a tvm environment.
## Prepare for conda environment
Install `Homebrew`, `miniconda`, and create a tvm environment under conda.

You can use pyenv too, just make sure to create a tvm environment.
You can use `pyenv` too, just make sure to create a tvm environment.

```shell script
# install Homebrew
```shell
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew update; brew upgrade
brew update && brew upgrade

# Install miniconda
brew cask install miniconda

# open a new terminal with Command-N
# Source conda.sh whenever opening a new terminal(Path to conda.sh may differ)
echo ". /usr/local/Caskroom/miniconda/base/etc/profile.d/conda.sh" >> ~/.bash_profile

# create tvm environment
conda create -n tvm
# Open a new terminal with Command-N or make sure you source ~/.bash_profile

# Create tvm environment, make sure we use python3.7 (for now)
conda create -n tvm python=3.7
conda activate tvm
```

Now we are in tvm environment!

## Install required libraries
Since Macs don't have Clang/LLVM with OpenMP, we install it
```shell script
conda install -y -c conda-forge llvmdev llvm-openmp llvm-tools clang clang-tools clang-dev
```shell
conda install -y -c conda-forge llvmdev llvm-openmp llvm-tools clang clang-tools clangdev
```

Install ANTLR parser for TensorFlow parsing
```shell script
```shell
conda install -y -c conda-forge antlr antlr-python-runtime
```

Install build tools (can also be done with brew for system-wide)
```shell script
```shell
conda install -y ninja cmake
```

Install misc packages
```shell script
```shell
conda install -y -c conda-forge numpy decorator attrs tornado xgboost psutil cython
```

Install glfw3
```shell
conda install -y -c menpo glfw3
```

Not required by useful
```shell script
```shell
conda install -y -c conda-forge matplotlib opencv py-opencv yaml yapf python.app h5py hdf5 cffi
```

Install tensorflow and tflite
```shell
# Make sure the pip command is pointing to conda
which pip
pip install tensorflow==1.14.0 tflite==2.1.0
```

# Setup
```shell script
git clone --recursive https://github.com/apache/incubator-tvm tvm
```shell
# Get into sima's TVM and update the repo
cd tvm
git submodule init
git submodule update
```
Now you are in ```$TVM_HOME```

# Build
```shell script
```shell
cd $TVM_HOME
mkdir build
cd build
cp ../sima-config.cmake config.cmake
cmake ..
cmake -G Ninja ..
ninja
cd ..
make cython
```
It takes about 10mn to build and 2s for cython.

# Add TVM python paths to system-wide paths
```shell script
```shell
# at the end of ~/.zshrc, add
export TVM_HOME=/path/to/tvm
export PYTHONPATH=$TVM_HOME/python:$TVM_HOME/topi/python:${PYTHONPATH}
```

# PyCharm
- Point PyCharm to use your conda tvm environment.
- Add those 2 paths ```$TVM_HOME/python:$TVM_HOME/topi/python``` to your project.

- Add those 2 paths ```$TVM_HOME/python:$TVM_HOME/topi/python``` to your project.

0 comments on commit 1ca5de0

Please sign in to comment.