#include <PSkelArray.h>
List of all members.
Public Member Functions |
void | deviceAlloc () |
void | deviceFree () |
void | hostAlloc (size_t width, size_t height, size_t depth) |
void | hostAlloc () |
void | hostFree () |
__device__ __host__ size_t | getWidth () const |
__device__ __host__ size_t | getHeight () const |
__device__ __host__ size_t | getDepth () const |
__device__ __host__ size_t | memSize () const |
__device__ __host__ size_t | size () const |
__device__ __host__ size_t | realSize () const |
template<typename Arrays > |
void | hostSlice (Arrays array, size_t widthOffset, size_t heightOffset, size_t depthOffset, size_t width, size_t height, size_t depth) |
template<typename Arrays > |
void | hostClone (Arrays array) |
template<typename Arrays > |
void | hostMemCopy (Arrays array) |
void | copyToDevice () |
template<typename Arrays > |
void | copyFromDevice (Arrays array) |
void | copyToHost () |
__device__ __host__ | operator bool () const |
Protected Member Functions |
__device__ __forceinline__ T & | deviceGet (size_t h, size_t w, size_t d) const |
__host__ __forceinline__ T & | hostGet (size_t h, size_t w, size_t d) const |
| ArrayBase (size_t width, size_t height, size_t depth) |
Detailed Description
template<typename T>
class PSkel::ArrayBase< T >
Class that implements the basic data structure used by the parallel skeletons (such as stencil and map.) PSkel::ArrayBase is a 3D array that is also interfaced via 1D and 2D arrays. The PSkel::ArrayBase data structure that is extended by PSkel::Array, PSkel::Array2D, and PSkel::Array3D.
Constructor & Destructor Documentation
The ArrayBase constructor creates and allocates the specified array in the host memory.
- Parameters:
-
[in] | width | Width for the 3D array being created. |
[in] | height | Height for the 3D array being created. |
[in] | depth | Depth for the 3D array being created. |
Member Function Documentation
template<typename T >
template<typename Arrays >
The array given as argument is copied from the device allocated memory to the host allocated memory of this array. The data is efficiently transferred from device to host.
- Parameters:
-
[in] | array | the source array that holds the data that will be copied from device to the host memory of this array. |
The array is copied from the host allocated memory to the device allocated memory. The data is efficiently transferred from host to device. Both the host and device memory must be allocated before the data is transferred.
The array is copied from the device allocated memory to the host allocated memory. The data is efficiently transferred from device to host. Both the host and device memory must be allocated before the data is transferred.
Allocates the "virtual" array in device memory.
Frees the allocated device memory.
Access a specific element of the array allocated in the device memory. This function is accessible only during the execution in the device environment.
- Parameters:
-
[in] | h | height offset for the element being accessed. |
[in] | w | width offset for the element being accessed. |
[in] | d | depth offset for the element being accessed. |
- Returns:
- the reference of the element specified via parameters.
Get the depth size of the "virtual" array.
- Returns:
- the "virtual" depth of the array data structure.
Get the height size of the "virtual" array.
- Returns:
- the "virtual" height of the array data structure.
Get the width size of the "virtual" array.
- Returns:
- the "virtual" width of the array data structure.
Allocates the array in host (main) memory.
template<typename T >
template<typename Arrays >
Creates a clone, in the host (main) memory, of the array given as argument. The clone is a copy of the array in a different memory space.
- Parameters:
-
[in] | array | original array that will be cloned. |
Frees the allocated host (main) memory.
Access a specific element of the array allocated in the host memory. This function is accessible only during the execution in the host environment.
- Parameters:
-
[in] | h | height offset for the element being accessed. |
[in] | w | width offset for the element being accessed. |
[in] | d | depth offset for the element being accessed. |
- Returns:
- the reference of the element specified via parameters.
template<typename T >
template<typename Arrays >
Copies the data, in the host (main) memory, from the array given as argument.
- Parameters:
-
[in] | array | original array that will be copied. |
template<typename T >
template<typename Arrays >
void PSkel::ArrayBase< T >::hostSlice |
( |
Arrays |
array, |
|
|
size_t |
widthOffset, |
|
|
size_t |
heightOffset, |
|
|
size_t |
depthOffset, |
|
|
size_t |
width, |
|
|
size_t |
height, |
|
|
size_t |
depth |
|
) |
| |
Creates a sliced reference, in the host (main) memory, of the array given as argument. The slice points to the same memory space as the sliced array.
- Parameters:
-
[in] | array | original array that will be sliced. |
[in] | widthOffset | the width offset for the sliced region, relative to the array given as argument. |
[in] | heightOffset | the height offset for the sliced region, relative to the array given as argument. |
[in] | depthOffset | the depth offset for the sliced region, relative to the array given as argument. |
[in] | width | the width of the slice. |
[in] | height | the height of the slice. |
[in] | depth | the depth of the slice. |
Get the size, in bytes, of the allocated memory for the "virtual" array.
- Returns:
- the total of bytes allocated in memory for the "virtual" array.
Verifies if there is memory allocated for the array data structure. This function can be called both from device and host environment, and the respective memory space is verified.
- Returns:
- true if there is a valid memory spaced allocated for the array; false otherwise.
Get the size of the real allocated array, i.e. the number of elements
- Returns:
- the size of the real allocated array.
Get the size of the "virtual" array, i.e. the number of elements
- Returns:
- the size of the "virtual" array.
The documentation for this class was generated from the following files: