This note is used for installing PAPI (a well-known software tool from Univ. of Tennessee that provides APIs for accessing various hardware performance counters) on i386 architecture (Nehalem Gainestown processor) running Ubuntu 10.04 LTS (the Lucid Lynx) with Linux kernel version 2.6.32 (x32).
Índice |
For my machine, I downloaded PerfCtr 2.6.40.
First, the Linux kernel must be customized with either PerfCtr patch to enable various hardware counter accesses. So let's get the linux kernel source code and patch it.
sudo apt-get install build-essential fakeroot kernel-package
sudo apt-get install linux-source
Or alternatively, get the Linux kernel from: http://www.kernel.org.
cd ~ mkdir kdir cd kdir tar -xvjf /usr/src/linux-2.6.*.tar.bz2 cd linux-2.6.* make mrproper cp /boot/config-`uname -r` .config
~/pdir/update-kernel --test --patch=2.6.* # This does nothing but testing. If the test fails, try a different version # (--patch=<version>). All available versions can be seen in pdir/patches
~/pdir/update-kernel --patch=2.6.*
cd ~/kdir/linux-2.6.* make menuconfig
And finally we have to compile the kernel
export CONCURRENCY_LEVEL=9 fakeroot make-kpkg clean fakeroot make-kpkg --append-to-version=-perfctr --initrd binary
This will generate two deb files to install at our Debian-based systems so we can install them on our computer.
sudo dpkg -i ../linux-image*.deb sudo dpkg -i ../linux-headers*.deb
cd ~/pdir make
make PREFIX=$HOME/usr install
cd ~/pdir make
make PREFIX=$HOME/usr install
tar -xvzf papi-4.0.0.tar.gz cd papi-4.0.0
patch -p1 < ../papi400patch3.diff cd src
./configure --prefix=$HOME/usr --with-perfctr-prefix=$HOME/usr make
make test
./run_tests.sh make install
Done! It's all built now. PAPI header files are in $HOME/usr/include and PAPI libraries are in $HOME/usr/lib.