1. Installation
1.1. Introduction
This chapter describes how to obtain rocRAND. There are two main methods: the easiest way is to install the prebuilt packages from the ROCm repositories. Alternatively, this chapter also describes how to build rocRAND from source.
1.2. Prebuilt Packages
Installing the prebuilt rocRAND packages requires a ROCm-enabled platform. See the ROCm documentation for more information. After installing ROCm or enabling the ROCm repositories, rocRAND can be obtained using the system package manager.
For Ubuntu and Debian:
sudo apt-get install rocrand
For CentOS:
sudo yum install rocrand
For SLES:
sudo dnf install rocrand
This will install rocRAND into the /opt/rocm
directory.
1.3. Building rocRAND From Source
1.3.1. Obtaining Sources
The rocRAND sources are available from the rocRAND GitHub Repository. Use the branch that matches the system-installed version of ROCm. For example on a system that has ROCm 5.3 installed, use the following command to obtain rocRAND sources:
git checkout -b rocm-5.3 https://github.com/ROCmSoftwarePlatform/rocRAND.git
1.3.2. Building The Library
After obtaining the sources, rocRAND can be built using the installation script:
cd rocrand
./install --install
This automatically builds all required dependencies, excluding HIP and Git, and installs the project to /opt/rocm
if everything went well. See ./install --help
for further information.
1.3.3. Building With CMake
For a more elaborate installation process, rocRAND can be built manually using CMake. This enables certain configuration options that are not exposed to the ./install
script. In general, rocRAND can be built using CMake by configuring as follows:
cd rocrand; mkdir build; cd build
# Configure the project
CXX=<compiler> cmake [options] ..
# Build
make -j4
# Optionally, run the tests
ctest --output-on-failure
# Install
[sudo] make install
Where <compiler>
can be set to hipcc
to build for the ROCm platform, or to nvcc
to build for CUDA. The following configuration options are available, in addition to the built-in CMake options:
BUILD_FORTRAN_WRAPPER
controls whether to build the Fortran wrapper. Defaults toOFF
.BUILD_TEST
controls whether to build the rocRAND tests. Defaults toOFF
.BUILD_BENCHMARK
controls whether to build the rocRAND benchmarks. Defaults toOFF
.BUILD_ADDRESS_SANITIZER
controls whether to build with address sanitization enabled. Defaults toOFF
.USE_HIP_CPU
is an experimental option that controls whether to build for HIP-CPU. Defaults toOFF
.
1.4. Building the Python API Wrapper
1.4.1. Requirements
The rocRAND Python API Wrapper requires the following dependencies:
rocRAND
Python 3.5
NumPy (will be installed automatically as a dependency if necessary)
Note: If rocRAND is built from sources but not installed or installed in
non-standard directory, set the ROCRAND_PATH
environment variable. For example:
export ROCRAND_PATH=~/rocRAND/build/library/
1.4.2. Installing
The Python rocRAND module can be installed using pip:
cd rocrand/python/rocrand
pip install .
The tests can be executed as follows:
cd rocrand/python/rocrand
python tests/rocrand_test.py