Building and installing rocThrust on Windows and Linux with CMake#
You can build and install rocThrust with CMake on either Windows or Linux.
Before you begin, set CXX to amdclang++ or hipcc depending on the compiler you’ll be using, and 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 rocThrust directory, then change directory to the build directory:
mkdir build
cd build
Generate the rocThrust 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_EXAMPLES. Set this to- ONto build rocThrust examples. Off by default.
- BUILD_TEST. Set to- ONto enable rocThrust tests. Off by default.
- BUILD_HIPSTDPAR_TEST. Set to- ONto enable HIPSTDPAR tests. Off by default.
- DISABLE_WERROR. Set this to- OFFto pass- -Werrorto the compiler. On by default.
- DOWNLOAD_ROCPRIM. Set this to- ONto download rocPRIM regardless of whether or not rocPRIM is already installed. Off by default.
- RNG_SEED_COUNT. Set this to the non-repeatable random dataset count. Set to 0 by default.
- PRNG_SEEDS. Set this to the RNG seeds. The seeds are passed as a semicolon-delimited array of 32-bit unsigned integers. To avoid command line parsing errors, enclose the entire option in quotation marks. For example,- cmake "-DPRNG_SEEDS=1;2;3;4". Set to 1 by default.
Build rocThrust using the generated make file:
make -j4
After you’ve built rocThrust, you can optionally generate tar, zip, and deb packages:
make package
Finally, install rocThrust:
make install