Implemented RT instability

This commit is contained in:
André R. Brodtkorb
2018-11-07 11:06:45 +01:00
parent 0f68c7867b
commit ae668a40d3
3 changed files with 170 additions and 46 deletions

View File

@@ -102,19 +102,25 @@ inline __device__ void readBlock(float* ptr_, int pitch_,
//Read into shared memory
//Loop over all variables
for (int j=threadIdx.y; j<block_height+2*ghost_cells; j+=block_height) {
//const int l = min(by + j, ny_+2*ghost_cells-1);
const int l = min(by + j, ny_+2*ghost_cells-1);
/*
const int y = by + j;
const int y_offset = ( (int) (y < gc_pad) - (int) (y >= ny_+2*ghost_cells-gc_pad) ) * (ny_+2*ghost_cells - 2*gc_pad);
const int l = y + y_offset;
const int l = min(y + y_offset, ny_+2*ghost_cells-1);
*/
float* row = (float*) ((char*) ptr_ + pitch_*l);
for (int i=threadIdx.x; i<block_width+2*ghost_cells; i+=block_width) {
//const int k = min(bx + i, nx_+2*ghost_cells-1);
const int k = min(bx + i, nx_+2*ghost_cells-1);
/*
const int x = bx + i;
const int gc_pad = 4;
const int x_offset = ( (int) (x < gc_pad) - (int) (x >= nx_+2*ghost_cells-gc_pad) ) * (nx_+2*ghost_cells - 2*gc_pad);
const int k = x + x_offset;
const int k = min(x + x_offset, nx_+2*ghost_cells-1);
*/
shmem[j][i] = row[k];
}