Hi,

I have a code in C and I want to monitor the behaviour of a specific
function called "producto" which has a openMP directive inside. However,
I am not sure of the right way of monitoring threads with pfmon.

The structure of the code looks like this:

#include <omp.h> 
....
#include <string.h>

void producto()
{
  ...

#pragma omp parallel for schedule(static,1) private(i,j,k,reg)    
    for(i=0;i<N;i++) { 
      for(j=0;j<col;j++) {
         reg=0.; 
        for(k=ro[i];k<ro[i+1];k++) { 
                .....
        } 
      }
    }  

}
 
double get_seconds() { ... }

void lee_mat_rcs(char *matleo) {...}

main(argc,argv) 
{ 
   ....
   producto();
   ....
}

 
Using objdump to have a look at the symbol table, I can see the
addresses of some labels:

4000000000000f40 <_start>:
...
4000000000001140 <main>:
...
4000000000001b40 <L_main_21__par_loop0>:
...
4000000000002200 <producto>:
...
40000000000023c0 <L_producto_21__par_loop1>:
...
4000000000002940 <get_seconds>:
...
4000000000002a40 <lee_mat_rcs>:

It looks like the icc compiler created two parallel loops. I ran the
program with 2 threads in an Itanium2, restricting the range to the
"producto" function. According to pfmon manual, it should monitor my
program since the function starts until the program returns from it.
However, I get 0's:

pfmon -uk  --verb --follow-pthread --trigger-code-start=producto
--trigger-code-stop=producto --trigger-code-follow
-eIA64_INST_RETIRED,CPU_OP_CYCLES_ALL ./msxm_ijk_MP_COL
MATRICES/bcsstm36.rcs 25

loaded 18427 text symbols from /proc/kallsyms
loaded 13140 data symbols from /proc/kallsyms
table_size=164 effective=19 min_addr=0x4000000000000a90
loaded 19 text symbols from ELF file ./msxm_ijk_MP_COL
table_size=164 effective=15 min_addr=0x6000000000003b30
loaded 15 data symbols from ELF file ./msxm_ijk_MP_COL
1 event set(s) defined
long  sampling periods(val/mask/seed): 0/0x0/00/0x0/0
short sampling periods(val/mask/seed): 0/0x0/00/0x0/0
start code trigger @0x4000000000002200
stop  code trigger @0x4000000000002200
[PMC4(pmc4)=0x2000809 m=0 e=0 s=0 i=0 thres=0 all=0 es=0x08 plm=9
umask=0x0 pm=0 ism=0x2 oi=0] IA64_INST_RETIRED
[PMD4(pmd4)]
[PMC5(pmc5)=0x2001209 m=0 e=0 s=0 i=0 thres=0 all=0 es=0x12 plm=9
umask=0x0 pm=0 ism=0x2 oi=0] CPU_OP_CYCLES_ALL
[PMD5(pmd5)]
pmd setup for event set0:
[pmd4 set=0 ival=0x0 long_rate=0x0 short_rate=0x0 mask=0x0 seed=0
randomize=n]
[pmd5 set=0 ival=0x0 long_rate=0x0 short_rate=0x0 mask=0x0 seed=0
randomize=n]
exec-pattern=*
[15536] started task: ./msxm_ijk_MP_COL MATRICES/bcsstm36.rcs 25 
follow_exec=n follow_vfork=n follow_fork=n follow_pthread=y
[15536] monitoring ./msxm_ijk_MP_COL MATRICES/bcsstm36.rcs 25 ...
results are on terminal
[15536] installed start code breakpoint at 0x4000000000002200
[15536] monitoring not activated
measurements started at Fri Aug 29 15:31:36 2008

[15536] clone [15537]
[15536] clone [15538]
[15537] monitoring ./msxm_ijk_MP_COL MATRICES/bcsstm36.rcs 25 ...
results are on terminal
[15537] installed start code breakpoint at 0x4000000000002200
[15537] monitoring not activated
[15538] monitoring ./msxm_ijk_MP_COL MATRICES/bcsstm36.rcs 25 ...
results are on terminal
[15538] installed start code breakpoint at 0x4000000000002200
[15538] monitoring not activated
 Tiempo de ejecucion: 0.035023
[15538] task exited
                         0 IA64_INST_RETIRED ./msxm_ijk_MP_COL
(15536,15538,15536)
                         0 CPU_OP_CYCLES_ALL ./msxm_ijk_MP_COL
(15536,15538,15536)
[15538] detached
[15537] task exited
                         0 IA64_INST_RETIRED ./msxm_ijk_MP_COL
(15536,15537,15536)
                         0 CPU_OP_CYCLES_ALL ./msxm_ijk_MP_COL
(15536,15537,15536)
[15537] detached
[15536] task exited
                         0 IA64_INST_RETIRED ./msxm_ijk_MP_COL
(15536,15536,-1)
                         0 CPU_OP_CYCLES_ALL ./msxm_ijk_MP_COL
(15536,15536,-1)
[15536] detached
created tasks        : 3
maximum tasks        : 3
maximum active tasks : 3
measurements completed at Fri Aug 29 15:31:37 2008


If I try different locations in the program I can get information about
any of the threads, but never all of them, except when I monitor the
whole program. For example:

pfmon -uk  --follow-pthread --trigger-code-start=L_main_21__par_loop0
--trigger-code-stop=L_main_21__par_loop0 --trigger-code-follow
-eIA64_INST_RETIRED,CPU_OP_CYCLES_ALL ./msxm_ijk_MP_COL
MATRICES/bcsstm36.rcs 25

                  72121589 IA64_INST_RETIRED ./msxm_ijk_MP_COL
(15387,15389,15387)
                  32337838 CPU_OP_CYCLES_ALL ./msxm_ijk_MP_COL
(15387,15389,15387)
                         0 IA64_INST_RETIRED ./msxm_ijk_MP_COL
(15387,15388,15387)
                         0 CPU_OP_CYCLES_ALL ./msxm_ijk_MP_COL
(15387,15388,15387)
                  71775786 IA64_INST_RETIRED ./msxm_ijk_MP_COL
(15387,15387,-1)
                  27792650 CPU_OP_CYCLES_ALL ./msxm_ijk_MP_COL
(15387,15387,-1)

Trying some code regions between those labels or using the -irange
option does not help either. So I do not really know how I should set
pfmon to monitor both threads and the parent thread in the "producto"
function only.
Any help will be welcome.

Thanks in advance, 
Juan Ángel
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to