Building and installing hipCUB with CMake#
You can build and install hipCUB with CMake on AMD and NVIDIA GPUs on Windows or Linux.
Before you begin, set CXX to amdclang++ or hipcc if you’re building hipCUB on an AMD GPU, or to nvcc if you’re building hipCUB on an NVIDIA GPU. Then set CMAKE_CXX_COMPILER to the compiler’s absolute path. For example:
CXX=amdclang++
CMAKE_CXX_COMPILER=/opt/rocm/bin/amdclang++
Create the build directory inside the hipCUB 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- ONto build benchmark tests. Off by default.
- BUILD_TEST. Set this to- ONto build tests. Off by default.
- DEPENDENCIES_FORCE_DOWNLOAD. Set this to- ONto download the dependencies regardless of whether or not they are already installed. Off 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