How to build pytorch/glow
0. Environment
- Ubuntu 16.04
- LLVM 5.0.1
- CMake 3.9.3
1. Get source
- Get glow’s source code:
$ git clone --recursive https://github.com/pytorch/glow.git
2. Get LLVM
-
Download from https://llvm.org/ & extract the .tar.xz
-
Extract the downloaded archive:
$ tar xf clang+llvm-5.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
3. Configure
$ cd glow
$ mkdir _build
$ cd _build
$ PATH=<Path to extracted LLVM>/bin:${PATH} \
cmake .. \
-G"Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX=`pwd`/_install \
-DGLOW_WITH_OPENCL=OFF \
-DCMAKE_BUILD_TYPE=Release \
- Open lib/Backends/CPU/CMakeFiles/CPURuntime.dir/link.txt and delete trailing part after “#”.
4. Build
$ make -j`nproc`
$ make install
5. Run MNIST example
# Go back to the root of repo
$ cd ..
$ python utils/download_test_db.py --all
$ _build/bin/mnist