Changes between Version 1 and Version 2 of Debugging/LowLevelProfiling/PAPI


Ignore:
Timestamp:
Nov 3, 2009 11:42:55 AM (6 years ago)
Author:
simonmar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Debugging/LowLevelProfiling/PAPI

    v1 v2  
    77Nowadays it might be better to use the [wiki:Debugging/LowLevelProfiling/PerfEvents Performance Events] infrastructure in Linux 2.6.31 and later. 
    88 
    9 What follows are some notes I made when I last got PAPI working on Linux. 
     9For some notes on installing PAPI on Linux, see [wiki:Debugging/LowLevelProfiling/PAPI/Installing]. 
    1010 
    11 == Installing PAPI == 
    1211 
    13  * Grab PAPI and the most recent perfctr 2.6.x 
    14  * Unpack both under `~/tmp` 
    15  
    16 === On Ubuntu === 
    17  
    18 Get the bits needed to build a kernel: 
    19  
    20  * `sudo apt-get install linux-kernel-devel fakeroot kernel-wedge kernel-package` 
    21  * `sudo apt-get build-dep linux-source` 
    22  * `sudo apt-get install linux-source` 
    23  * This seems to get a slightly out-of-date version, but maybe that's ok 
    24  
    25 Unpack and patch the kernel: 
    26  
    27  * `cd ~/tmp` 
    28  * {{{tar xvjf /usr/src/linux-source-*}}} 
    29  * `cd linux-source*` 
    30  * Read `$perfctr/INSTALL` 
    31  * `$perfctr/update-kernel` Might fail because it can't find the right patch, in which case: 
    32  * `$perfctr/update-kernel --patch=2.6.22` (tell it which patch) 
    33  * `make menuconfig` 
    34  * Turn on `perfctr`-related stuff under "Processor type and features", "Performance-monitoring counters support". 
    35    You need both "virtual" and "global" support turned on. 
    36  
    37 Build the kernel: 
    38  
    39  * {{{make-kpkg --rootcmd fakeroot --initrd --append-to-version=-perfctr kernel-image kernel-headers}}} 
    40  * wait a while 
    41  
    42 Install the kernel: 
    43  
    44  * `cd ..` 
    45  * `dpkg -i linux-image-*.deb` 
    46  * `dpkg -i linux-headers-*.deb` 
    47  * Copy contents of `lib/firmware/$old_kernel` to `/lib/firmware/$new_kernel` (not sure if this is right, but so 
    48    far the wireless adaptor still seems fine under the new kernel, so I guess it worked) 
    49  * `cd $perfctr` 
    50  * {{{cp etc/perfctr.rules /etc/udev/rules.d/99-perfctr.rules}}} 
    51  * Boot the new kernel 
    52  * I seemed to have `perfctr` built as a module, probably selected that in menuconfig by mistake, so anyway: 
    53  * `sudo modprobe perfctr` 
    54  * {{{cat /proc/misc | grep perfctr}}} should now show perfctr, and you should have `/dev/perfctr`. 
    55  
    56 Build the perfctr library: 
    57  
    58  * `cd $perfctr` 
    59  * `make PREFIX=$HOME/local` 
    60  * `make PREFIX=$HOME/local install` 
    61  
    62 Now to build PAPI: 
    63  
    64  * `cd $papi` 
    65  * The configure script had some trouble detecting the C compiler for me, I had to edit the configure script and re-autoconf it.   Change 
    66 {{{ 
    67 if test "$OS" != "linux"; then 
    68   ... 
    69 else 
    70   AC_PROG_CC 
    71   AC_PROG_F77 
    72 fi 
    73 }}} 
    74 to 
    75 {{{ 
    76 AC_PROG_CC 
    77 AC_PROG_F77 
    78 }}} 
    79  
    80  * `autoconf`   
    81  * We have a choice about whether to use the `libperfctr` in the PAPI distribution, or the one that comes with `perfctr`.  The 
    82    latter is probably more correct, but the former also worked for me. 
    83  * `./configure --with-perfctr-prefix=$HOME/local` --prefix=$HOME/local 
    84  * `make` 
    85  * `./run-tests.sh` (I got about 4 failures on Core 2) 
    86  * `make install` 
    87  
    88 Now it's all built, with header files in `$HOME/local/include`, libraries in `$HOME/local/lib`.