0
while loop {
  if condition then compute;
  else exit();
  ...
  __syncthreads( );
}

Is there a way in Cuda C to dismiss a thread so that __syncthreads (or another appropriate function) won't be waiting for it ? Thanks.

mark4rd
  • 255
  • 5
  • 12

1 Answers1

0

As far a I know there is no way to "exit" from a thread in Cuda.

By the way, in the pseudo-code that you posted isn't really needed to exit from the kill the thread, in fact if you rewrite it as in:

while loop {
  if(condition) {
    compute;
  }
  __syncthreads();
}

should work just fine.

cjg
  • 116
  • 3
  • Thank you for the answer ! Regarding the "exit" yes you are right. The only purpose of it is to reduce the number of threads needed to be waiting at __syncthreads() (an optimization I thought). – mark4rd Mar 22 '15 at 16:55
  • @mark4rd: That wouldn't be an optimisation, it would be a serious correctness problem. – talonmies Mar 22 '15 at 17:49