Refer to the DEV branch for the latest updates. The code is currently in development and comes with no guarantees that the API will remain the same.
A lightweight, backend-agnostic C++ GPU runtime abstraction library with support for CUDA and HIP. Write portable, high-performance GPU code using a unified interface.
Write portable, high-performance GPU code in idiomatic C++ — no backend lock-in.
- Backend-agnostic GPU runtime abstraction (CUDA, HIP)
- C++17 friendly interface
- Simple device memory management API
- Minimal runtime overhead
- Header-only
Choose one of the following development approaches:
Option 1: Using Development Containers (Recommended)
- Docker
- Internet connection
- (All dependencies are pre-configured in the container)
Option 2: Local Development
- C++17 (or newer) compatible compiler
- CMake 3.20+
- At least one supported GPU backend installed:
Pre-configured development containers are available in .devcontainer/. See .devcontainer/README.md for usage instructions and available configurations.
For local development (without containers), ensure you have a C++17 compiler, CMake 3.20+, and at least one supported GPU backend (CUDA or HIP) installed.
You can add GCXX to your project using CPMAddPackage:
CPMAddPackage(
NAME gcxx
GITHUB_REPOSITORY "SriramKatta/GCXX"
GIT_TAG "DEV"
)You must enable exactly one backend mode when adding gcxx (either CUDA or
HIP, but not both).
CUDA example:
CPMAddPackage(
NAME gcxx
GITHUB_REPOSITORY "SriramKatta/GCXX"
GIT_TAG "DEV"
OPTIONS
"GCXX_CUDA_MODE ON"
)HIP example:
CPMAddPackage(
NAME gcxx
GITHUB_REPOSITORY "SriramKatta/GCXX"
GIT_TAG "DEV"
OPTIONS
"GCXX_HIP_MODE ON"
)After adding the package, link your executable with:
target_link_libraries(exe-main PRIVATE gcxx::gcxx)GCXX uses CMake with presets for a simple, unified build experience across both dev containers and local development.
GCXX provides presets for different configurations. Use workflow presets to configure and build in one step:
CUDA Release Examples:
cmake --workflow --preset workflow_release_cuda_examplesCUDA Debug Examples:
cmake --workflow --preset workflow_debug_cuda_examplesHIP Release Examples:
cmake --workflow --preset workflow_release_hip_examplesHIP Debug Examples:
cmake --workflow --preset workflow_debug_hip_examplesExecutables will be available in the appropriate build/ subdirectory.
You can also configure and build in separate steps:
Configure:
cmake --preset release_cuda_examples # or debug_cuda_examples, release_hip_examples, etc.Build:
cmake --build --preset build_release_cuda_examplesFor full builds (examples + tests):
cmake --workflow --preset workflow_release_cuda_full
cmake --workflow --preset workflow_debug_hip_fullUse cmake --list-presets to see all available configure, build, and workflow presets.
Run tests using test presets:
ctest --preset test_release_cuda # CUDA Release tests
ctest --preset test_debug_cuda # CUDA Debug tests
ctest --preset test_release_hip # HIP Release tests
ctest --preset test_debug_hip # HIP Debug testsGCXX is licensed under the GNU General Public License v3.0 or later (GPL-3.0-or-later). See LICENSE for the full text.
Each source file carries an SPDX identifier (// SPDX-License-Identifier: GPL-3.0-or-later) so the license can be verified automatically with tools like reuse.