Skip to content

Commit

Permalink
Fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashwin Sekar committed May 11, 2017
1 parent 20e3ae5 commit ce56f93
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/kernels/optimize.cu
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ __device__ void calcProjection(dev_patch_state* states,

}

__syncthreads();

}


Expand Down Expand Up @@ -117,6 +119,7 @@ __global__ void kernelInterpolateAndComputeErr(
calcProjection(states, patchX, patchY, tempX, tempY, raw, patch_size,
out_thresh, lb, ubw, ubh);
}
__syncthreads();


// Interpolate the patch
Expand Down Expand Up @@ -158,6 +161,8 @@ __global__ void kernelInterpolateAndComputeErr(

}

__syncthreads();

// Compute mean
__shared__ float mean;

Expand All @@ -181,6 +186,8 @@ __global__ void kernelInterpolateAndComputeErr(
cost[i] = raw[i] * raw[i];
}

__syncthreads();

if (tid == 0) {
float c = 0.0;
for (int i = 0; i < patch_size * patch_size * 3; i++) {
Expand Down Expand Up @@ -216,6 +223,8 @@ __global__ void kernelInterpolateAndComputeErr(

notFirst = true;

__syncthreads();

}

}
Expand Down

0 comments on commit ce56f93

Please sign in to comment.