49 class PLArray :
public ArgumentType
55 PLArray(
int n,
int nl,
int ss,
int tw, T nv)
62 firstIndex(
Muesli::proc_id*nLocal),
65 width(2*stencil_size+tile_width),
83 ptrs.push_back(d_ptr);
84 if (it != ptrs.begin()) {
96 if (++it == ptrs.end()) {
119 T
get(
int index)
const
122 int i = blockIdx.x * blockDim.x;
123 int shared_index = index-firstIndexGPU-i+stencil_size;
124 return shared_data[shared_index];
127 if (index < 0 || index > n) {
129 return neutral_value;
131 return current_data[index - firstIndex + stencil_size];
142 void readToSharedMem(T* smem,
int index,
int tile_width)
144 int tx = threadIdx.x;
145 int i = index - firstIndex;;
148 smem[tx+stencil_size] = current_data[i+stencil_size];
153 for (
int j = 0; j < stencil_size; j++) {
154 smem[tx+j] = current_data[i+j];
159 if (tx == tile_width-1) {
160 for (
int j = 0; j < stencil_size; j++) {
161 smem[tx+j+stencil_size+1] = current_data[i+stencil_size+j+1];
178 firstIndexGPU = index;
182 std::vector<T*> ptrs;
183 typename std::vector<T*>::iterator it;
184 T* current_data, *shared_data;
185 int n, nLocal, stencil_size, firstIndex, firstIndexGPU, tile_width, width;
void update()
Updates the pointer to point to current data (that resides in one of the GPUs memory or in CPU memory...
Definition: plarray.h:94
Class Muesli contains globally available variables that determine the properties (number of running p...
Definition: muesli.h:126
void addDevicePtr(T *d_ptr)
Adds another pointer to data residing in GPU or in CPU memory, respectively.
Definition: plarray.h:81
PLArray(int n, int nl, int ss, int tw, T nv)
Constructor: creates a PLArray.
Definition: plarray.h:55
~PLArray()
Destructor.
Definition: plarray.h:73
void setFirstIndexGPU(int index)
Sets the first index for the current device.
Definition: plarray.h:176
MSL_USERFUNC int getLocalSize() const
Returns the size of the padded local array.
Definition: plarray.h:108
Base class for argument types of functors.
Definition: argtype.h:47