Skip to content
Snippets Groups Projects
Commit 04bd2ed7 authored by Maria Kotsifakou's avatar Maria Kotsifakou
Browse files

Fix in computeMaxGradient kernel of pipeline

parent 924bf794
No related branches found
No related tags found
No related merge requests found
......@@ -541,24 +541,21 @@ void computeMaxGradientLeaf(float *G, size_t bytesG,
int dimx = __visc__getNumNodeInstances_x(thisNode);
gid = lx + 2*px*dimx;
if (gid == 0)
*maxG = 0;
for (unsigned stride = blockDim.x; stride > 32; stride >>= 1) {
if ((gid + stride < m*n) && (threadIdx.x < stride))
for (unsigned stride = dimx; stride > 32; stride >>= 1) {
if ((gid + stride < m*n) && (lx < stride))
if (G[gid + stride] > G[gid])
G[gid] = G[gid + stride];
__syncthreads();
__visc__barrier();
}
for (unsigned stride = 32; stride >= 1; stride >>= 1) {
if ((gid + stride < m*n) && (threadIdx.x < stride))
if ((gid + stride < m*n) && (lx < stride))
if (G[gid + stride] > G[gid])
G[gid] = G[gid + stride];
}
if (threadIdx.x == 0)
if (lx == 0)
__visc__atomic_max(maxG,G[gid]);
__visc__return(m);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment