f_hpminit and f_hpmterminate calls. The counters are
started and stopped inside the parallel region using
f_hpmtstart and f_hpmtstop. The first argument of both
calls has been set differently for each thread, using the OpenMP enquiry
function OMP_GET_THREAD_NUM().
program OMP_PRINT implicit none #include "f_hpm.h" integer :: myid, nthreads integer :: OMP_GET_NUM_THREADS, OMP_GET_THREAD_NUM call f_hpminit(0,"hpmfile") !$OMP PARALLEL default(none) private(myid) & !$OMP shared(nthreads) ! Determine the number of threads and their id myid = OMP_GET_THREAD_NUM() nthreads = OMP_GET_NUM_THREADS(); !$OMP BARRIER call f_hpmtstart(1+myid,"printcounter") print*,'myid = ', myid, ' nthreads ', nthreads call f_hpmtstop(1+myid) !$OMP END PARALLEL call f_hpmterminate(0) end program OMP_PRINT