Is it possible to synchronize threads when we use control expression as FOR , I think that to do this the loop variable (index) must be shared and incrementations have to be atomic, but I’m not sure !! the same question using the IF condition. This is an example :
for(unsigned l=0; l<ddA; l++){
Jds[ty] = dkm[ty*ddA+l];
if( (tx%JL) == 0 ){
dy = tx/JL; //==> I dont know if this will work correcty or not
// tx and JL are unsigned intergers and tx = p*JL
// when p is an other unsigned integer.
for(unsigned int i=0; i<JL; i++){
Xs[ty][dy] = X[Jds[ty]*JL+dy];
}
__syncthreads();
}
__syncthreads();
}
Thanks