Friends

Detailed Description

template<typename T>
class skepu::Vector< T >

A vector container class, implemented as a wrapper for std::vector.

A skepu::Vector is a container of vector/array type and is implemented as a wrapper for std::vector. Its interface and behaviour is largely compatible with std::vector but with some additions and variations. Instead of the regular element, it sometimes returns a proxy element so it can distinguish between reads and writes. It also keeps track of which parts of it are currently allocated and uploaded to the GPU. If a computation is done, changing the vector in the GPU memory, it is not directly transferred back to the host memory. Instead, the vector waits until an element is accessed before any copying is done.

It also implements support for allocating and de-allocating page-locked memory using cudaMallocHost and cudaFreeHost. This could help is running asynchronous operations especially when using multiple CUDA devices. It can be enabled by defining USE_PINNED_MEMORY flag in the skeleton program.

Please refer to C++ STL vector documentation for more information about CPU side implementation.

Behaves like operator[] but does not care about synchronizing with device. Can be used when accessing many elements quickly so that no synchronization overhead effects performance. Make sure to properly synch with device by calling updateHost etc before use.

Update device with a vector range. If vector does not have an allocation on the device for the current range, create a new allocation and if specified, also copy vector data to device. Saves newly allocated ranges to m_deviceMemPointers_CL so vector can keep track of where and what it has stored on devices.

Parameters:

start

Pointer to first element in range to be updated with device.

numElements

Number of elemets in range.

device

Pointer to the device that should be synched with.

copy

Boolean value that tells whether to only allocate or also copy vector data to device. True copies, False only allocates.

Update device with a vector range. If vector does not have an allocation on the device for the current range, create a new allocation and if specified, also copy vector data to device. Saves newly allocated ranges to m_deviceMemPointers_CU so vector can keep track of where and what it has stored on devices.

Parameters:

start

Pointer to first element in range to be updated with device.

numElements

Number of elemets in range.

deviceID

Integer specififying the device that should be synched with.

copy

Boolean value that tells whether to only allocate or also copy vector data to device. True copies, False only allocates.