fix#65 llvm cuda install, Thanks @hiyyg

This commit is contained in:
Dun Liang 2020-04-24 12:12:50 +08:00
parent b9eb3aab22
commit 59faac1fa5
5 changed files with 74 additions and 24 deletions

View File

@ -81,9 +81,8 @@ Jittor使用Python和C++编写。 它需要用于即时编译的编译器。当
* CPU 编译器 (需要下列至少一个)
- g++ >=5.4.0
- clang >=8.0推荐
- clang >=8.0
* GPU 编译器(可选)
- nvcc>=10.0
Jittor的环境要求如下:
@ -108,10 +107,6 @@ Jittor 一共提供三种方式安装: pip安装, 一键脚本安装 和 手动
```bash
sudo apt install python3.7-dev libomp-dev
sudo python3.7 -m pip install git+https://github.com/Jittor/jittor.git
# if you cannot access github, please download code from our website:
# wget https://cg.cs.tsinghua.edu.cn/jittor/assets/build/jittor.tgz
# mkdir -p jittor && tar -xvf ./jittor.tgz -C jittor
# sudo pip install ./jittor
python3.7 -m jittor.test.test_example
```
@ -155,7 +150,7 @@ wget -O - https://raw.githubusercontent.com/Jittor/jittor/master/script/install.
sudo apt install g++ build-essential libomp-dev
# OR clang++-8
wget -O - https://apt.llvm.org/llvm.sh > /tmp/llvm.sh
wget -O - https://raw.githubusercontent.com/Jittor/jittor/master/script/install_llvm.sh > /tmp/llvm.sh
bash /tmp/llvm.sh 8
```

View File

@ -81,9 +81,10 @@ Jittor is written in Python and C++. It requires a compiler for JIT compilation,
* CPU compiler (require at least one of the following)
* g++ (>=5.4.0)
* clang (>=8.0) recommend
* clang (>=8.0)
* GPU compiler (optional)
* nvcc (>=10.0)
* nvcc (>=10.0 for g++ or >=10.2 for clang)
- nvcc (>=10.0 for g++ or >=10.2 for clang)
@ -106,10 +107,6 @@ Jittor offers three ways to install: pip, script or manual.
```bash
sudo apt install python3.7-dev libomp-dev
sudo python3.7 -m pip install git+https://github.com/Jittor/jittor.git
# if you cannot access github, please download code from our website:
# wget https://cg.cs.tsinghua.edu.cn/jittor/assets/build/jittor.tgz
# mkdir -p jittor && tar -xvf ./jittor.tgz -C jittor
# sudo pip install ./jittor
python3.7 -m jittor.test.test_example
```
@ -150,7 +147,7 @@ We will show how to install Jittor in Ubuntu 16.04 step by step, Other Linux dis
sudo apt install g++ build-essential libomp-dev
# OR clang++-8
wget -O - https://apt.llvm.org/llvm.sh > /tmp/llvm.sh
wget -O - https://raw.githubusercontent.com/Jittor/jittor/master/script/install_llvm.sh > /tmp/llvm.sh
bash /tmp/llvm.sh 8
```
### Step 2: Install Python and python-dev

View File

@ -100,14 +100,14 @@ Jittor使用Python和C++编写。 它需要用于即时编译的编译器。当
* CPU compiler (require at least one of the following)
* g++ (>=5.4.0)
* clang (>=8.0) recommend
* clang (>=8.0)
* CPU 编译器 (需要下列至少一个)
- g++ >=5.4.0
- clang >=8.0推荐
- clang >=8.0
* GPU compiler (optional)
* nvcc (>=10.0)
* nvcc (>=10.0 for g++ or >=10.2 for clang)
* GPU 编译器(可选)
- nvcc>=10.0
- nvcc (>=10.0 for g++ or >=10.2 for clang)
Jittor的环境要求如下:
@ -139,10 +139,6 @@ Jittor 一共提供三种方式安装: pip安装, 一键脚本安装 和 手动
```bash
sudo apt install python3.7-dev libomp-dev
sudo python3.7 -m pip install git+https://github.com/Jittor/jittor.git
# if you cannot access github, please download code from our website:
# wget https://cg.cs.tsinghua.edu.cn/jittor/assets/build/jittor.tgz
# mkdir -p jittor && tar -xvf ./jittor.tgz -C jittor
# sudo pip install ./jittor
python3.7 -m jittor.test.test_example
```
@ -193,7 +189,7 @@ We will show how to install Jittor in Ubuntu 16.04 step by step, Other Linux dis
sudo apt install g++ build-essential libomp-dev
# OR clang++-8
wget -O - https://apt.llvm.org/llvm.sh > /tmp/llvm.sh
wget -O - https://raw.githubusercontent.com/Jittor/jittor/master/script/install_llvm.sh > /tmp/llvm.sh
bash /tmp/llvm.sh 8
```
### Step 2: Install Python and python-dev

View File

@ -19,7 +19,7 @@ fi
if [ "$with_clang" = "1" ]; then
sudo apt install wget lsb-release software-properties-common -y
wget -O - https://apt.llvm.org/llvm.sh > /tmp/llvm.sh
wget -O - https://raw.githubusercontent.com/Jittor/jittor/master/script/install_llvm.sh > /tmp/llvm.sh
sudo bash /tmp/llvm.sh 8
sudo apt-get install libc++-8-dev libc++abi-8-dev -y
sudo apt-get install libomp-8-dev -y

62
script/install_llvm.sh Normal file
View File

@ -0,0 +1,62 @@
#!/bin/bash
################################################################################
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
################################################################################
#
# This script will install the llvm toolchain on the different
# Debian and Ubuntu versions
set -eux
# read optional command line argument
LLVM_VERSION=8
if [ "$#" -eq 1 ]; then
LLVM_VERSION=$1
fi
DISTRO=$(lsb_release -is)
VERSION=$(lsb_release -sr)
DIST_VERSION="${DISTRO}_${VERSION}"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root!"
exit 1
fi
declare -A LLVM_VERSION_PATTERNS
LLVM_VERSION_PATTERNS[8]="-8"
LLVM_VERSION_PATTERNS[9]="-9"
LLVM_VERSION_PATTERNS[10]=""
if [ ! ${LLVM_VERSION_PATTERNS[$LLVM_VERSION]+_} ]; then
echo "This script does not support LLVM version $LLVM_VERSION"
exit 3
fi
LLVM_VERSION_STRING=${LLVM_VERSION_PATTERNS[$LLVM_VERSION]}
# find the right repository name for the distro and version
case "$DIST_VERSION" in
Debian_9* ) REPO_NAME="deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch$LLVM_VERSION_STRING main" ;;
Debian_10* ) REPO_NAME="deb http://apt.llvm.org/buster/ llvm-toolchain-buster$LLVM_VERSION_STRING main" ;;
Debian_unstable ) REPO_NAME="deb http://apt.llvm.org/unstable/ llvm-toolchain$LLVM_VERSION_STRING main" ;;
Debian_testing ) REPO_NAME="deb http://apt.llvm.org/unstable/ llvm-toolchain$LLVM_VERSION_STRING main" ;;
Ubuntu_16.04 ) REPO_NAME="deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial$LLVM_VERSION_STRING main" ;;
Ubuntu_18.04 ) REPO_NAME="deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic$LLVM_VERSION_STRING main" ;;
Ubuntu_18.10 ) REPO_NAME="deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic$LLVM_VERSION_STRING main" ;;
Ubuntu_19.04 ) REPO_NAME="deb http://apt.llvm.org/disco/ llvm-toolchain-disco$LLVM_VERSION_STRING main" ;;
* )
echo "Distribution '$DISTRO' in version '$VERSION' is not supported by this script (${DIST_VERSION})."
exit 2
esac
cat /etc/apt/sources.list
# install everything
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
add-apt-repository "${REPO_NAME}"
cat /etc/apt/sources.list
apt-get update
apt-get install -y clang-$LLVM_VERSION lldb-$LLVM_VERSION lld-$LLVM_VERSION clangd-$LLVM_VERSION