Skip to content
Reusable software components for rocm developers
C++ CMake Shell
Branch: develop
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.githooks Adding SLES support (#43) Sep 6, 2019
cmake Package building fix for PyTorch (#31) Jul 18, 2019
hipcub Package building fix for PyTorch (#31) Jul 18, 2019
test Fix TARGETS param of rocm_export_targets May 31, 2019
.gitignore Initial commit Jul 5, 2018
.gitlab-ci.yml Fix TARGETS param of rocm_export_targets May 31, 2019
CMakeLists.txt Updating for rocm 2.10 release (#52) Oct 9, 2019
Jenkinsfile Fixing sudo for SLES (#51) Oct 7, 2019
LICENSE.txt Update CUB license Apr 17, 2019
NOTICES.txt Adding NOTICES.txt Jul 19, 2019 Add a note to README about including only <hipcub/hipcub.hpp> May 15, 2019
install Adding SLES support (#43) Sep 6, 2019


hipCUB is a thin wrapper library on top of rocPRIM or CUB. It enables developers to port project using CUB library to the HIP layer and to run them on AMD hardware. In ROCm environment hipCUB uses rocPRIM library as the backend, however, on CUDA platforms it uses CUB instead.


  • Git
  • CMake (3.5.1 or later)
  • For AMD GPUs:
    • AMD ROCm platform (1.8.0 or later)
      • Including HCC compiler, which must be set as C++ compiler on ROCm platform.
    • rocPRIM library
      • It will be automatically downloaded and built by CMake script.
  • For NVIDIA GPUs:
    • CUDA Toolkit
    • CUB library (automatically downloaded and by CMake script)


  • GTest
    • Required only for tests. Building tests is enabled by default.
    • It will be automatically downloaded and built by CMake script.

Build And Install

git clone

# Go to hipCUB directory, create and go to the build directory.
cd hipCUB; mkdir build; cd build

# Configure hipCUB, setup options for your system.
# Build options:
#   BUILD_TEST - ON by default,
# On ROCm platform set C++ compiler to HCC. You can do it by adding 'CXX=<path-to-hcc>'
# before 'cmake' or setting cmake option 'CMAKE_CXX_COMPILER' to path to the HCC compiler.
[CXX=hcc] cmake ../. # or cmake-gui ../.

# Build
make -j4

# Optionally, run tests if they're enabled.
ctest --output-on-failure

# Package
make package

# Install
[sudo] make install

Using hipCUB In A Project

Recommended way of including hipCUB into a CMake project is by using its package configuration files.

# On ROCm hipCUB requires rocPRIM
find_package(rocprim REQUIRED CONFIG PATHS "/opt/rocm/rocprim")

# "/opt/rocm" - default install prefix
find_package(hipcub REQUIRED CONFIG PATHS "/opt/rocm/hipcub")

# On ROCm: includes hipCUB headers and roc::rocprim_hip target
# On CUDA: includes only hipCUB headers, user has to include CUB directory
target_link_libraries(<your_target> hip::hipcub)

Include only the main header file:

#include <hipcub/hipcub.hpp>

CUB or rocPRIM headers are included by hipCUB depending on the current HIP platform.

Running Unit Tests

# Go to hipCUB build directory
cd hipCUB; cd build

# To run all tests

# To run unit tests for hipCUB


# go to hipCUB doc directory
cd hipCUB; cd doc

# run doxygen
doxygen Doxyfile

# open html/index.html


Bugs and feature requests can be reported through the issue tracker.

Contributions and License

Contributions of any kind are most welcome! More details are found at CONTRIBUTING and LICENSE.

You can’t perform that action at this time.