CUDA-API-wrappers: Thin C++-flavored wrappers for the CUDA runtime API

Eyal Rozenberg



nVIDIA’s Runtime API for CUDA is intended for use both in C and C++ code. As such, it uses a C-style API, the lower common denominator (with a few notable exceptions of templated function overloads).

This library of wrappers around the Runtime API is intended to allow us to embrace many of the features of C++ (including some C++11) for using the runtime API – but without reducing expressivity or increasing the level of abstraction (as in, e.g., the Thrust library). Using cuda-api-wrappers, you still have your devices, streams, events and so on – but they will be more convenient to work with in more C++-idiomatic ways.


Key features

  • All functions and methods throw exceptions on failure – no need to check return values (the exceptions carry the status information).
  • Judicious namespacing (and some internal namespace-like classes) for better clarity and for semantically grouping related functionality together.
  • There are proxy objects for devices, streams, events and so on, using RAII to relieve you of remembering to free or destroy resources.
  • Various Plain Old Data structs adorned with convenience methods and operators.
  • Aims for clarity and straightforwardness in naming and semantics, so that you don’t need to refer to the official documentation to understand what each class and function do.
  • Thin and lightweight:
    No work done behind your back, no caches or indices or any such thing.
    No costly inheritance structure, vtables, virtual methods and so on – vanishes almost entirely on compilation
    Doesn’t “hide” any of CUDA’s complexity or functionality; it only simplifies use of the Runtime API.
Rating: 2.0/5. From 5 votes.
Please wait...

* * *

* * *

HGPU group © 2010-2021 hgpu.org

All rights belong to the respective authors

Contact us: