cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
Public Types | Public Member Functions | Friends | List of all members
cuda::array_t< T, NumDimensions > Class Template Reference

Owning wrapper for CUDA 2D and 3D arrays. More...

#include <array.hpp>

Public Types

using handle_type = array::handle_t
 
using dimensions_type = array::dimensions_t< NumDimensions >
 

Public Member Functions

 array_t (device::id_t device_id, handle_type handle, dimensions_type dimensions)
 Constructs a CUDA array wrapper from the raw type used by the CUDA Runtime API - and takes ownership of the array.
 
 array_t (const array_t &other)=delete
 
 array_t (array_t &&other) noexcept
 
handle_type get () const noexcept
 
device_t device () const noexcept
 
dimensions_type dimensions () const noexcept
 
::std::size_t size () const noexcept
 
::std::size_t size_bytes () const noexcept
 

Friends

array_t array::wrap (device::id_t, handle_type, dimensions_type) noexcept
 

Detailed Description

template<typename T, dimensionality_t NumDimensions>
class cuda::array_t< T, NumDimensions >

Owning wrapper for CUDA 2D and 3D arrays.

A CUDA array is a multi-dimensional structure on CUDA GPUs with specific GPU hardware support. CUDA arrays are not equivalent to ::std::arrays, nor to C/C++ arrays! Please read the relevant sections of the CUDA programming guide for information regarding the uses of these arrays: https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#cuda-arrays

Arrays are particularly useful in combination with texture memory (see cuda::texture_view): One can access elements in a multi dimensional array with the index, e.g. array[i][j][k]. In CUDA it is possible to create a texture on an array, allowing for different kind of access to array elements, e.g. texture[u][v][w] with u, v, w in [0, 1], with normalized coordinates. Depending on the texture configuration you obtain a value, which is interpolated between the nearest corresponding array elements.

Note
CUDA only supports arrays of 2 or 3 dimensions.

The documentation for this class was generated from the following files: