| ... | ... | @@ -13,7 +13,7 @@ First, install Windows Subsystem for Linux (WSL) following [these instructions]( |
|
|
|
### Linux - install CUDA
|
|
|
|
|
|
|
|
The following commands are copied from the [CUDA Installation Guide for Linux](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/)
|
|
|
|
```
|
|
|
|
```bash
|
|
|
|
# Install the newcuda-keyring package
|
|
|
|
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb
|
|
|
|
sudo dpkg -i cuda-keyring_1.1-1_all.deb
|
| ... | ... | @@ -23,7 +23,7 @@ sudo apt-get update |
|
|
|
sudo apt-get install cuda
|
|
|
|
```
|
|
|
|
Then, add these lines to your `~/.bashrc`:
|
|
|
|
```
|
|
|
|
```bash
|
|
|
|
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
|
|
|
|
export LD_LIBRARY_PATH=/usr/local/cuda/lib64\
|
|
|
|
${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
|
| ... | ... | @@ -33,13 +33,13 @@ and restart the terminal. |
|
|
|
### Linux: build the clang compiler with GPU offloading support
|
|
|
|
|
|
|
|
Install these additional packages:
|
|
|
|
```
|
|
|
|
```bash
|
|
|
|
sudo apt-get install g++ freeglut3-dev build-essential libx11-dev \
|
|
|
|
libxmu-dev libxi-dev libglu1-mesa-dev libfreeimage-dev libglfw3-dev
|
|
|
|
sudo apt install libffi-dev zlib1g-dev cmake
|
|
|
|
```
|
|
|
|
Clone the "clang" compiler source code repository and build it with gcc:
|
|
|
|
```
|
|
|
|
```bash
|
|
|
|
git clone --depth=1 https://github.com/llvm/llvm-project.git
|
|
|
|
cd llvm-project
|
|
|
|
mkdir build
|
| ... | ... | @@ -52,7 +52,7 @@ cmake ../llvm/ -DCMAKE_BUILD_TYPE=Release \ |
|
|
|
make -j 8
|
|
|
|
```
|
|
|
|
Check that your nvidia card is detected:
|
|
|
|
```
|
|
|
|
```bash
|
|
|
|
./bin/llvm-omp-device-info
|
|
|
|
|
|
|
|
[...]
|
| ... | ... | @@ -66,7 +66,7 @@ Device (4): |
|
|
|
The last line gives you the architecture of your GPU (here: "sm_75")
|
|
|
|
|
|
|
|
Rebuild clang with clang:
|
|
|
|
```
|
|
|
|
```bash
|
|
|
|
cd ..
|
|
|
|
mkdir build2
|
|
|
|
cd build2
|
| ... | ... | @@ -80,7 +80,7 @@ cmake ../llvm/ -DCMAKE_BUILD_TYPE=Release \ |
|
|
|
make -j 8 install
|
|
|
|
```
|
|
|
|
In order to use the compiler, you must add these lines to your `~/.bashrc`:
|
|
|
|
```
|
|
|
|
```bash
|
|
|
|
export PATH=~/.local/clang-gpu/bin:$PATH
|
|
|
|
export LD_LIBRARY_PATH=~/.local/clang-gpu/lib:$LD_LIBRARY_PATH
|
|
|
|
export CC=clang
|
| ... | ... | @@ -89,7 +89,7 @@ export CXX=clang++ |
|
|
|
|
|
|
|
## Build the test from this repository
|
|
|
|
|
|
|
|
```
|
|
|
|
```bash
|
|
|
|
git clone git@gitlab.uliege.be:rboman/math0471.git
|
|
|
|
cd math0471/examples/gpu
|
|
|
|
mkdir build
|
| ... | ... | |
| ... | ... | |