Skip to content
Liam Wrubleski edited this page Oct 13, 2021 · 1 revision

Build dependencies and library (no client) using install

The install script can be used to build the dependencies and the hipRAND library. Common uses of install are in the table below.

install_command description
./install -h Help information.
./install -d Build dependencies and library in your local directory. The -d flag only needs to be used once. For subsequent invocations of install it is not necessary to rebuild the dependencies.
./install Build library in your local directory. It is assumed dependencies have been built.
./install -i Build library, then build and install hipRAND package. You will be prompted for sudo access. It is expected that if you want to install for all users you use the -i flag. If you want to keep hipRAND in your local directory, you do not need the -i flag.

Build library and client using install

The install script can be used to build the hipRAND library and client. The client contains executables in the table below.

executable name description
test_hiprand_api Test the hiprand API.
test_hiprand_cpp_wrapper Test the hiprandcpp wrapper.
test_hiprand_kernel Test the hiprand device API.

Note that the client requires additional dependencies not needed by the library. These include googletest. Below are common uses of install to build the dependencies, library, and client

install_command description
./install -h Help information.
./install -dc Build dependencies, library, and client in your local directory. The -d flag only needs to be used once. For subsequent invocations of install it is not necessary to rebuild the dependencies.
./install -c Build library and client in your local directory. It is assumed the dependencies have been built.
./install -idc Build dependencies, build the library, build the client, then build and install the hipRAND package. You will be prompted for sudo access. It is expected that if you want to install for all users you use the -i flag. If you want to keep hipRAND in your local directory, you do not need the -i flag.
./install -ic Build and install hipRAND package and build the client. You will be prompted for sudo access. It is expected that if you want to install for all users you use the -i flag. If you want to keep hipRAND in your local directory, you do not need the -i flag.

Dependencies For Building Library

CMake 3.10 or later

The build infrastructure for hipRAND is based on Cmake v3.10. This is the version of cmake available on ROCm supported platforms. If you are on a headless machine without X system, we recommend using ccmake; if you have access to X, we recommend using cmake-gui.

Install one-liners cmake:

  • Ubuntu: sudo apt install cmake-qt-gui
  • Fedora: sudo dnf install cmake-gui

rocRAND (HIP)

HIP backend of hipRAND is based on rocRAND. Currently, while rocRAND is not available in the public ROCm repositories, you will have to install the package manually.

cuRAND (NVCC)

NVCC backend of hipRAND is based on cuRAND. You can install it using

  • Ubuntu: sudo apt install cuda-curand-<ver>
  • Fedora: currently not supported

Configure and build steps

Example steps to build hipRAND:

mkdir -p [HIPRAND_BUILD_DIR]/release
cd [HIPRAND_BUILD_DIR]/release
# Default install location is in /opt/rocm, define -DCMAKE_INSTALL_PREFIX=<path> to specify other
# Default build config is 'Release', define -DCMAKE_BUILD_TYPE=<config> to specify other
cmake [HIPRAND_SOURCE]
make -j$(nproc)
sudo make install # sudo required if installing into system directory such as /opt/rocm

Additional dependencies only necessary for hipRAND clients

The unit tests and benchmarking applications in the client introduce the following dependencies:

  1. googletest

Unfortunately, googletest is not as easy to install. Many distros do not provide a googletest package with pre-compiled libraries. hipRAND provides a cmake script that builds the above dependencies from source. This is an optional step; users can provide their own builds of these dependencies and help cmake find them by setting the CMAKE_PREFIX_PATH definition. The following is a sequence of steps to build dependencies and install them to the cmake default /usr/local.

(optional, one time only)

mkdir -p [HIPRAND_BUILD_DIR]/release/deps
cd [HIPRAND_BUILD_DIR]/release/deps
ccmake -DBUILD_BOOST=OFF [HIPRAND_SOURCE]/deps
make -j$(nproc) install

Build Library + Tests Using Individual Commands

Once dependencies are available on the system, it is possible to configure the clients to build. This requires a few extra cmake flags to the library cmake configure script. If the dependencies are not installed into system defaults (e.g. /usr/local ), the user should pass the CMAKE_PREFIX_PATH to cmake to help finding them.

  • -DCMAKE_PREFIX_PATH="<semicolon separated paths>"
# Default install location is in /opt/rocm, use -DCMAKE_INSTALL_PREFIX=<path> to specify other
cmake -DBUILD_TEST=ON [HIPRAND_SOURCE]
make -j$(nproc)
sudo make install   # sudo required if installing into system directory such as /opt/rocm

Common build problems

  • Issue: Could not find a package configuration file provided by "rocRAND" with any of the following names:

    ROCRANDConfig.cmake

    rocrand-config.cmake

    Solution: Install rocRAND

  • Issue: Could not find a package configuration file provided by "ROCM" with any of the following names:

    ROCMConfig.cmake

    rocm-config.cmake

    Solution: Install ROCm cmake modules