HIP

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

HIP is the acronym of "Heterogeneous-Compute Interface for Portability". HIP is a C++ dialect to help conversion of Cuda applications to C++ in a portable manner.

Installation

dev-util/hip pulls in basic libraries, APIs and utilities that can compile and run a HIP program.

USE flags

USE flags for dev-util/hip C++ Heterogeneous-Compute Interface for Portability

debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally

Emerge

Install dev-util/hip:

root #emerge --ask dev-util/hip
Note
hipcc is a wrapper of clang. By default, clang uses libstdc++ provided by gcc, and that causes bugs, blocking =sys-devel/gcc-11.3.0 842405 (will be resolved in gcc-11.3.1) and >=sys-devel/gcc-12+=sys-devel/clang-14* 857126 (resolved in clang-15).

Additional software

Extra utilities, such as profiler for HIP program, can also be installed:

root #emerge --ask dev-util/rocprofiler

Usage

hipcc

dev-util/hip provides a clang wrapper called hipcc, which compiles HIP programs.

To automatically detect GPU architecture and compile a HIP program, run:

user $hipcc foo.cpp -o bar.exe

To specify GPU architectures, use --offload-arch command-line option:

user $hipcc --offload-arch=gfx906:sramecc+:xnack- --offload-arch=gfx90a:sramecc+:xnack+ --offload-arch=gfx1031 foo.cpp -o bar.exe

For architecture argument, see LLVM AMDGPU processors for details.

To view the detailed clang command executed, export HIPCC_VERBOSE=1.

hipconfig

hipconfig is a perl script for displaying configuration of hip.

Displaying full information:

user $hipconfig --full