HIP is sort of AMD’s version of CUDA. It allows developer to write CUDA-like code and build for either AMD or NVIDIA GPUs. But the current version contains a small coding error that prevents HIP from working on NVIDIA GPUs. Installing hip_nvcc
on Ubuntu 16.04 using the ppa won’t work either. That sucks. Here is how to build it form source.
Installing HIP
How to build and install HIP on NVIDIA platforms are not documented in the official installation guide. With some playing around. I found how to do so.
First. Install CUDA runtime and development tool. Download it from here.
Then clone HIP’s repository and configure it.
git clone https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP cd HIP bin/hipconfig
Next, edit include/hip/nvcc_derail/hip_runtime.h
. Go to line 778. You will find two function called hipDeviceGetPCIBusId
(it is a duplicated function). Comment one of them out.
Last, install HIP. Note that HIP without the hipify
ability(turn CUDA code to HIP code) on NVIDIA platform is header only. Simply do a sudo make install
will install everything.
Build and run the sample code
HIP provides some sample code in the samples
directory for developers to get familiar with HIP. There are Makefiles in every sample directory. They are not generated by CMake. Simply cd to the directory and make
it will work most of the time.
The sample program smaples/0_Intro/module_api
won’t build out of the box. Edit line 88 and 89 of runKernel.cpp
to the following
args._Ad = (void*)Ad; args._Bd = (void*)Bd;
Then it should work.
Building HIP on Nvidia platform are way easier than what I tough it would be. Have fun 🙂
Notes
I can’t get HIP to work properly on my Manjaro Linux with a GTX 970. Some memory corruption is happening. I think it is that I run CUDA 8 instead of CUDA 7.5 on my Manjaro box.
releasing rented sandoz dominated ruleswebsite means cogs vnru assignments chime responsive
LikeLike