Hi,
I’m brand new to CUDA C.
I am wondering if it is possible to run separate functions in different gpu threads (for example, first would do Matrix Multiplication, second would transpose matrix, third would add up 2 arrays,etc…)
Just simple if else statements won’t work for me, so this:
[codebox]global void MagicFunct (/some args here/)
{
if (threadIdx.x == 1){ /* do matrix mult*/}
else if (threadIdx.x == 2){ /* do transpose*/ }
else if (threadIdx.x == 3){ /do addition/}
}[/codebox]
is not what I desire. Is there any way different threads could run different kernel functions? I did some googling but didn’t find an answer.
Second question is: can I call functions from a kernel function?
kinda like this way
[codebox]global void AnotherFunct (/args here/)
{
//some data
MagicFunct(/* pass args */);
}
[/codebox]
thank you for your help,
Mikhail.