I was doing a college work parallelizing a code in C with OpenMP and then getting a runtime image with eztrace, converting and displaying on vite.
But it's not showing the idle time on threads.
My code obviously has an idle thanks to the use of static clause
int prime_v2(int n)
{
int i;
int j;
int prime;
int total = 0;
#pragma omp parallel for schedule(static) private(j,prime) shared(total)
for (i = 2; i <= n; i++)
{
prime = 1;
for (j = 2; j < i; j++)
{
if (i % j == 0)
{
prime = 0;
break;
}
}
#pragma omp atomic
total = total + prime;
}
return total;
}
As can be seen, as i increases, increases the total number of inner loop iterations, requiring more time.
With the static division (for 4 threads for example), each thread gets a 'organized' range of iterations:
That is, the thread 3 caught iterations that require more time. But this idleness is not shown in the vite. Why?
Here how I performed, converted and exibit the vite:
eztrace -t omp ./programa
eztrace_convert -t PAJE /tmp/rafael_eztrace_log_rank_1
vite eztrace_output.trace
My problem was with the eztrace version of debian repository
I downloaded an older version and its worked fine. (some with the binary eztrace.old)