How to install hipSYCL on Ubuntu 20.04

*This article is only suitable for those whose computer has NVIDIA GPU and using Ubuntu system

1. Install NVIDIA driver

The simplest way to install NVIDIA driver is to open Software&Updates and choose the recommended NVIDIA driver, then apply changes and reboot the system.

 Open the terminal, type the command

nvidia-smi

Check the version of CUDA owned by your NVIDIA driver

Here it suggests CUDA Version is 11.4, so I will install the same version of CUDA Toolkit which is used in the runtime.

2. Install CUDA Toolkit

Go to the website CUDA Toolkit Archive | NVIDIA Developer, download CUDA Toolkit that has the same version with your CUDA version.

Don't forget to add PATH and LD_LIBRARY_PATH in your bash file which can be opened by using command 

vim ~/.bashrc
#cuda
export PATH="/usr/local/cuda/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"

Then type following command

source ~/.bashrc

Use following command to check whether you install the CUDA Toolkit successfully

 3. Install the prerequisites of hipSYCL

install cmake

sudo apt install cmake

install Boost

sudo apt-get install libboost-all-dev

install Catch2

git clone https://github.com/catchorg/Catch2.git
cd Catch2
cmake -Bbuild -H. -DBUILD_TESTING=OFF
sudo cmake --build build/ --target install

install clang (LLVM)

You can follow the instructions on this website hipSYCL/install-llvm.md at develop · illuhad/hipSYCL · GitHub

wget https://apt.llvm.org/llvm.sh #Convenience script that sets up the repositories
chmod +x llvm.sh
./llvm.sh 13 #Set up repositories for clang 13
apt install -y libclang-13-dev clang-tools-13 libomp-13-dev llvm-13-dev lld-13

4. Install hipSYCL

Once the software requirements mentioned above are met, clone the repository:

$ git clone https://github.com/illuhad/hipSYCL

Then, create a build directory outside of hipSYCL folder.

mkdir build

Some backends and compilation flows must be configured with specific cmake arguments which should be passed during the cmake step. I recommand you guys use command blow to modify the arguments.

You can take my setting as an example, you just need to pay attention some "on" and "off". We can set the path where we want to install hipSYCL after the variable CMAKE_INSTALL_PREFIX.

Then type following command

make install

 Don't forget to add the PATH, LD_LIBRARY_PATH adn INCLUDE_PATH in your bash file.

#hipsycl
export PATH="/home/ricky/hipSYCL_install/bin:$PATH"
export LD_LIBRARY_PATH="/home/ricky/hipSYCL_install/lib:$LD_LIBRARY_PATH"
export INCLUDE_PATH="/home/ricky/hipSYCL_install/include:$INCLUDE_PATH"

 Then type following command

source ~/.bashrc

5. Test 

Finally, we can use syclcc to compile our programe as following example:

 If you have any questions or doubts, please write comments in the comment section, thanks for your support!

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值