Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Column
width900px


Code Block
languagebash
themeDJango
titleTerminal N. Explaining the use the "hello_jobstep" code from an salloc session (list allocated GPUs)Loading ROCm module and using the hipify-perl tool for translating the code from CUDA to HIP
$ 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 provided in the ROCm installation:

Column
width900px


Code Block
languagebash
themeDJango
titleTerminal N. Compiling the code with hipcc
$ hipcc new_foo.cpp



There are several other utility scripts and options available to support the porting of codes that you can find in the rocm installation. These include:

Code Block
$ echo $(hipconfig --path)
$ findcode.sh hipcc hipconfig hipconvertinplace.sh hip_embed_pch.sh hipexamine.sh hipify-perl roc-obj-extract finduncodep.sh hipcc_cmake_linker_helper hipconvertinplace-perl.sh hipdemangleatp hipexamine-perl.sh hipify-cmakefile hipvars.pm roc-obj-ls

for example:

Code Block
$ hipify perl inplace <filename>
It modifies the filename input inplace , replacing input with hipified output, save backup in . prehip file.
Code Block
$ hipexamine-perl.sh <filename/directory>
This script will scan a file/directory to determine which file/files contain CUDA code and how much of that code can be automatically hipified.

Code Block
$ hipconvertinplace-perl.sh <directory>
It converts all the related files that are located inside the directory

...

  • hipify-clang
  • hipify-perl
  • hipexamine.sh
  • hipexamine-perl.sh
  • hipconvertinplace.sh
  • hipconvertinplace-perl.sh



For example, hipify-perl -inplace option saves the HIP version of the code in the same file. The original CUDA code is saved in the backup file .prehip:

Column
width900px


Code Block
languagebash
themeDJango
titleTerminal N. Compiling the code with hipcc
$ hipify-perl -inplace <filename>


Or hipexamine-perl.sh scans a file/directory to determine which file/files contain CUDA code and how much of that code can be automatically hipified.

Code Block
$ hipexamine-perl.sh <filename/directory>

Or hipconvertinplace-perl.sh converts all the related files that are located inside the directory

Code Block
$ hipconvertinplace-perl.sh <directory>

for more information see HIP programming guide, ROCm-Developer-Tools, HIPIFY/README