I'm using OpenMP with Linux terminal. I compile my program with the flag -fopenmp. The environment I'm using does support multithreading.
#pragma omp parallel num_threads(3)
{
#pragma omp task
R11Inverted = compute_inverse(r11, half);
#pragma omp task
printf("5 I am thread # %d\n", omp_get_thread_num());
R22Inverted = compute_inverse(r22, half);
}
As a simple and minimum test, all I want to do is get printf("5 I am thread # %d\n", omp_get_thread_num()); to show that the program is running with three threads. Basically omp_get_thread_num() should return values either 0, 1, or 2.
The Output The block of code above is called many times repeatedly. However the results every time is showing that threading is not working and the program is only using a single thread (Thread 0).