if a different formula is needed by threadid, will this cause divergence?
i.e. will thread 0 and thread 1 and thread 2 execute concurrently ?
Does the answer differ if the switch is a function of only the thread id? that is switch( F(threadIdx.x): … }?
I understand that if the problem was formed like this would cause divergence, and the warp would stall and not do the formulas concurrently.
if ( threadIdx.x == 0) formula0();
else if ( threadIdx.x == 1) formula1()
else if ( threadIdx.x == 2) formula2();
Remember what kermit said- it ain’t easy being green. So have mercy on the cuda green/newbie.
Suppose the answer I get is that within a warp, that the switch is no better than if else if … and I have to deal with warp divergence.
I understand that divergence is what occurs within a warp, What if, using mod 32 on the threadid, can I get threads in different warps to do different formulas and will those different warps execute their different formulas concurrently.