I'm using openMP task structure in a simple fib code.
What I expect is when single thread encounters the two task blocks, it will generate two tasks and two threads in the team will handle each task parallelly.
While from the print out, I can see always only one thread ID.
It doesn't make sense to me only one thread to execute these tasks.

Any idea would be appreciated.


int main(int argc, char* argv[])
{
#pragma omp parallel num_threads(4)
{
#pragma omp single
{
fib(input);
}
} }

int fib(int n)
{
if (n < 2) return n;
if (n < 30) return (fib(n - 1) + fib(n - 2));
int x, y;
#pragma omp task shared(x)
{
print out thread_num here;}
x = fib(n - 1);
}
#pragma omp task shared(y)
{
print out thread_num here;}
y = fib(n - 2);}
#pragma omp taskwait
return x+y;
}