*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!