Synchronizing with __syncthreads
Barriers that keep threads in step.
Threads Run Out of Step
Threads in a block do not march in lockstep. One may finish writing while another is still loading, so you cannot assume the data is ready yet.
Meet the Barrier
A barrier is a line in the code where every thread must wait until all of them arrive. Only then does the block move on together.
All lessons in this course
- Declaring __shared__ Arrays
- Synchronizing with __syncthreads
- Avoiding Bank Conflicts
- Dynamic Shared Memory