Install libhipcxx#

2026-10-02

6 min read time

Applies to Linux and Windows

Starting with ROCm Core SDK 10.1, libhipcxx is distributed as part of the ROCm Core SDK.

Before you begin, verify that your system is supported. For more information, see ROCm compatibility matrix.

For advanced workflows, source builds, or custom configurations, see Build from source.

Install the ROCm Core SDK#

libhipcxx is included with the ROCm Core SDK on Linux. For the most complete installation, use the amdrocm-core-sdk meta package.

For instructions, see Install AMD ROCm. Use the selector panel on that page to view instructions appropriate for your system environment.

Install ROCm C++ template libraries on Linux#

Alternatively, if you want to install libhipcxx as part of the ROCm CCL package (a subset of the ROCm Core SDK amdrocm-core-sdk) without additional ROCm libraries and tools, install the amdrocm-ccl development package. This includes libhipcxx, rocThrust, hipCUB, and rocPRIM.

  1. Complete the ROCm installation prerequisites to install dependencies and configure GPU access permissions.

  2. Install the ROCm CCL development package that matches your desired ROCm version and AMD GPU architecture. Package names use the following format:

    amdrocm-ccl<dev/devel><rocm_version>-<llvm_target>
    

    Where:

    • <dev/devel> specifies that the package includes library files and headers. libhipcxx is header-only, so a development package is required.

      • -dev is used on Debian-based distributions, including Ubuntu.

      • -devel is used on RPM-based distributions, including RHEL and SLES.

    • <rocm_version> is the ROCm Core SDK version to install. Omit this suffix to install the latest available version.

    • <llvm_target> (starting with gfx) is used if you are installing for a single AMD GPU architecture. Omit this suffix to install for all architectures at the cost of disk space.

    For example, to install the latest ROCm CCL development package release for all supported GPU architectures:

    sudo apt install amdrocm-ccl-dev
    
    sudo dnf install amdrocm-ccl-devel
    
    sudo zypper install amdrocm-ccl-devel
    

Install a nightly build#

TheRock build system also publishes nightly builds for the ROCm Core SDK and its components, including libhipcxx. See Nightly release status for details.

Add libhipcxx to a CMake project#

libhipcxx is a header-only library, so adding it to your project means making its headers discoverable by the compiler — there is no shared library to link against and no ABI compatibility concern from libhipcxx itself. After this step, any target you link against libhipcxx::libhipcxx can include libhipcxx headers without specifying the include path manually.

Prerequisites#

ROCm must be installed before configuring your project. libhipcxx ships as part of ROCm, so if ROCm is installed at its default prefix (/opt/rocm), no separate libhipcxx install step is needed. CMake integration also does not configure the HIP compiler for you; your CMakeLists.txt must separately enable HIP, for example with enable_language(HIP) or by setting CMAKE_HIP_COMPILER.

CMake integration#

To use libhipcxx in your own project, add the following lines to your CMakeLists.txt file:

# "/opt/rocm" - default ROCm install prefix
find_package(libhipcxx REQUIRED)

# ...

# include the libhipcxx headers
target_link_libraries(your_target PRIVATE libhipcxx::libhipcxx)

libhipcxx::libhipcxx is an interface target, so linking against it only adds the libhipcxx include directories to your target.

If you installed libhipcxx into a non-default location, set CMAKE_PREFIX_PATH to that install directory when you configure your project:

cmake -DCMAKE_PREFIX_PATH=<path to libhipcxx install directory> ..

Include the headers#

To use a Standard Library facility in host and device code, add cuda/std/ to the start of the include and cuda:: before the use of std:::

#include <cuda/std/atomic>

cuda::std::atomic<int> x;

To use an extension to a Standard Library facility, drop the std:

#include <cuda/atomic>

cuda::atomic<int, cuda::thread_scope_device> x;

You can also write these as hip/std/ and hip::std::, or hip/ and hip::. Both spellings resolve to the same headers and can be used interchangeably. For an explanation of when to use each namespace, see Namespace hierarchy in libhipcxx.

If you are not using CMake, add the libhipcxx include root to your compiler flags directly. ROCm installs the libhipcxx headers under /opt/rocm/include/hipccl, which is not on the compiler’s default search path:

hipcc -std=c++17 -I/opt/rocm/include/hipccl -c main.hip