CUDA Beginner - A force waiting for a thread to complete before moving on

I am studying CUDA and now I have something like this.

__device__ void iterate_temperatures(int fieldSize, Atom *atoms) {

  int temperature = threadIdx.x + blockDim.x * blockIdx.x;

  nAtoms = pow(fieldSize, DIMENSION);


  iterate_atoms<<< nAtoms >>>(atoms, nAtoms, temperature);
}

The thing is, every temperature needs a final result.

How can I make each block wait for the last.

Thank!

+5
source share
1 answer

Just enter a challenge __syncthreads()to do exactly what you want.

+8
source

All Articles