Skip to content

Commit

Permalink
Merge pull request #82 from andrew-hardin/fix/two-races
Browse files Browse the repository at this point in the history
Resolve race conditions identified by racecheck.
  • Loading branch information
fabiencastan authored Apr 20, 2020
2 parents 42bda27 + f603edf commit bf3556f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/popsift/common/excl_blk_prefix_sum.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,15 @@ class Block
*/
_mapping_writer.set( ebs, self, cell );
}
__syncthreads();

if( threadIdx.y == 0 && threadIdx.x == 31 ) {
loop_total += ibs;
}
__syncthreads();
}

// if( threadIdx.y == 0 && threadIdx.x == 31 )
if( threadIdx.y == 0 )
{
loop_total = popsift::shuffle( loop_total, 31 );
_total_writer.set( loop_total );
}
_total_writer.set( loop_total );
}
};

Expand Down
2 changes: 2 additions & 0 deletions src/popsift/s_orientation.cu
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void ori_par( const int octave,
__shared__ float sm_hist[ORI_NBINS];

for( int i = threadIdx.x; i < ORI_NBINS; i += blockDim.x ) hist[i] = 0.0f;
__syncthreads();

/* keypoint fractional geometry */
const float x = iext->xpos;
Expand Down Expand Up @@ -204,6 +205,7 @@ void ori_par( const int octave,
refined_angle[bin] = predicate ? prev + newbin : -1;
yval[bin] = predicate ? -(num*num) / (4.0f * denB) + sm_hist[prev] : -INFINITY;
}
__syncthreads();

int2 best_index = make_int2( threadIdx.x, threadIdx.x + 32 );

Expand Down

0 comments on commit bf3556f

Please sign in to comment.