HIP: Heterogenous-computing Interface for Portability
|
HIP code can be developed either on AMD ROCm platform using HIP-Clang compiler, or a CUDA platform with nvcc installed. Before build and run HIP, make sure drivers and pre-build packages are installed properly on the platform.
Install ROCm packages (see ROCm Installation Guide on AMD public documentation site (https://docs.amd.com/)) or install pre-built binary packages using the package manager,
Install Nvidia driver and pre-build packages (see HIP Installation Guide at https://docs.amd.com/ for the release)
Before get HIP source code, set the expected branch of repository at the variable HIP_BRANCH. For example, for ROCm5.0 release branch, set
ROCm5.1 release branch, set
Similiar format for future branches.
ROCM_PATH is path where ROCM is installed. BY default ROCM_PATH is at /opt/rocm.
ROCclr is defined on AMD platform that HIP use Radeon Open Compute Common Language Runtime (ROCclr), which is a virtual device interface that HIP runtimes interact with different backends. See https://github.com/ROCm-Developer-Tools/ROCclr
HIPAMD repository provides implementation specifically for AMD platform. See https://github.com/ROCm-Developer-Tools/hipamd
Note: If you don't specify CMAKE_INSTALL_PREFIX, hip runtime will be installed to "<ROCM_PATH>/hip". By default, release version of AMDHIP is built.
After make install command, make sure HIP_PATH is pointed to $PWD/install/hip.
Developers can build HIP directed tests right after build HIP commands,
By default, all HIP directed tests will be built and generated under the folder $HIPAMD_DIR/build/directed_tests. Take HIP directed device APIs tests, as an example, all available test applications will have executable files generated under, $HIPAMD_DIR/build/directed_tests/runtimeApi/device.
Run all HIP directed_tests, use the command,
Or
Build and run a single directed test, use the follow command as an example,
After build and install HIP commands, catch tests can be built via the following instructions,
HIP catch tests are built under the folder $HIP_DIR/build.
To run a single catch test, the following is an example,
HIP Catch2 supports build a standalone test, for example,
Please note, the integrated HIP directed tests, which are currently built by default, will be deprecated in future release. HIP catch tests, especially new architectured Catch2, will be official HIP tests in the repository and can be built alone as with the instructions shown above. Besides, Catch2 is more beneficial which brings the flexibility to build any standalone test/application.
Build HIP tests commands on NVIDIA platform are basically the same as AMD, except set -DHIP_PLATFORM=nvidia.
Compile and run the square sample.