A class representing an OpenCL device memory allocation for container. More...
#include <device_mem_pointer_cl.h>
Public Member Functions | |
DeviceMemPointer_CL (T *root, T *start, int numElements, Device_CL *device) | |
DeviceMemPointer_CL (T *start, int numElements, Device_CL *device) | |
~DeviceMemPointer_CL () | |
void | copyHostToDevice (int numElements=-1, bool copyLast=false) const |
void | copyDeviceToHost (int numElements=-1, bool copyLast=false) const |
void | copyDeviceToDevice (cl_mem copyToPointer, int numElements, int dstOffset=0, int srcOffset=0) const |
cl_mem | getDeviceDataPointer () const |
void | changeDeviceData () |
A class representing an OpenCL device memory allocation for container.
This class represents an OpenCL device 1D memory allocation and controls the data transfers between host and device.
skepu::DeviceMemPointer_CL< T >::DeviceMemPointer_CL | ( | T * | root, |
T * | start, | ||
int | numElements, | ||
Device_CL * | device | ||
) |
The constructor allocates a certain amount of space in device memory and stores a pointer to some data in host memory. Takes a root address as well.
root | Pointer to starting address of data in host memory (can be same as start). |
start | Pointer to data in host memory. |
numElements | Number of elements to allocate memory for. |
device | Pointer to a valid device to allocate the space on. |
References skepu::Device_CL::getContext(), and skepu::Device_CL::getQueue().
skepu::DeviceMemPointer_CL< T >::DeviceMemPointer_CL | ( | T * | start, |
int | numElements, | ||
Device_CL * | device | ||
) |
The constructor allocates a certain amount of space in device memory and stores a pointer to some data in host memory.
start | Pointer to data in host memory. |
numElements | Number of elements to allocate memory for. |
device | Pointer to a valid device to allocate the space on. |
References skepu::Device_CL::getContext(), and skepu::Device_CL::getQueue().
skepu::DeviceMemPointer_CL< T >::~DeviceMemPointer_CL | ( | ) |
The destructor releases the allocated device memory.
void skepu::DeviceMemPointer_CL< T >::changeDeviceData | ( | ) |
Marks the device data as changed.
Referenced by skepu::MapArray< MapArrayFunc >::CL(), skepu::Reduce< ReduceFunc, ReduceFunc >::CL(), and skepu::Map< MapFunc >::CL().
void skepu::DeviceMemPointer_CL< T >::copyDeviceToDevice | ( | cl_mem | copyToPointer, |
int | numElements, | ||
int | dstOffset = 0 , |
||
int | srcOffset = 0 |
||
) | const |
Copies data from device memory to another device memory.
copyToPointer | The destination address. |
numElements | Number of elements to copy, default value -1 = all elements. |
dstOffset | Offset (if any) in destination pointer. |
srcOffset | Offset (if any) in source pointer. |
void skepu::DeviceMemPointer_CL< T >::copyDeviceToHost | ( | int | numElements = -1 , |
bool | copyLast = false |
||
) | const |
Copies data from device memory to host memory. Only copies if data on device has been marked as changed.
numElements | Number of elements to copy, default value -1 = all elements. |
copyLast | Boolean flag specifying whether should copy last updated copy only (default: false). |
Referenced by skepu::Reduce< ReduceFunc, ReduceFunc >::CL().
void skepu::DeviceMemPointer_CL< T >::copyHostToDevice | ( | int | numElements = -1 , |
bool | copyLast = false |
||
) | const |
Copies data from host memory to device memory.
numElements | Number of elements to copy, default value -1 = all elements. |
copyLast | Boolean flag specifying whether should copy last updated copy only (default: false). |
Referenced by skepu::Vector< T >::updateDevice_CL(), skepu::SparseMatrix< T >::updateDevice_CL(), skepu::Matrix< T >::updateDevice_CL(), and skepu::SparseMatrix< T >::updateDevice_Index_CL().
cl_mem skepu::DeviceMemPointer_CL< T >::getDeviceDataPointer | ( | ) | const |
Referenced by skepu::MapArray< MapArrayFunc >::CL(), skepu::Reduce< ReduceFunc, ReduceFunc >::CL(), and skepu::Map< MapFunc >::CL().