bnmf-algs
|
A wrapper template class around a contiguous array of T types laid out in device memory (GPU memory). More...
#include <device_memory_1d.hpp>
Public Types | |
using | value_type = T |
Type of the values wrapped around current DeviceMemory1D object. More... | |
Public Member Functions | |
DeviceMemory1D (size_t num_elems) | |
Construct a DeviceMemory1D object that allocates num_elems many T values on the GPU device. More... | |
DeviceMemory1D (const DeviceMemory1D &)=delete | |
Copy constructor (deleted). More... | |
DeviceMemory1D & | operator= (const DeviceMemory1D &)=delete |
Copy assignment operator (deleted). More... | |
DeviceMemory1D (DeviceMemory1D &&other) | |
Move constructor. More... | |
DeviceMemory1D & | operator= (DeviceMemory1D &&other) |
Move assignment operator. More... | |
~DeviceMemory1D () | |
Destruct the current DeviceMemory1D object by deallocating the held GPU memory. More... | |
T * | data () const |
Get a device pointer pointing to the memory allocated by the current DeviceMemory1D object. More... | |
size_t | bytes () const |
Get the number of bytes of the allocated memory on the GPU. More... | |
shape< 1 > | dims () const |
Get the dimensions of this memory region in terms of elements. More... | |
A wrapper template class around a contiguous array of T types laid out in device memory (GPU memory).
DeviceMemory1D class represents the memory for a contiguous sequence of T values in device memory. The intended use of this class is to provide an interface that can be used with CUDA functions.
DeviceMemory1D class owns the device memory it allocates, and therefore is responsible from the deallocation of the allocated GPU memory. This operation is performed upon object destruction.
DeviceMemory1D objects can be used with cuda::copy1D function along with HostMemory1D objects to copy memory from host/device to host/device locations. See cuda::copy1D for details about copying memory using CUDA functions.
T | Type of the values to be allocated in GPU device. |
using bnmf_algs::cuda::DeviceMemory1D< T >::value_type = T |
Type of the values wrapped around current DeviceMemory1D object.
|
inlineexplicit |
Construct a DeviceMemory1D object that allocates num_elems many T values on the GPU device.
After this DeviceMemory1D object is constructed, there will be num_elems many T types allocated on the GPU device. See cudaMalloc function documentation for memory allocation intrinsics.
num_elems | Number of T types to allocate on the GPU. |
|
delete |
Copy constructor (deleted).
Since DeviceMemory1D objects own the memory they own, only move operators are allowed.
|
inline |
Move constructor.
Move construct a new DeviceMemory1D object. After this constructor exits, the parameter DeviceMemory1D object does not point to any location and therefore must not be used.
other | Other DeviceMemory1D object to move from. |
|
inline |
Destruct the current DeviceMemory1D object by deallocating the held GPU memory.
This function deallocates the GPU memory held by the current DeviceMemory1D object. See cudaFree function documentation for memory deallocation intrinsics.
|
inline |
Get the number of bytes of the allocated memory on the GPU.
|
inline |
Get a device pointer pointing to the memory allocated by the current DeviceMemory1D object.
|
inline |
Get the dimensions of this memory region in terms of elements.
|
delete |
Copy assignment operator (deleted).
Since DeviceMemory1D objects own the memory they own, only move operators are allowed.
|
inline |
Move assignment operator.
Move assign to this DeviceMemory1D object. After this constructor exits, the parameter DeviceMemor(1D object does not point to any location and therefore must not be used. Additionally, the old memory pointed by this DeviceMemory1D is freed.
other | Other DeviceMemory1D object to move from. |