ROCm/rocm-examples

A collection of examples for the ROCm software stack

What it solves

This repository provides a comprehensive collection of code examples to help users get started with ROCm and HIP, ranging from basic functionality to advanced GPU acceleration techniques. It bridges the gap for developers moving from CUDA to HIP or those new to GPU programming on AMD hardware.

How it works

The project is organized into several categories of examples:

  • HIP-Basic: Self-contained recipes for runtime functionality (e.g., memory bandwidth, matrix multiplication, and streams).
  • Applications: Real-world GPU-accelerated implementations of algorithms like bitonic sort, discrete convolutions, and Monte Carlo estimation of $\pi$.
  • Libraries: Examples demonstrating the use of ROCm-libraries for higher-level functionality.
  • AI: Instructions and examples for executing quantized models using Torch-MIGraphX.
  • Systems: Examples for ROCm-systems, including GPU-direct storage I/O via hipFile.
  • HIP-Doc: Code examples that accompany the official HIP documentation.

Who it’s for

  • New ROCm users looking for a starting point to learn HIP.
  • Experienced GPU developers seeking advanced examples of GPU acceleration.
  • CUDA developers wanting to port their existing NVIDIA-based code to AMD GPUs using tools like hipify.

Highlights

  • Cross-Platform Support: Buildable on both Linux and Windows (via Visual Studio or CMake).
  • CUDA Compatibility: Ability to compile for either HIP or CUDA platforms using the ROCM_EXAMPLES_GPU_LANGUAGE option.
  • Containerized Setup: Provides Dockerfiles to simplify the installation of prerequisites.
  • Broad Algorithmic Coverage: Includes implementations of common GPU patterns like prefix sums, optical flow, and Floyd-Warshall shortest paths.

Related

  • Project
  • Project
  • Project
  • Dispatch
  • Project