The hipify example demonstrates the use of HIP utility hifipy-perl to port CUDA code to HIP. It converts a CUDA .cu source code into a portable HIP .hip source code that can be compiled using hipcc and executed on any supported GPU (AMD or NVIDIA).
- The build system (either
cmakeorMakefile) first converts themain.cusource code into a HIP portablemain.hipsource code. It useshipify-perl main.cu > main.hipcommand to achieve the conversion. main.hipis then compiled usinghipcc main.hip -o hip_hipifyto generate the executable file.- The execuatable program launches a simple kernel that computes the square of each element of a vector.
hipify-perl is a utility that converts CUDA .cu source code into HIP portable code. It parses CUDA files and produces the equivalent HIP portable .hip source file.
hipGetErrorStringhipGetDevicePropertieshipMalloc