Is that possible to have two kind of threads?

I am quite confused with current problem–to decode a code with cuda.

Unfortunately, I have two kind of nodes that are doing different kind of things. I am thinking about having two piles of threads, one do thing A and the other do thing B.

I don’t know if that is possible or there are some other ways to do this.

Please kindly leave your reply and give me some advice.

Thanks in advance.


This can be done by combining both kernels to one via a big if. If the same tasks are grouped together, performance would be reasonable.

This works, but make sure you read up on warps and divergence. You really want blocks of 32 threads to follow the same flow control path. So if you do an ‘if’ based on the thread id, make sure you use (threadIdx.x>>5). In this case, you don’t lose performance.