Building and installing rocFFT#

This topic explains how to install rocFFT from the prebuilt packages or build it from the source code.

Installing prebuilt packages#

For information on downloading and installing ROCm, see the ROCm installation guide.

To install rocFFT, use the package manager for your Linux distribution.

For example, on the Ubuntu distribution, run the following command:

sudo apt update && sudo apt install rocfft

Building rocFFT from source#

You can use the GitHub releases tab to download the source code. This might provide you with a more recent version than the prebuilt packages.

rocFFT uses the AMD clang++ compiler and CMake. You can specify several options to customize your build. Use the following commands to build a shared library for the supported AMD GPUs:

mkdir build && cd build
cmake -DCMAKE_CXX_COMPILER=amdclang++ -DCMAKE_C_COMPILER=amdclang ..
make -j

Note

To compile a static library, use the -DBUILD_SHARED_LIBS=off option.

In ROCm version 4.3 or higher, indirect function calls are enabled for rocFFT by default. Use -DROCFFT_CALLBACKS_ENABLED=off with CMake to prevent these calls on older ROCm versions.

Note

If rocFFT is built with this configuration, callbacks won’t work correctly.

rocFFT clients#

rocFFT includes the following clients and utilities:

  • rocfft-bench: Runs general transforms and performance analysis

  • rocfft-test: Runs a series of regression tests

  • Various samples

The following table includes the CMake option to build each client and the client dependencies.

Client

CMake option

Dependencies

rocfft-bench

-DBUILD_CLIENTS_BENCH=on

hipRAND

rocfft-test

-DBUILD_CLIENTS_TESTS=on

hipRAND, FFTW, GoogleTest

samples

-DBUILD_CLIENTS_SAMPLES=on

none

The clients are not built by default. To build them, use -DBUILD_CLIENTS=on. The build process downloads and builds GoogleTest and FFTW if they are not already installed. rocFFT uses version 1.11 of GoogleTest.

You can build the clients separately from the main library. For example, to build all the clients with an existing rocFFT library, invoke CMake from within the rocFFT-src/clients folder using these commands:

mkdir build && cd build
cmake -DCMAKE_CXX_COMPILER=amdclang++ -DCMAKE_PREFIX_PATH=/path/to/rocFFT-libb ..
make -j

To install the client dependencies on Ubuntu, run the following command:

sudo apt install libgtest-dev libfftw3-dev libboost-dev

Note

libboost-dev is the Boost development package. On Red Hat-related distributions, these packages are named gtest-devel, fftw-devel and boost-devel.