Multithreaded application instrumentation example
When placing instrumentation inside of parallel regions, you should use a different ID for each thread.
The following is an example multithreaded application
instrumentation:
!$OMP PARALLEL
!$OMP&PRIVATE (instID)
instID = 30+omp_get_thread_num()
call f_hpmtstart( instID, "computing meaning of life" )
!$OMP DO
do ...
do_work()
end do
call f_hpmtstop( instID )
!$OMP END PARALLEL
The library accepts the use of the same instID
for
different threads, but the counters are accumulated for all instances
with the same instID
.