Building and installing hipCUB with CMake

Building and installing hipCUB with CMake#

You can build and install hipCUB with CMake on Windows or Linux.

Before you begin, set CXX to amdclang++ or hipcc, and set CMAKE_CXX_COMPILER to the compiler’s absolute path. For example:

CXX=amdclang++
CMAKE_CXX_COMPILER=/opt/rocm/bin/amdclang++

After cloning the project, create the build directory under the hipcub root directory, then change directory to the build directory:

mkdir build
cd build

Generate the makefile using the cmake command:

cmake ../. [-D<OPTION1=VALUE1> [-D<OPTION2=VALUE2>] ...]

The available build options are:

  • BUILD_BENCHMARK. Set this to ON to build benchmark tests. Off by default.

  • BUILD_TEST. Set this to ON to build tests. Off by default.

  • DEPENDENCIES_FORCE_DOWNLOAD. Set this to ON to download the dependencies regardless of whether or not they are already installed. Off by default.

  • BUILD_OFFLOAD_COMPRESS. Set this to OFF to prevent the --offload-compress switch from being passed to the compiler and compressing the binary. On by default.

Build hipCUB using the generated make file:

make -j4

After you’ve built hipCUB, you can optionally generate tar, zip, and deb packages:

make package

Finally, install hipCUB:

make install