Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/build_systems.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build Systems

on:
push:
branches: [ amd-staging, amd-mainline, release/** ]
paths:
- 'Systems/**'
- '.github/workflows/**'
pull_request:
branches: [ amd-staging, amd-mainline, release/** ]
paths:
- 'Systems/**'
- '.github/workflows/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

env:
DEBIAN_FRONTEND: noninteractive
ROCM_VERSION: '7.2'
AMDGPU_INSTALLER_VERSION: 7.2.70200-1
GPU_TARGETS: gfx908;gfx90a;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1200;gfx1201
HIPFILE_BASE_URL: https://github.com/ROCm/hipFile/releases/download/nightly

jobs:
build:
name: "Build Systems Examples"
runs-on: ubuntu-latest
container:
image: ubuntu:24.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update -qq &&
apt-get install -y build-essential g++ cmake \
locales wget pkg-config libmount-dev
- name: Install ROCm Dev
run: |
wget https://repo.radeon.com/amdgpu-install/${{ env.ROCM_VERSION }}/ubuntu/noble/amdgpu-install_${{ env.AMDGPU_INSTALLER_VERSION }}_all.deb
apt-get -y install ./amdgpu-install_${{ env.AMDGPU_INSTALLER_VERSION }}_all.deb &&
apt-get update -qq &&
apt-get install -y rocm-dev
rm -rf /var/lib/apt/lists/*
echo "/opt/rocm/bin" >> $GITHUB_PATH
echo "ROCM_PATH=/opt/rocm" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/opt/rocm/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
apt-get autoclean
- name: Install hipFile nightly packages
run: |
wget ${{ env.HIPFILE_BASE_URL }}/hipfile_0.2.0.70200-nightly.9999.24.04_amd64.deb
wget ${{ env.HIPFILE_BASE_URL }}/hipfile-dev_0.2.0.70200-nightly.9999.24.04_amd64.deb
apt-get install -y ./hipfile_0.2.0.70200-nightly.9999.24.04_amd64.deb \
./hipfile-dev_0.2.0.70200-nightly.9999.24.04_amd64.deb
- name: CMake Configure and Build
run: |
cd Systems
cmake -DCMAKE_BUILD_TYPE=Release -DGPU_TARGETS="${GPU_TARGETS}" -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -S . -B build
cmake --build build -j $(nproc)
- name: Make
run: |
cd Systems
make -j $(nproc)
71 changes: 71 additions & 0 deletions .github/workflows/build_systems_cuda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build Systems CUDA

on:
push:
branches: [ amd-staging, amd-mainline, release/** ]
paths:
- 'Systems/**'
- '.github/workflows/**'
pull_request:
branches: [ amd-staging, amd-mainline, release/** ]
paths:
- 'Systems/**'
- '.github/workflows/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

env:
DEBIAN_FRONTEND: noninteractive
ROCM_VERSION: '7.2'
AMDGPU_INSTALLER_VERSION: 7.2.70200-1
HIPFILE_BASE_URL: https://github.com/ROCm/hipFile/releases/download/nightly

jobs:
build:
name: "Build Systems CUDA"
runs-on: ubuntu-latest
container:
image: nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04
options: --user root
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
apt-get update -qq &&
apt-get install -y build-essential g++ cmake \
locales wget git pkg-config libmount-dev rsync

- name: Install cuFile (CUDA GDS)
run: |
apt-get update -qq &&
apt-get install -y libcufile-dev
rm -rf /var/lib/apt/lists/*

- name: Install Hip for CUDA
run: |
wget https://repo.radeon.com/amdgpu-install/${{ env.ROCM_VERSION }}/ubuntu/noble/amdgpu-install_${{ env.AMDGPU_INSTALLER_VERSION }}_all.deb
apt-get -y install ./amdgpu-install_${{ env.AMDGPU_INSTALLER_VERSION }}_all.deb &&
apt-get update -qq &&
apt-get install -y hip-dev hipify-clang
echo "/opt/rocm/bin" >> $GITHUB_PATH
echo "ROCM_PATH=/opt/rocm" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/opt/rocm/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV

- name: Install hipFile nightly packages
run: |
wget ${{ env.HIPFILE_BASE_URL }}/hipfile_0.2.0.70200-nightly.9999.24.04_amd64.deb
wget ${{ env.HIPFILE_BASE_URL }}/hipfile-dev_0.2.0.70200-nightly.9999.24.04_amd64.deb
apt-get install -y ./hipfile_0.2.0.70200-nightly.9999.24.04_amd64.deb \
./hipfile-dev_0.2.0.70200-nightly.9999.24.04_amd64.deb

- name: Configure and Build
run: |
cd Systems && mkdir build && cd build
cmake -DROCM_EXAMPLES_GPU_LANGUAGE=CUDA -DHIP_PLATFORM=nvidia ..
cmake --build . -j $(nproc)
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ add_subdirectory(HIP-Basic)
add_subdirectory(HIP-Doc)
add_subdirectory(Libraries)
add_subdirectory(Programming-Guide)
add_subdirectory(Systems)
add_subdirectory(Tools)
add_subdirectory(Tutorials)
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ SUB_PROJECTS := \
HIP-Doc \
Libraries \
Programming-Guide \
Systems \
Tools

SKIP_FROM_TEST :=
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The examples are structured in several categories:
- [HIP-Doc](https://github.com/ROCm/rocm-examples/tree/amd-staging/HIP-Doc/) contains the example codes that are shown in the [HIP documentation](https://rocm.docs.amd.com/projects/HIP/en/latest/)
- [Libraries](https://github.com/ROCm/rocm-examples/tree/amd-staging/Libraries/) contains examples for ROCm-libraries, that provide higher-level functionality
- [Applications](https://github.com/ROCm/rocm-examples/tree/amd-staging/Applications/) showcases some common applications, using HIP to accelerate them
- [Systems](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/) contains examples for ROCm-systems, such as hipFile for GPU-direct storage I/O

- [AI](https://github.com/ROCm/rocm-examples/tree/amd-staging/AI/) contains instructions on how to use ROCm for AI
- [Tutorials](https://github.com/ROCm/rocm-examples/tree/amd-staging/Tutorials/) contains the code accompanying the HIP Tutorials that can be found in [the HIP documentation](https://rocm.docs.amd.com/projects/HIP/en/latest/tutorial/saxpy.html).
Expand Down Expand Up @@ -654,5 +655,21 @@ The following options are available when building with CMake.
- [rocprof-compute](https://github.com/ROCm/rocm-examples/tree/amd-staging/Tools/rocprof-compute): Shows how to use the ROCm Compute Profiler.
- [rocprof-systems](https://github.com/ROCm/rocm-examples/tree/amd-staging/Tools/rocprof-systems): Demonstrates how to use the ROCm Systems Profiler.
- [rocprofv3](https://github.com/ROCm/rocm-examples/tree/amd-staging/Tools/rocprofv3): Illustrates how to use the `rocprofv3` profiler.
- [Systems](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/) contains examples for ROCm systems libraries.
- [hipFile](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/) contains examples for the hipFile GPU-direct storage I/O library. hipFile supports all ROCm-capable GPUs on Linux; NVIDIA GPUs are supported when cuFile is installed.
- [aiscp](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/aiscp/): Copies a file to another file by routing data through GPU memory using hipFile, demonstrating GPU-direct storage I/O in the simplest possible end-to-end context.
- [api/get_version](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/api/get_version/): Queries the hipFile library version at both compile time (via header macros) and runtime (via `hipFileGetVersion`).
- [basics/bufregister_write](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/basics/bufregister_write/): Writes a registered GPU buffer to a file using `hipFileBufRegister` to enable the GPU-direct fast path.
- [basics/no_bufregister_write](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/basics/no_bufregister_write/): Writes a GPU buffer to a file without explicit buffer registration; hipFile routes the data through its internal pool buffer.
- [basics/no_odirect_write](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/basics/no_odirect_write/): Writes a registered GPU buffer to a file opened without `O_DIRECT`, triggering hipFile's POSIX-compatible fallback path.
- [basics/roundtrip_verify](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/basics/roundtrip_verify/): Performs a write-read-write round trip via hipFile and verifies data integrity with FNV-1a hashing.
- [basics/iterative_read](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/basics/iterative_read/): Reads a file into GPU memory in fixed-size chunks by advancing the device pointer on each `hipFileRead` call.
- [basics/iterative_devmem_offset_read](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/basics/iterative_devmem_offset_read/): Reads a file into a registered GPU buffer in chunks by advancing the `buf_offset` parameter rather than the base pointer.
- [basics/various_mem_rw](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/basics/various_mem_rw/): Round-trips a file through hipFile using device memory, managed memory, or pinned host memory, selectable at runtime.
- [basics/subregion_write](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/basics/subregion_write/): Reads a full file into a registered GPU buffer and then writes only a trailing sub-region to an output file using a non-zero `buf_offset`.
- [async/roundtrip_async](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/async/roundtrip_async/): Async GPU-direct read and write on the HIP default stream using `hipFileReadAsync` and `hipFileWriteAsync`.
- [async/roundtrip_async_nonblocking_stream](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/async/roundtrip_async_nonblocking_stream/): Same async round trip on an explicit `hipStreamNonBlocking` stream that does not implicitly synchronize with the default stream.
- [async/roundtrip_async_multi_stream](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/async/roundtrip_async_multi_stream/): Submits concurrent async read+write pairs across multiple independent non-blocking streams, each processing a non-overlapping file slice.
- [async/roundtrip_async_multi_stream_registered](https://github.com/ROCm/rocm-examples/tree/amd-staging/Systems/hipFile/async/roundtrip_async_multi_stream_registered/): Extends the multi-stream example by registering each stream with `hipFileStreamRegister` and fixed-parameter hints to reduce per-submission driver overhead.
- [Tutorials](https://github.com/ROCm/rocm-examples/tree/amd-staging/Tutorials/): Showcases HIP Documentation Tutorials.
- [reduction](https://github.com/ROCm/rocm-examples/tree/amd-staging/Tutorials/reduction/): Showcases a reduction tutorial for HIP Documentation.
30 changes: 30 additions & 0 deletions Systems/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# MIT License
#
# Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(Systems LANGUAGES CXX)

file(RELATIVE_PATH folder_bin ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${folder_bin})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${folder_bin})

add_subdirectory(hipFile)
47 changes: 47 additions & 0 deletions Systems/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# MIT License
#
# Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

ROCM_PATH ?= /opt/rocm
INCLUDE_DIR := $(ROCM_PATH)/include

SUBDIRECTORIES :=

ifneq ($(wildcard $(INCLUDE_DIR)/hipfile.h),)
SUBDIRECTORIES += hipFile
else
$(info hipFile not found ($(INCLUDE_DIR)/hipfile.h missing), skipping hipFile examples)
endif

SKIP_FROM_TEST :=

all: $(SUBDIRECTORIES)

clean: TARGET=clean
clean: all

$(SUBDIRECTORIES):
$(MAKE) -C $@ $(TARGET)

test: TARGET=test
test: $(filter-out $(SKIP_FROM_TEST),$(SUBDIRECTORIES))

.PHONY: all clean test $(SUBDIRECTORIES)
62 changes: 62 additions & 0 deletions Systems/hipFile/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# MIT License
#
# Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(hipFile LANGUAGES CXX)

include(CTest)

# Guard must precede any language enable: on Windows the HIP/CUDA toolchain
# may not be installed and enable_language() would abort configuration before
# a later return() could fire.
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
message(STATUS "hipFile examples are only available on Linux")
return()
endif()

include("${CMAKE_CURRENT_LIST_DIR}/../../Common/HipPlatform.cmake")
select_gpu_language()
enable_language(${ROCM_EXAMPLES_GPU_LANGUAGE})
select_hip_platform()

include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake")

find_package(hipFile QUIET)
if(NOT hipFile_FOUND)
message(STATUS "hipFile not found, skipping hipFile examples")
return()
endif()

# Directory used for test I/O. Must be on a local filesystem that supports
# O_DIRECT (ext4 or xfs). The GitHub Actions runner workspace is on an overlay
# filesystem that does not support O_DIRECT, so we default to /tmp.
set(HIPFILE_TEST_DIR "/tmp" CACHE PATH
"Directory for hipFile test I/O. Must be on an O_DIRECT-capable filesystem.")

file(RELATIVE_PATH folder_bin ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${folder_bin})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${folder_bin})

add_subdirectory(aiscp)
add_subdirectory(api)
add_subdirectory(async)
add_subdirectory(basics)
42 changes: 42 additions & 0 deletions Systems/hipFile/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# MIT License
#
# Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

SUBDIRECTORIES := \
aiscp \
api \
async \
basics

SKIP_FROM_TEST :=

all: $(SUBDIRECTORIES)

clean: TARGET=clean
clean: all

$(SUBDIRECTORIES):
$(MAKE) -C $@ $(TARGET)

test: TARGET=test
test: $(filter-out $(SKIP_FROM_TEST),$(SUBDIRECTORIES))

.PHONY: all clean test $(SUBDIRECTORIES)
Loading
Loading