Building and installing rocThrust on Windows and Linux with CMake#
You can build and install rocThrust with CMake on either Windows or Linux.
Set CXX to hipcc and set CMAKE_CXX_COMPILER to hipcc’s absolute path. For example:
CXX=hipcc
CMAKE_CXX_COMPILER=/usr/bin/hipcc
After cloning the project, create the build directory under the rocthrust root 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 build options are:
DISABLE_WERROR. Set this toOFFto pass-Werrorto the compiler. Default isON.BUILD_TEST. Set this toONto enable rocThrust tests. Default isOFF.BUILD_HIPSTDPAR_TEST. Set this toONto enable HIPSTDPAR tests. Default isOFF.BUILD_BENCHMARK. Set this toONto build rocThrust benchmarks. Default isOFF.BUILD_EXAMPLE. Set this toONto build the rocThrust examples. Default isOFF.USE_SYSTEM_LIB. Set this toONto use the installedROCmlibraries when building the tests. For this option to take effect,BUILD_TESTmust be set toON. Default isOFF.RNG_SEED_COUNT. Set this to the non-repeatable random dataset count. Default is 0.PRNG_SEEDS. Set this to the RNG seeds. The seeds must be 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".-DPRNG_SEEDS=1is used by default.BUILD_ADDRESS_SANITIZER. Set this toONto build with the Clang address sanitizer enabled. Default isOFF.EXTERNAL_DEPS_FORCE_DOWNLOAD. Set this toONto download the non-ROCm dependencies such as Google Test even if they’re already installed. Default isOFF.USE_HIPCXX. Set this toONto build with CMake HIP language support. Setting this toONeliminates the need to useCXX=hipcc. Default isOFF.ROCPRIM_FETCH_METHODandROCRAND_FETCH_METHOD. Set these to the method to use to download the rocPRIM and rocRAND components, respectively. Can be set toPACKAGE,DOWNLOAD, orMONOREPO. Set toMONOREPOif the component isn’t already installed and you’re building rocThrust from within a clone of the rocm-libraries repository that includes the component. Set toDOWNLOADif the component isn’t installed and you aren’t in a clone of therocm-librariesrepository that includes the component.DOWNLOADwill clone the repository using sparse checkout so that only the necessary files are downloaded. Set toPACKAGEif the component is already installed. If the component isn’t installed, it’ll be downloaded form the repository in the same way as using theDOWNLOADoption. The default method isPACKAGE.
Note
If you’re using a version of git earlier than 2.25, -DROCPRIM_FETCH_METHOD=DOWNLOAD and -DROCRAND_FETCH_METHOD=DOWNLOAD will download the entire rocm-libraries repository.
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