OpenMPCD
|
Represents a memory buffer on the Device. More...
#include <DeviceBuffer.hpp>
Public Member Functions | |
DeviceBuffer (const std::size_t elementCount_) | |
The constructor. More... | |
~DeviceBuffer () | |
The destructor. More... | |
T * | getPointer () |
Returns the Device pointer. More... | |
const T * | getPointer () const |
Returns the Device pointer. More... | |
std::size_t | getElementCount () const |
Returns the number of elements the buffer can store. More... | |
void | copyFromDevice (const T *const src) |
Copies getElementCount() elements from the given Device pointer to this buffer. More... | |
void | zeroMemory () |
Writes zero-bytes to the entirety of this buffer. More... | |
Represents a memory buffer on the Device.
The memory for this buffer will be allocated and freed automatically.
T | The underlying data type. |
Definition at line 24 of file DeviceBuffer.hpp.
OpenMPCD::CUDA::DeviceBuffer< T >::DeviceBuffer | ( | const std::size_t | elementCount_ | ) |
The constructor.
OpenMPCD::InvalidArgumentException | If OPENMPCD_DEBUG is defined, throws if elemtCount_ == 0 . |
[in] | elementCount_ | The number of elements to allocate memory for. No constructors will be called. Must not be 0 . |
Definition at line 19 of file ImplementationDetails/DeviceBuffer.hpp.
OpenMPCD::CUDA::DeviceBuffer< T >::~DeviceBuffer |
The destructor.
This will free the allocated memory, but will not call any destructors.
Definition at line 31 of file ImplementationDetails/DeviceBuffer.hpp.
void OpenMPCD::CUDA::DeviceBuffer< T >::copyFromDevice | ( | const T *const | src | ) |
Copies getElementCount()
elements from the given Device pointer to this buffer.
OpenMPCD::NULLPointerException | If OPENMPCD_DEBUG is defined, throws if src == nullptr . |
[in] | src | The Device pointer to copy from, which must not be nullptr and must point to at least getElementCount() elements. |
Definition at line 55 of file ImplementationDetails/DeviceBuffer.hpp.
std::size_t OpenMPCD::CUDA::DeviceBuffer< T >::getElementCount |
Returns the number of elements the buffer can store.
Definition at line 49 of file ImplementationDetails/DeviceBuffer.hpp.
const T * OpenMPCD::CUDA::DeviceBuffer< T >::getPointer |
Returns the Device pointer.
Definition at line 37 of file ImplementationDetails/DeviceBuffer.hpp.
const T* OpenMPCD::CUDA::DeviceBuffer< T >::getPointer | ( | ) | const |
Returns the Device pointer.
void OpenMPCD::CUDA::DeviceBuffer< T >::zeroMemory |
Writes zero-bytes to the entirety of this buffer.
Definition at line 64 of file ImplementationDetails/DeviceBuffer.hpp.