Resource managing class for raw memory allocated on a GPU device through OpenCL. More...
#include <cmtkDeviceMemoryCL.h>
Classes | |
class | bad_alloc |
Exception for failed allocation. More... | |
Public Types | |
typedef DeviceMemoryCL | Self |
This class. | |
typedef SmartConstPointer< Self > | SmartConstPtr |
Smart pointer-to-const. | |
typedef SmartPointer< Self > | SmartPtr |
Smart pointer. | |
Public Member Functions | |
virtual | ~DeviceMemoryCL () |
Destructor: free memory through CL. | |
Protected Member Functions | |
Self::SmartPtr | Alloc (const size_t nBytes, const size_t padToMultiple=1) |
Create new object and allocate memory. | |
void | CopyToDevice (const void *const srcPtrHost, const size_t nBytes) |
Copy from host to device memory. | |
void | CopyFromDevice (void *const dstPtrHost, const size_t nBytes) const |
Copy from device to host memory. | |
void | CopyOnDevice (const Self &srcPtrDevice, const size_t nBytes) |
Copy between two device memory locations. | |
void | Memset (const int value, const size_t nBytes) |
Copy between two device memory locations. | |
DeviceMemoryCL (const size_t nBytes, const size_t padToMultiple=1) | |
Constructor: allocate memory through CL. | |
Protected Attributes | |
void * | m_PointerDevice |
Raw pointer to allocated device memory. |
Resource managing class for raw memory allocated on a GPU device through OpenCL.
Definition at line 51 of file cmtkDeviceMemoryCL.h.
This class.
Reimplemented in cmtk::DeviceMemory< float >, cmtk::DeviceMemory< int >, and cmtk::DeviceMemory< UniformVolumeOnDevice >.
Definition at line 57 of file cmtkDeviceMemoryCL.h.
Smart pointer-to-const.
Reimplemented in cmtk::DeviceMemory< float >, cmtk::DeviceMemory< int >, and cmtk::DeviceMemory< UniformVolumeOnDevice >.
Definition at line 60 of file cmtkDeviceMemoryCL.h.
Smart pointer.
Reimplemented in cmtk::DeviceMemory< float >, cmtk::DeviceMemory< int >, and cmtk::DeviceMemory< UniformVolumeOnDevice >.
Definition at line 63 of file cmtkDeviceMemoryCL.h.
cmtk::DeviceMemoryCL::~DeviceMemoryCL | ( | ) | [virtual] |
Destructor: free memory through CL.
Definition at line 50 of file cmtkDeviceMemoryCL.cxx.
cmtk::DeviceMemoryCL::DeviceMemoryCL | ( | const size_t | nBytes, |
const size_t | padToMultiple = 1 |
||
) | [protected] |
Constructor: allocate memory through CL.
nBytes | Number of bytes to allocate |
padToMultiple | Pad to allocate nearest multiple of this many bytes. |
Definition at line 40 of file cmtkDeviceMemoryCL.cxx.
References NULL.
Self::SmartPtr cmtk::DeviceMemoryCL::Alloc | ( | const size_t | nBytes, |
const size_t | padToMultiple = 1 |
||
) | [inline, protected] |
Create new object and allocate memory.
Definition at line 73 of file cmtkDeviceMemoryCL.h.
void cmtk::DeviceMemoryCL::CopyFromDevice | ( | void *const | dstPtrHost, |
const size_t | nBytes | ||
) | const [protected] |
Copy from device to host memory.
Definition at line 63 of file cmtkDeviceMemoryCL.cxx.
void cmtk::DeviceMemoryCL::CopyOnDevice | ( | const Self & | srcPtrDevice, |
const size_t | nBytes | ||
) | [protected] |
Copy between two device memory locations.
Reimplemented in cmtk::DeviceMemory< float >, cmtk::DeviceMemory< int >, and cmtk::DeviceMemory< UniformVolumeOnDevice >.
Definition at line 69 of file cmtkDeviceMemoryCL.cxx.
void cmtk::DeviceMemoryCL::CopyToDevice | ( | const void *const | srcPtrHost, |
const size_t | nBytes | ||
) | [protected] |
Copy from host to device memory.
Definition at line 57 of file cmtkDeviceMemoryCL.cxx.
Referenced by cmtk::DeviceMemory< UniformVolumeOnDevice >::Create().
void cmtk::DeviceMemoryCL::Memset | ( | const int | value, |
const size_t | nBytes | ||
) | [protected] |
Copy between two device memory locations.
Definition at line 75 of file cmtkDeviceMemoryCL.cxx.
void* cmtk::DeviceMemoryCL::m_PointerDevice [protected] |
Raw pointer to allocated device memory.
Note that this is a device memory space pointer, which is not valid in host memory and can, therefore, not be dereferenced in host code.
Definition at line 97 of file cmtkDeviceMemoryCL.h.