Build RDC from source#

To build RDC as part of the ROCm Core SDK, see TheRock build instructions. TheRock is the recommended way to build ROCm components from source.

Alternatively, you can build RDC standalone using the instructions given in the following sections.

Build and install RDC#

To build RDC from source, install the dependencies and follow the steps given in the following sections.

Dependencies#

  • CMake >= 3.15

  • g++ (5.4.0)

  • gRPC and protoc

  • libcap-dev

    $ sudo apt install libcap-dev
    

For building latest documentation:

  • Doxygen (1.8.11)

    $ sudo apt install -y doxygen
    
  • LaTeX (pdfTeX 3.14159265-2.6-1.40.16)

Build gRPC and Protoc#

gRPC and Protoc must be built from source as the prebuilt packages are not available for the same. Here are the steps:

  1. Install the required tools:

    sudo apt-get update
    sudo apt-get install automake make g++ unzip build-essential autoconf libtool pkg-config libgflags-dev libgtest-dev clang libc++-dev curl libcap-dev
    
  2. Clone and build gRPC:

    git clone -b v1.67.1 https://github.com/grpc/grpc --depth=1 --shallow-submodules --recurse-submodules
    cd grpc
    export GRPC_ROOT=/opt/grpc
    cmake -B build \
        -DgRPC_INSTALL=ON \
        -DgRPC_BUILD_TESTS=OFF \
        -DBUILD_SHARED_LIBS=ON \
        -DCMAKE_INSTALL_PREFIX="$GRPC_ROOT" \
        -DCMAKE_INSTALL_LIBDIR=lib \
        -DCMAKE_BUILD_TYPE=Release
    make -C build -j $(nproc)
    sudo make -C build install
    echo "$GRPC_ROOT" | sudo tee /etc/ld.so.conf.d/grpc.conf
    sudo ldconfig
    cd ..
    

Build RDC#

  1. Clone the RDC repository:

    git clone https://github.com/ROCm/rocm-systems --recursive
    cd rocm-systems/projects/rdc
    
  2. Configure the build:

    cmake -B build -DGRPC_ROOT="$GRPC_ROOT"
    
  3. You can also enable the following optional features:

    • ROCm profiler:

      cmake -B build -DBUILD_PROFILER=ON
      
    • ROCm Validation Suite (RVS):

      cmake -B build -DBUILD_RVS=ON
      
    • RDC library only (without rdci and rdcd):

      cmake -B build -DBUILD_STANDALONE=OFF
      
    • RDC library without ROCm runtime:

      cmake -B build -DBUILD_RUNTIME=OFF
      
  4. Build and install:

    make -C build -j $(nproc)
    sudo make -C build install
    
  5. Update system library path:

    export RDC_LIB_DIR=/opt/rocm/lib/rdc
    export GRPC_LIB_DIR="/opt/grpc/lib"
    echo "${RDC_LIB_DIR}" | sudo tee /etc/ld.so.conf.d/x86_64-librdc_client.conf
    echo "${GRPC_LIB_DIR}" | sudo tee -a /etc/ld.so.conf.d/x86_64-librdc_client.conf
    sudo ldconfig
    

Build documentation#

You can generate PDF documentation after a successful build. The reference manual, refman.pdf, appears in the latex directory.

$ make doc
$ cd latex
$ make

Build unit tests for RDC tool#

$ cd rocm-systems/projects/rdc/tests/rdc_tests
$ mkdir -p build; cd build
$ cmake -DROCM_DIR=/opt/rocm -DGRPC_ROOT="$GRPC_PROTOC_ROOT"..
$ make

# To run the tests

$ cd build/rdctst_tests
$ ./rdctst

Test#

# Run rdcd daemon
$ LD_LIBRARY_PATH=$PWD/rdc_libs/  ./server/rdcd -u

# In another console run the RDC command-line
$ LD_LIBRARY_PATH=$PWD/rdc_libs/  ./rdci/rdci discovery -l -u