I have a series of calls to few independent functions.
func1(arg);
func2(arg);
func3(arg);
Instead of executing them serially, I want to execute them in parallel. I am currently using
#pragma omp parallel
{
func1(arg);
func2(arg);
func3(arg)
}
Other ways I'm trying is using a switch case and then executing this in parallel to split the task to different threads like
function(arg, value)
{
switch(value)
{
case 1: // code of func1
case 2: // code of func2
case 3 :// code of func3
}
}
#pragma omp parallel for
for(j=0; j<3; j++)
function(arg, j);
My question is either of these methods is not better than a sequential calls to functions. How do I parallelize the calls to these functions.
Thanks, K