cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
|
Owning wrapper for CUDA 2D and 3D arrays. More...
#include <array.hpp>
Public Types | |
using | handle_type = array::handle_t |
using | descriptor_type = array::descriptor_t< NumDimensions > |
using | dimensions_type = array::dimensions_t< NumDimensions > |
Public Member Functions | |
array_t (device::id_t device_id, context::handle_t context_handle, 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::id_t | device_id () const noexcept |
context::handle_t | context_handle () const noexcept |
dimensions_type | dimensions () const noexcept |
device_t | device () const noexcept |
context_t | context () const |
::std::size_t | size () const noexcept |
::std::size_t | size_bytes () const noexcept |
descriptor_type | descriptor () const |
Friends | |
array_t | array::wrap (device::id_t, context::handle_t, handle_type, dimensions_type) noexcept |
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::array
s, 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.