I'm trying to familiarize myself with using gcov to analyze an OpenMP
program. I've written a simple/trivial program to create 4 threads,
print the number of threads and return.
*****************************************************
#include "omp.h"
#include "stdio.h"
int main() {
#pragma omp parallel num_threads(4)
printf("Threads: %d\n", omp_get_num_threads());
return 0;
}
******************************************************
When I run "gcc-fprofile-arcs-fopenmp-ftest-coverage test2.c &&
./a.out && gcov test2.c&& grep[56]: test2.c.gcov" to see how many
times lines are executed I find that gcov reports |#pragma| line is run
between 3 and 5 times and the |printf| line is run
one less time than the |#pragma|. However, "Threads: 4" is always
printed 4 times.
If this is a bug I'll gladly report it. If not, can you explain why this
is happening so I can understand the results of more complicated programs?
Thank you.
--
David Berg
--
--Dave