...
Column | |||||
---|---|---|---|---|---|
|
HIP: Heterogeneous Interface for Portability is developed by AMD to program on AMD GPUs.
ROCm environment offers two automated methods for automatically converting CUDA projects to HIP: Hipify perl a Perl script you can run on the CUDA source code to convert it to HIP format and Hipify clang a preprocessor that operates from within the HIP/ Clang compiler tool chain, converting the code as a preliminary step within the compiler process.
The hipify perl script acts directly on the CUDA source code using a series of simple string replacements. Ex., (sed e ’s/cuda/hip/g’)
To convert the CUDA file foo.cu to HIP format, enter the following after loading hip/4.3.0
Code Block |
---|
$ module load rocm/version
$ hipify-perl foo.cu > new_foo.cpp |
You can then compile the HIP ready . cpp file for the ROCm environment using the HIP/ Clang compiler:
Code Block |
---|
$ module load rocm/version
$ hipcc new_foo.cpp |