Installation and building for Linux#

2025-05-20

4 min read time

Applies to Linux

You can install rocGRAPH using the following instructions. There are some prerequisites that should be installed prior to installing the rocGRAPH library, as described in the following steps.

Prerequisites#

Building rocGRAPH from source#

The following instructions can be used to build rocGRAPH from source files.

Requirements#

Note

rocGRAPH does not require hipcc and is tested against other compilers like g++. It does require the libraries in a ROCm installation.

Download rocGRAPH#

The rocGRAPH source code is available at the rocGRAPH GitHub page. Download the source code using the following commands:

$ git clone https://github.com/ROCm-DS/rocGRAPH.git
$ cd rocGRAPH

Using install.sh to build rocGRAPH with dependencies and clients#

It is recommended to install rocGRAPH using the install.sh script. The following table lists common uses of install.sh to build the library, its dependencies, and clients. Clients contain example code, unit tests and benchmarks.

Command

Description

./install.sh -h

Print help information.

./install.sh

Build library in your local directory. It is assumed that all dependencies are available.

./install.sh -d

Build library and its dependencies in your local directory. The -d flag only needs to be used once. For subsequent invocations of install.sh it is not necessary to rebuild the dependencies.

./install.sh -c

Build library, and client in your local directory. It is assumed dependencies are available.

./install.sh -dc

Build library, dependencies, and client in your local directory. The -d flag only needs to be used once. For subsequent invocations of install.sh it is not necessary to rebuild the dependencies.

./install.sh -i

Build library, then build and install rocGRAPH package in /opt/rocm/rocgraph. You will be prompted for sudo access. This will install for all users.

./install.sh -ic

Build library, and client, then build and install rocGRAPH package in opt/rocm/rocgraph. You will be prompted for sudo access. This will install for all users.

./install.sh -idc

Build library, dependencies, and client, then build and install rocGRAPH package in /opt/rocm/rocgraph. You will be prompted for sudo access. This will install for all users.

Note

You can also use the -a option on any of the preceding command to build the library for a supported architecture as listed in Supported Targets. For example:

./install.sh -i -a gfx908

Building rocGRAPH using individual commands#

CMake 3.5 or later is required in order to build rocGRAPH. The rocGRAPH library contains both host and device code, therefore the HIP compiler must be specified during the cmake configuration process.

# Create and change to build directory
$ mkdir -p build/release ; cd build/release

# Default install path is /opt/rocm, use -DCMAKE_INSTALL_PREFIX=<path> to adjust it
$ CXX=/opt/rocm/bin/hipcc cmake ../..

# Compile rocGRAPH library
$ make -j$(nproc)

# Install rocGRAPH to /opt/rocm
$ sudo make install

Building rocGRAPH with dependencies and clients#

Note

GoogleTest is required to build rocGRAPH clients.

# Install GoogleTest
$ mkdir -p build/release/deps ; cd build/release/deps
$ cmake ../../../deps
$ make -j$(nproc) install

# Change to build directory
$ cd ..

# Default install path is /opt/rocm, use -DCMAKE_INSTALL_PREFIX=<path> to adjust it
$ CXX=/opt/rocm/bin/hipcc cmake ../.. -DBUILD_CLIENTS_TESTS=ON \
                                      -DBUILD_CLIENTS_SAMPLES=ON

# Compile rocGRAPH library
$ make -j$(nproc)

# Install rocGRAPH to /opt/rocm
$ sudo make install

Test the installation#

You can test the installation by running one of the rocGRAPH examples after successfully compiling the library with clients.

# Navigate to clients binary directory
$ cd rocGRAPH/build/release/clients/staging

# Execute rocGRAPH example
$ ./example_csrmv 1000

Supported Targets#

Currently, rocGRAPH is supported under the following operating systems

To compile and run rocGRAPH, AMD ROCm Platform is required.

The following HIP capable devices are currently supported

  • gfx906 (e.g. Vega20, MI50, MI60)

  • gfx908

  • gfx90a (e.g. MI200)

  • gfx940

  • gfx941

  • gfx942

  • gfx1030 (e.g. Navi21)

  • gfx1100 (e.g. Navi31)

  • gfx1101 (e.g. Navi32)

  • gfx1102 (e.g. Navi33)

Common build problems#

  1. 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