This tutorial shows how to use the GCC C++ Compiler on Linux to build the HIP CPU Runtime. It does not delve into the details of HIP, the C++ language, the GCC toolset or the Linux ecosystem.
If you encounter any difficulties, please create an issue for this tutorial.
To successfully complete this tutorial, the following steps are necessary:
- Install Intel TBB:
-
At this time this is a pre-requisite for the Parallel Algorithms component of the C++ Standard Library implementations available in Linux;
-
In general it should be available from via your distro's package manager
-
Consider Ubuntu as an example:
sudo apt-get install libtbb-dev
-
-
Alternatively, consider following the build and install instructions for the latest version.
-
- Install latest CMake
-
In general it should be available from via your distro's package manager
- Consider Ubuntu as an example:
sudo apt-get install cmake
-
Alternatively, download and execute the installer.
-
- Install Git
- Follow the instructions that apply to your environment.
To verify whether GCC is installed and of a sufficiently recent version, open a Terminal window and enter the following command:
gcc -v
If it is not installed, or if it is a version older than 9, you must install it and the corresponding version of the GNU C++ Library using your distro's package manager. Consider Ubuntu 20.04 or newer as an example:
sudo apt-get update
sudo apt-get install build-essential
git clone https://github.com/ROCm-Developer-Tools/HIP-CPU.git
cd HIP-CPU
mkdir build
cd build
cmake ../
cmake --build ./
# Assumes that you are in the build folder created in the build step.
cmake --build ./ --target install
# Assumes that you are in the build folder created in the build step.
ctest --output-on-failure
To use any of the HIP public interfaces include the hip/hip_runtime.h
header.
- If you are working with CMake, link against the convenience
INTERFACE
targethip_cpu_rt::hip_cpu_rt
, which is exported by the HIP CPU Runtime, which can be queried byfind_package(hip_cpu_rt)
; - If you are not working with CMake, add either
/path_where_you_cloned_the_hip_cpu_runtime/include
or, if you installed it,/path_where_you_installed_the_hip_cpu_runtime/include
to your include path.