Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] Improve dev_install for Windows and LLVM 10 #1202

Merged
merged 6 commits into from
Jun 11, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 64 additions & 38 deletions docs/dev_install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,83 @@ For precise build instructions on Windows, please check out `appveyor.yml <https

Note that on Linux/OS X, ``clang`` is the only supported compiler for compiling the Taichi compiler. On Windows only MSVC supported.

Installing Depedencies
----------------------
Installing Dependencies
-----------------------

- Make sure you are using Python 3.6/3.7/3.8
- Execute
- Install Python dependencies:

.. code-block:: bash

python3 -m pip install --user setuptools astor pybind11 numpy
python3 -m pip install --user pytest pytest-rerunfailures pytest-xdist pytest-cov
python3 -m pip install --user GitPython coverage autograd Pillow yapf
python3 -m pip install --user scipy psutil opencv-python astpretty
python3 -m pip install --user setuptools astpretty astor pybind11
python3 -m pip install --user pytest pytest-rerunfailures pytest-xdist yapf Pillow
python3 -m pip install --user numpy GitPython coverage colorama autograd
yuanming-hu marked this conversation as resolved.
Show resolved Hide resolved

* (If on Ubuntu) Execute ``sudo apt install libtinfo-dev clang-8``. (``clang-7`` should work as well).
- Make sure you have ``clang`` with version >= 7

* (If on other Linux distributions) Please build clang 8.0.1 from source:
* On Windows: Download ``clang-8`` via `this link <https://releases.llvm.org/8.0.0/LLVM-8.0.0-win64.exe>`_.
Make sure you add the ``bin`` folder containing ``clang.exe`` to the ``PATH`` environment variable.

.. code-block:: bash
* On OS X: you don't need to do anything.
yuanming-hu marked this conversation as resolved.
Show resolved Hide resolved

wget https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/cfe-8.0.1.src.tar.xz
tar xvJf cfe-8.0.1.src.tar.xz
cd cfe-8.0.1.src
mkdir build
cd build
cmake ..
make -j 8
sudo make install
* On Ubuntu, execute ``sudo apt install libtinfo-dev clang-8``.

* On other Linux distributions, please build clang 8.0.1 from source:

- Make sure you have LLVM 8.0.1 built from source. To do so:
.. code-block:: bash

.. code-block:: bash
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/cfe-8.0.1.src.tar.xz
yuanming-hu marked this conversation as resolved.
Show resolved Hide resolved
tar xvJf cfe-8.0.1.src.tar.xz
cd cfe-8.0.1.src
mkdir build
cd build
cmake ..
make -j 8
sudo make install


- Make sure you have LLVM 8.0.1/10.0.0. Note that Taichi uses a customized LLVM so the pre-built binaries from the LLVM official website or other sources probably doesn't work.
Here we provide LLVM 8.0.1 binaries customized for Taichi, which may or may not work depending on your system environment:
yuanming-hu marked this conversation as resolved.
Show resolved Hide resolved
`Linux <https://github.com/yuanming-hu/taichi_assets/releases/download/llvm8/taichi-llvm-8.0.1-linux-x64.zip>`_,
`OS X <https://github.com/yuanming-hu/taichi_assets/releases/download/llvm8/taichi-llvm-8.0.1.zip>`_,
`Windows <https://github.com/yuanming-hu/taichi_assets/releases/download/llvm8/taichi-llvm-8.0.1-msvc2017.zip>`_.

If the downloaded LLVM does not work, please build from source:

- On Linux or OS X:
yuanming-hu marked this conversation as resolved.
Show resolved Hide resolved
yuanming-hu marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: bash

wget https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz
tar xvJf llvm-8.0.1.src.tar.xz
cd llvm-8.0.1.src
mkdir build
cd build
cmake .. -DLLVM_ENABLE_RTTI:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" -DLLVM_ENABLE_ASSERTIONS=ON
# If you are building on NVIDIA Jetson TX2, use -DLLVM_TARGETS_TO_BUILD="ARM;NVPTX"
make -j 8
sudo make install

yuanming-hu marked this conversation as resolved.
Show resolved Hide resolved
- On Windows:
yuanming-hu marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: bash

# LLVM 8.0.1 + MSVC 2017
cmake .. -G"Visual Studio 15 2017 Win64" -DLLVM_ENABLE_RTTI:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" -DLLVM_ENABLE_ASSERTIONS=ON -Thost=x64 -DLLVM_BUILD_TESTS:BOOL=OFF -DCMAKE_INSTALL_PREFIX=installed

# LLVM 10.0.0 + MSVC 2019
cmake .. -G"Visual Studio 16 2019" -A x64 -DLLVM_ENABLE_RTTI:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" -DLLVM_ENABLE_ASSERTIONS=ON -Thost=x64 -DLLVM_BUILD_TESTS:BOOL=OFF -DCMAKE_INSTALL_PREFIX=installed

Then open ``LLVM.sln`` and use Visual Studio 2017+ to build. Please make sure you are using the ``Release`` configuration. After building the ``INSTALL`` project (under folder ``CMakePredefinedTargets`` in the Solution Explorer window).
After the build is complete, find your LLVM binaries and headers in ``build/installed``.
If you use MSVC 2019, **make sure you use C++17** for the ``INSTALL`` project.
yuanming-hu marked this conversation as resolved.
Show resolved Hide resolved

Please add ``build/installed/bin`` to ``PATH``.
Later, when you build Taichi using ``CMake``, set ``LLVM_DIR`` to ``build/installed/lib/cmake/llvm``.
yuanming-hu marked this conversation as resolved.
Show resolved Hide resolved

- On Windows, if you use the pre-built LLVM for Taichi, please add ``$LLVM_FOLDER/bin`` to ``PATH``.
Later, when you build Taichi using ``CMake``, set ``LLVM_DIR`` to ``$LLVM_FOLDER/lib/cmake/llvm``.
yuanming-hu marked this conversation as resolved.
Show resolved Hide resolved

wget https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz
tar xvJf llvm-8.0.1.src.tar.xz
cd llvm-8.0.1.src
mkdir build
cd build
cmake .. -DLLVM_ENABLE_RTTI:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" -DLLVM_ENABLE_ASSERTIONS=ON
# If you are building on NVIDIA Jetson TX2, use -DLLVM_TARGETS_TO_BUILD="ARM;NVPTX"
make -j 8
sudo make install

Setting up CUDA (optional)
--------------------------
Expand Down Expand Up @@ -103,15 +138,6 @@ Setting up Taichi for development



Prebuilt LLVM for Windows CI
----------------------------

.. code-block:: bash

cmake .. -G"Visual Studio 15 2017 Win64" -DLLVM_ENABLE_RTTI:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" -DLLVM_ENABLE_ASSERTIONS=ON -Thost=x64 -DLLVM_BUILD_TESTS:BOOL=OFF -DCMAKE_INSTALL_PREFIX=installed

Then use Visual Studio to build. After building the ``INSTALL`` project (under folder "CMakePredefinedTargets"). After build completes, find your LLVM binaries/headers in `build/include`.

Troubleshooting
---------------

Expand Down