Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

gunrock

> 编程语言
Open source

Programmable CUDA/C++ GPU Graph Analytics

1.1K stars0 likes0 views
WebsiteGitHub

About

Programmable CUDA/C++ GPU Graph Analytics

Gunrock: CUDA/C++ GPU Graph Analytics

Examples Project Template Documentation Deprecated Documentation GitHub Actions

Gunrock[^1] is a CUDA library for graph-processing designed specifically for the GPU. It uses a high-level, bulk-synchronous/asynchronous, data-centric abstraction focused on operations on vertex or edge frontiers. Gunrock achieves a balance between performance and expressiveness by coupling high-performance GPU computing primitives and optimization strategies, particularly in the area of fine-grained load balancing, with a high-level programming model that allows programmers to quickly develop new graph primitives that scale from one to many GPUs on a node with small code size and minimal GPU programming knowledge.

Branch Purpose Version Status
main Default branch, ported from gunrock/essentials, serves as the official release branch. $\geq$ 2.x.x Active
master Previous release branch for gunrock/gunrock version 1.x.x interface, preserves all commit history. $\leq$ 1.x.x Deprecated

Quick Start Guide

Prerequisites

Before building Gunrock, ensure you have the following installed:

  • CMake version 3.24 or higher
  • C++ compiler with C++17 support (GCC 7+, Clang 5+, or MSVC 2017+)
  • CUDA Toolkit (NVIDIA) version 12.4+ or ROCm/HIP (AMD) version 6.4+[^2]
  • Git (for cloning the repository)

[!WARNING] For AMD/ROCm builds, you may need to install additional ROCm packages: rocprim-dev, rocthrust-dev, hipcub-dev, hiprand-dev, hipsparse-dev, rocrand, and roctracer. These are typically installed with a full ROCm installation.

Building Gunrock

1. Clone the Repository

bash
git clone https://github.com/gunrock/gunrock.git
cd gunrock

2. Create Build Directory

bash
mkdir build && cd build

3. Configure CMake

For AMD/ROCm Backend:

bash
# For AMD MI350/MI355 (gfx950) - adjust CMAKE_HIP_ARCHITECTURES for your GPU
cmake -DCMAKE_BUILD_TYPE=Release \
      -DESSENTIALS_AMD_BACKEND=ON \
      -DESSENTIALS_NVIDIA_BACKEND=OFF \
      -DCMAKE_HIP_ARCHITECTURES=gfx950 \
      ..

For NVIDIA/CUDA Backend:

bash
# For NVIDIA H100 (sm_90) - adjust CMAKE_CUDA_ARCHITECTURES for your GPU
cmake -DCMAKE_BUILD_TYPE=Release \
      -DESSENTIALS_AMD_BACKEND=OFF \
      -DESSENTIALS_NVIDIA_BACKEND=ON \
      -DCMAKE_CUDA_ARCHITECTURES=90 \
      ..

Common GPU Architecture Codes:

  • NVIDIA: 75 (Turing), 80 (Ampere), 86 (Ampere), 89 (Ada), 90 (Hopper)
  • AMD: gfx906 (Vega), gfx908 (MI100), gfx942 (MI300), gfx950 (MI350/MI355)

4. Build

Build all algorithms:

bash
make -j$(nproc)

Build specific algorithm:

bash
make bfs      # Breadth-First Search
make sssp     # Single-Source Shortest Path
make pr       # PageRank
make bc       # Betweenness Centrality
make color    # Graph Coloring
# ... and more

Build all examples:

bash
make examples

5. Run Examples

bash
# Run BFS
./bin/bfs --market ../datasets/chesapeake/chesapeake.mtx --src 0

# Run SSSP with validation
./bin/sssp --market ../datasets/chesapeake/chesapeake.mtx --src 0 --validate

# Run with custom optimization options
./bin/bfs --market ../datasets/chesapeake/chesapeake.mtx \
          --src 0 \
          --advance_load_balance merge_path \
          --enable_filter \
          --filter_algorithm compact \
          --num_runs 10

Implementing Graph Algorithms

For a detailed explanation, please see the full documentation. The following example shows simple APIs using Gunrock's data-centric, bulk-synchronous programming model, we implement Breadth-First Search on GPUs. This example skips the setup phase of creating a problem_t and enactor_t struct and jumps straight into the actual algorithm.

We first prepare our frontier with the initial source vertex to begin push-based BFS traversal. A simple f->push_back(source) places the initial vertex we will use for our first iteration.

cpp
void prepare_frontier(frontier_t* f,
                      gcuda::multi_context_t& context) override {
  auto P = this->get_problem();
  f->push_back(P->param.single_source);
}

We then begin our iterative loop, which iterates until a convergence condition has been met. If no condition has been specified, the loop converges when the frontier is empty.

…

include/gunrock/algorithms/bfs.hxx

How to Cite Gunrock & Essentials

Thank you for citing our work.

…
bibtex
@InProceedings{Osama:2022:EOP,
  author =	 {Muhammad Osama and Serban D. Porumbescu and John D. Owens},
  title =	 {Essentials of Parallel Graph Analytics},
  booktitle =	 {Proceedings of the Workshop on Graphs,
                  Architectures, Programming, and Learning},
  year =	 2022,
  series =	 {GrAPL 2022},
  month =	 may,
  pages =	 {314--317},
  doi =		 {10.1109/IPDPSW55747.2022.00061},
  url =          {https://escholarship.org/uc/item/2p19z28q},
}

Copyright & License

Gunrock is copyright The Regents of the University of California. The library, examples, and all source code are released under Apache 2.0.

[^1]: This repository has been moved from https://github.com/gunrock/essentials and the previous history is preserved with tags and under master branch. Read more about gunrock and essentials in our vision paper: Essentials of Parallel Graph Analytics. [^2]: Recommended CUDA v12.4 or higher and ROCm 6.4 or higher.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++algorithmalgorithmscppcuda

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言