openmp functions have incorrect counts when using the cpu profiler. This seems to have
been a long standing issue: http://openmp.org/forum/viewtopic.php?f=3&t=1213 . Nearest
I can tell, this is because they are being improperly identified.
As an example:
$ cat temp.cpp
int main() {
#pragma omp parallel
{
int x = 0;
}
return 0;
}
$ g++ -fopenmp -g -lprofiler temp.cpp
$ CPUPROFILE=out.prof ./a.out
PROFILE: interrupts/evictions/bytes = 27/1/384
$ pprof --text a.out out.prof
Using local file a.out.
Using local file out.prof.
Removing _L_unlock_16 from all stack traces.
Total: 27 samples
27 100.0% 100.0% 27 100.0% omp_get_num_procs
0 0.0% 100.0% 27 100.0% GOMP_taskwait
0 0.0% 100.0% 27 100.0% __clone
0 0.0% 100.0% 27 100.0% start_thread
What is the expected output? What do you see instead?
I do not expect omp_get_num_procs to dominate the traces.
What version of the product are you using? On what operating system?
$ md5sum gperftools-2.0.tar.gz
13f6e8961bc6a26749783137995786b6 gperftools-2.0.tar.gz
$ uname -a
Linux ghc33.ghc.andrew.cmu.edu 2.6.32-279.22.1.el6.x86_64 #1 SMP Sun Jan 13 09:21:40
EST 2013 x86_64 x86_64 x86_64 GNU/Linux
Please provide any additional information below.
If I look at GOMP_taskwait (the functions that calls omp_get_num_procs), I see the
following output in the assembly that leads me to believe that the functions are not
getting properly identified:
$ pprof --disas=GOMP_taskwait a.out out.prof
ROUTINE ====================== GOMP_taskwait
0 27 samples (flat, cumulative) 100.0% of total
... <snip> ...
. 16 84ef: callq 9ca0 <omp_get_num_procs+0x540>
. . 84f4: nopl 0x0(%rax)
. . 84f8: mov %fs:0x10(%rbx),%r13
. . 84fd: mov %r12,%rdi
. . 8500: callq *%rbp
. . 8502: lea 0x80(%r13),%rdi
. 11 8509: callq 9b40 <omp_get_num_procs+0x3e0>
. . 850e: mov %r14,%rdi
. . 8511: callq 9ca0 <omp_get_num_procs+0x540>
... <snip> ...
Also, I have to confess that I'm compiling with -static-libstdc++, but I don't have
an easy way to avoid that at the moment and I don't believe it is related.
Originally reported on Google Code with ID 529
Reported by
awreeceon 2013-05-11 02:38:20