Encapsulates allocation/deallocation and access to arrays on both the host and device. More...
#include <parallel_array.h>
Public Member Functions | |
RType | getBuffer (ArraySize offset) |
RType | getBuffer () |
ArraySize | getByteSize (ArraySize arraySize) const |
ArraySize | getByteSize () const |
MemFlags | getFlags () const |
ArraySize | getInternalByteSize () const |
ArraySize | getInternalSize () const |
ArraySize | getSize () const |
ArrayType | getType () const |
bool | isDeviceArray () const |
bool | isHostArray () const |
ParallelArray (ArrayType type=ArrayTypes::DEVICE_ARRAY, ArraySize size=0, MemFlags flags=0) | |
Constructs on instance of a parallely array according the arguments. | |
void | print (const char *s, int stride=1) const |
void | printVal (const double4 &a) const |
void | printVal (const double3 &a) const |
void | printVal (const double &a) const |
void | printVal (const float4 &a) const |
void | printVal (const float3 &a) const |
void | printVal (const float &a) const |
void | printVal (const int4 &a) const |
void | printVal (const int &a) const |
void | setFlags (MemFlags flags) |
void | setSize (ArraySize size) |
virtual | ~ParallelArray () |
Protected Member Functions | |
virtual void | dealloc () |
virtual void | realloc () |
Private Types | |
typedef PMemManager::mem_flags | MemFlags |
typedef MemManager< Type, PType > | PMemManager |
Private Attributes | |
RType | buffer_ |
MemFlags | flags_ |
ArraySize | internalSize_ |
ArraySize | size_ |
ArrayType | type_ |
Encapsulates allocation/deallocation and access to arrays on both the host and device.
Definition at line 27 of file parallel_array.h.
typedef PMemManager::mem_flags parallel_utils::ParallelArray< Type, RType, PType >::MemFlags [private] |
Definition at line 30 of file parallel_array.h.
typedef MemManager<Type,PType> parallel_utils::ParallelArray< Type, RType, PType >::PMemManager [private] |
Definition at line 29 of file parallel_array.h.
parallel_utils::ParallelArray< Type, RType, PType >::ParallelArray | ( | ArrayType | type = ArrayTypes::DEVICE_ARRAY , |
|
ArraySize | size = 0 , |
|||
MemFlags | flags = 0 | |||
) | [inline] |
Constructs on instance of a parallely array according the arguments.
type | The type of array, either host or device | |
size | The size (in elements, not bytes) of the the array | |
flags | The flags to be used by the memory manager |
Definition at line 41 of file parallel_array.h.
virtual parallel_utils::ParallelArray< Type, RType, PType >::~ParallelArray | ( | ) | [inline, virtual] |
Destroys the array, freeing memory appropriately
Definition at line 49 of file parallel_array.h.
virtual void parallel_utils::ParallelArray< Type, RType, PType >::dealloc | ( | ) | [inline, protected, virtual] |
Definition at line 130 of file parallel_array.h.
RType parallel_utils::ParallelArray< Type, RType, PType >::getBuffer | ( | ArraySize | offset | ) | [inline] |
Definition at line 115 of file parallel_array.h.
RType parallel_utils::ParallelArray< Type, RType, PType >::getBuffer | ( | ) | [inline] |
Definition at line 114 of file parallel_array.h.
ArraySize parallel_utils::ParallelArray< Type, RType, PType >::getByteSize | ( | ArraySize | arraySize | ) | const [inline] |
Definition at line 109 of file parallel_array.h.
ArraySize parallel_utils::ParallelArray< Type, RType, PType >::getByteSize | ( | ) | const [inline] |
Definition at line 108 of file parallel_array.h.
MemFlags parallel_utils::ParallelArray< Type, RType, PType >::getFlags | ( | ) | const [inline] |
Definition at line 113 of file parallel_array.h.
ArraySize parallel_utils::ParallelArray< Type, RType, PType >::getInternalByteSize | ( | ) | const [inline] |
Definition at line 112 of file parallel_array.h.
ArraySize parallel_utils::ParallelArray< Type, RType, PType >::getInternalSize | ( | ) | const [inline] |
Definition at line 111 of file parallel_array.h.
ArraySize parallel_utils::ParallelArray< Type, RType, PType >::getSize | ( | ) | const [inline] |
Definition at line 110 of file parallel_array.h.
ArrayType parallel_utils::ParallelArray< Type, RType, PType >::getType | ( | ) | const [inline] |
Definition at line 107 of file parallel_array.h.
bool parallel_utils::ParallelArray< Type, RType, PType >::isDeviceArray | ( | ) | const [inline] |
Definition at line 106 of file parallel_array.h.
bool parallel_utils::ParallelArray< Type, RType, PType >::isHostArray | ( | ) | const [inline] |
Definition at line 105 of file parallel_array.h.
void parallel_utils::ParallelArray< Type, RType, PType >::print | ( | const char * | s, | |
int | stride = 1 | |||
) | const [inline] |
Prints the array to the console. Utility only.
s | The string prefix | |
stride | The stride between elements in the buffer to print |
Definition at line 88 of file parallel_array.h.
void parallel_utils::ParallelArray< Type, RType, PType >::printVal | ( | const double4 & | a | ) | const [inline] |
Definition at line 103 of file parallel_array.h.
void parallel_utils::ParallelArray< Type, RType, PType >::printVal | ( | const double3 & | a | ) | const [inline] |
Definition at line 102 of file parallel_array.h.
void parallel_utils::ParallelArray< Type, RType, PType >::printVal | ( | const double & | a | ) | const [inline] |
Definition at line 101 of file parallel_array.h.
void parallel_utils::ParallelArray< Type, RType, PType >::printVal | ( | const float4 & | a | ) | const [inline] |
Definition at line 100 of file parallel_array.h.
void parallel_utils::ParallelArray< Type, RType, PType >::printVal | ( | const float3 & | a | ) | const [inline] |
Definition at line 99 of file parallel_array.h.
void parallel_utils::ParallelArray< Type, RType, PType >::printVal | ( | const float & | a | ) | const [inline] |
Definition at line 98 of file parallel_array.h.
void parallel_utils::ParallelArray< Type, RType, PType >::printVal | ( | const int4 & | a | ) | const [inline] |
Definition at line 97 of file parallel_array.h.
void parallel_utils::ParallelArray< Type, RType, PType >::printVal | ( | const int & | a | ) | const [inline] |
Definition at line 96 of file parallel_array.h.
virtual void parallel_utils::ParallelArray< Type, RType, PType >::realloc | ( | ) | [inline, protected, virtual] |
Definition at line 119 of file parallel_array.h.
void parallel_utils::ParallelArray< Type, RType, PType >::setFlags | ( | MemFlags | flags | ) | [inline] |
Sets flags governing memory allocation and memory transfer specific for the parallel type
flags | The flags to be used by the memory manager |
Definition at line 73 of file parallel_array.h.
void parallel_utils::ParallelArray< Type, RType, PType >::setSize | ( | ArraySize | size | ) | [inline] |
Sets the size of the array, reallocating memory appropriately. No guarantees on data preservation
size | The number of elements fot the new array |
Definition at line 59 of file parallel_array.h.
RType parallel_utils::ParallelArray< Type, RType, PType >::buffer_ [private] |
Handle to the actual memory
Definition at line 145 of file parallel_array.h.
MemFlags parallel_utils::ParallelArray< Type, RType, PType >::flags_ [private] |
Flags governing array processing by the memory manager
Definition at line 143 of file parallel_array.h.
ArraySize parallel_utils::ParallelArray< Type, RType, PType >::internalSize_ [private] |
The internal size of the array, may be more than the reported size
Definition at line 142 of file parallel_array.h.
ArraySize parallel_utils::ParallelArray< Type, RType, PType >::size_ [private] |
The number of elements in the array
Definition at line 141 of file parallel_array.h.
ArrayType parallel_utils::ParallelArray< Type, RType, PType >::type_ [private] |
The type of the array, eithe host or device
Definition at line 140 of file parallel_array.h.