Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

cmtk::DeviceMemoryCL Class Reference
[cmtkGPU library]

Resource managing class for raw memory allocated on a GPU device through OpenCL. More...

#include <cmtkDeviceMemoryCL.h>

Inheritance diagram for cmtk::DeviceMemoryCL:
Inheritance graph
[legend]
Collaboration diagram for cmtk::DeviceMemoryCL:
Collaboration graph
[legend]

List of all members.

Classes

class  bad_alloc
 Exception for failed allocation. More...

Public Types

typedef DeviceMemoryCL Self
 This class.
typedef SmartConstPointer< SelfSmartConstPtr
 Smart pointer-to-const.
typedef SmartPointer< SelfSmartPtr
 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.

Detailed Description

Resource managing class for raw memory allocated on a GPU device through OpenCL.

Warning:
This is a skeleton only and not currently implemented. Make sure this is never copied.

Definition at line 51 of file cmtkDeviceMemoryCL.h.


Member Typedef Documentation

Smart pointer-to-const.

Reimplemented in cmtk::DeviceMemory< float >, cmtk::DeviceMemory< int >, and cmtk::DeviceMemory< UniformVolumeOnDevice >.

Definition at line 60 of file cmtkDeviceMemoryCL.h.


Constructor & Destructor Documentation

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.

Parameters:
nBytesNumber of bytes to allocate
padToMultiplePad to allocate nearest multiple of this many bytes.

Definition at line 40 of file cmtkDeviceMemoryCL.cxx.

References NULL.


Member Function Documentation

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.


Member Data Documentation

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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines