freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Profiling POOMA: How to?


From: Gabriel Dos Reis
Subject: Profiling POOMA: How to?
Date: 17 Aug 2001 02:47:41 +0200

                     Profiling POOMA (with gprof)
                       compiled with KCC or GCC

   This is a short note to let you get started with profiling POOMA
compiled with KCC or GCC using gprof as a profiler.  That proceeds in
three steps: 

    (i) Setting architecture dependent compiler options
   (ii) Compiling the POOMA library, benchmarks and running them
  (iii) Producing profiling information.

Note that both the library and the program being tested have to be
compiled with profiling on, or else you won't have profiling
information about the parts not compiled with profiling on.  Normally
setting correctly options in the configuration file once should be
OK. 

I) Setting architecture dependent compiler options

  To specify profiling options, you need to modify the architecture
configuration file to be used to build POOMA. 

If you're using KCC then you have to modify config/arch/<plateform>KCC.conf
so as to set both KCC specific options and the back-end C compiler
options to include the appropriate profiling option -- when using
gprof, that option is usually '-pg'. On my machine (a Linux box) I
have the following  

   ### debug or optimized build settings for C++ applications

   $cppdbg_app  = "+K0 -g -pg";
   $cppopt_app  = "+K3 -O -DNOPAssert -DNOCTAssert -pg";
   $cppopt_app .= " --inline_keyword_space_time=10000";

   # ....

   ### debug or optimized build settings for C applications

   $cdbg_app = "-g -pg";
   $copt_app = "-O3 -pg -funroll-loops -fstrict-aliasing";

According to KCC documentation, the following plateforms understand
'-pg': 

          Linux on Intel x86
          Solaris/SPARC
          Compaq Tru64 Unix
          HP-UX

If you're using a profiling tool other than gprof you can instruct KCC
about that profiler with the following syntax

      --backend <profiler-options>

If you're using GCC, then naturally the profiler option for gprof is
spelled '-pg' when using both g++ and gcc :-)  

[ At this point I suspect it would be much flexible to specify the
  target specific profiling option at configure level instead of
  modifying config/arch/<suite>.conf ]



II) Compiling the POOMA library, benchmarks and running them

   These steps are as usual, e.g.

  ./configure --arch LINUXKCC --suite LINUXKCC --opt
              # [ configure blah blah ]
  export POMMASUITE=LINUXKCC && make -j 3
              # [ make blah blah ]
  cd benchmarks/SimpleArray && make -j 3
              # [ make blah blah ]
  cd LINUXKCC && ./atest --run-impls 2
              # [ benchmark blah blah ]


Note that when you run the benchmark (or the program you're
profiling), it will produce, as a side effect, a file named 'gmon.out'
in your *working directory* (well actually the last directory the
running program was working in).  That file will be created if and
only if the program terminates normally, i.e. if it aborts then you
won't have any profiling information.  The file 'gmon.out' contains
the information needed by gprof in the next step.

III) Producing profiling information.

  To produce the actual profiling information, you have to invoke
gprof and the program being profiled as its argument.  Since gprof
writes directly on the standard output, you might want to use a
redirection :

   gprof atest > atest-pooma.prof


The profile output has essentially three parts

    1) Flat profile
    2) Call graph (most inteersting when trying to improve efficiency)
    3) The index of the functions.

The output of gprof is pretty much well documented and self-contained.
You might want to read the man page for specific options.  If your
system is a Linux box, I would recommand 

     info gprog

as the info page is much more documented than the man page.


A caveat
========

   Since KCC does unexpected transformations with your C++ program when
heavily optimizing, trying to profile on basic-block basis won't work.
However you can profile on line-by-line basis or basic-block basis
with g++ since that compiler does not any unexpected rewriting.


I hope this will be useful. If you have further questions, please
don't hesitate to ask, I'll try to answer them (within my competence). 

-- Gaby
CodeSourcery, LLC                       http://www.codesourcery.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]