32 #include <thrust/device_vector.h>
33 #include <thrust/iterator/constant_iterator.h>
59 __shared__
volatile bool ret;
62 const uint32 grid_size = gridDim.x * gridDim.y * gridDim.z;
70 const uint32 iteration = slot / grid_size;
72 const bool is_last_block = (slot - iteration*grid_size) == (grid_size-1);
76 atomicAdd( semaphore, 1 );
83 for (
uint32 iter = 0; iter < max_iter && *(
volatile int32*)semaphore <= iteration; ++iter) {}
85 ret = (*(
volatile int32*)semaphore > iteration);
98 m_counter.resize( 2, 0 );
105 return syncblocks( thrust::raw_pointer_cast( &m_counter.front() ) );
113 thrust::fill( m_counter.begin(), m_counter.end(), 0 );