Hi Mark

I have written a test case that consistently demonstrates this problem.

Using this program:

>cat ForkTest.cpp

#include <stdio.h>
#include <stdlib.h>

main (int argc, char **argv) {
    int i, j, k;
    printf ("Start test\n");

    system("ls -al");

    for (i=0 ; i<1000 ; i++) {
        if ((i % 100) == 0) {
            printf ("Doing loop %d\n", i);
        }
            for (j=0 ; j<1000000 ; j++) {
            k = j * i;
        }
    }
        printf ("End test\n");
}

I compile it with:

gcc -g -o ./FortTest. ./FortTest.cpp

I then run HPCToolkit and pfmon on it with the commands:

hpcrun -e CPU_OP_CYCLES_ALL:32767 -o ./hpcrun.data -- ./FortTest >./hpcrun
2>./hpcrun.debug
hpcprof --debug 5 ./FortTest ./hpcrun.data/* >./hpcprof 2>./hpcprof.debug
pfmon --debug --follow-fork -v -e CPU_OP_CYCLES_ALL ./FortTest >pfmon
2>pfmon.debug

The hpcrun data files created are:

-rw-r--r--  1 hpctk users 1666 May 13 16:06
bash.CPU_OP_CYCLES_ALL.molson.19755.0x4d2b
-rw-r--r--  1 hpctk users 1164 May 13 16:06
ForkTest.CPU_OP_CYCLES_ALL.molson.19754.0x4d2a
-rw-r--r--  1 hpctk users 2200 May 13 16:06
ls.CPU_OP_CYCLES_ALL.molson.19755.0x4d2b

The results in the file ./hpcprof show :

Columns correspond to the following events [event:period (events/sample)]
  CPU_OP_CYCLES_ALL:32767 - CPU Operating Cycles -- All CPU cycles counted
(35 samples)
  CPU_OP_CYCLES_ALL:32767 - CPU Operating Cycles -- All CPU cycles counted
(0 samples)
  CPU_OP_CYCLES_ALL:32767 - CPU Operating Cycles -- All CPU cycles counted
(38 samples)
  CPU_OP_CYCLES_ALL (min):32767 - CPU Operating Cycles -- All CPU cycles
counted (The minimum for events of this type.) (0 samples) [not shown]
  CPU_OP_CYCLES_ALL (max):32767 - CPU Operating Cycles -- All CPU cycles
counted (The maximum for events of this type.) (63 samples) [not shown]
  CPU_OP_CYCLES_ALL (sum):32767 - CPU Operating Cycles -- All CPU cycles
counted (Summed over all events of this type.) (73 samples) [not shown]

The multiplication of samples times period (73 * 32767) give me:

2,391,991 Cpu cycles used

But the results in the file ./pfmon show:

26,045,577,230 CPU_OP_CYCLES_ALL

The test actually runs about 20 seconds on my system which makes the number
reported by pfmon appear to be accurate.


If I comment out the line (to rerun the test without the fork):
    system("ls -al");

Then recompile and rerun the test:

The only hpcrun data file created is:

-rw-r--r--  1 hpctk users 1392 May 13 16:09
ForkTest.CPU_OP_CYCLES_ALL.molson.19814.0x4d66

The results in the file ./hpcprof show :

Columns correspond to the following events [event:period (events/sample)]
  CPU_OP_CYCLES_ALL:32767 - CPU Operating Cycles -- All CPU cycles counted
(795988 samples)

Which represents:

26,082,138,796 Cpu cycles used

The pfmon results for this test run reports:

26,045,163,278 CPU_OP_CYCLES_ALL

It is clear from these test results that hpcrun does not work correctly for
this type of executable and the problem is now easily reproducable.

I do not know if the workaround you have considered is the best way to fix
this or if the PAPI fix is a better way to go.  But if you guys can point
me
in the right direction and give me an idea what needs to be changed, I am
willing to try and implement the fix.  I just want to come up with a
correction
that someone with the authority to commit changes to the CVS/SVN would be
willing to put into a future release.

Thanks for your time,

Gary


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
perfmon2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to