== Basic build ==

1. Edit config.mk. Follow the comments there.
   Optionally you can change compiler settings in include_[GCC|ICC].mk.
   Please note that only the default flags are supported and tested.
2. make
(2.a make likwid-bench  (if you want to build and install likwid-bench)
3. make install (this is required for likwid-pin)
4. setup access to the msr device files (see end of this document)

Only the default flags set are tested. As it is not possible to test all compiler setting
variants the Intel icc compiler is only build tested. A basic
function test is done for the icc binary. The only variant fully tested is gcc with
default compiler flags. It is therefore recommended to use gcc with the default
flags. If you want to use and build the Fortran interface you can mix GCC with the
Intel Fortran Compiler. More information on this can be found in the WIKI.

*NOTICE*

All generated files are located in the [GCC|ICC] build directory.
This includes the dependency files, object files and also the
generated source files and the pas and assembly files for likwid-bench.
If you debug your likwid-bench benchmarks you can look at all 
intermediate build files and also the final assembly code.

== Known problems ==

On very old systems with old kernels (< 2.6.7) or old glibc versions likwid
is build with reduced funtionality. This includes missing support for NUMA
and pinning. 

== Additional Targets ==

make clean     -  clean the object directory
make distclean -  clean also the executables/libraries
make uninstall -  delete installed files

== Build likwid-bench ==

To build likwid-bench you have to explicitly call:

make likwid-bench

This is because likwid-bench does not compile on 32bit systems.

To enable instrumentation of likwid-bench for likwid-perfctr uncomment
#DEFINES  += -DPERFMON

in include_GCC.mk (or include_ICC.mk) and rebuild after a make distclean.


== Build msr daemon ==

To build the msr daemon do:

1. Edit config.mk and configure path in MSRDAEMON variable. 
   It is recommended to take the default in the comment.
2. cd src/msr-daemon
2. make
3. install every thing with
   make install

The executable will be in the likwid-root. With the standard  make install
target the daemon will also be installed in ${PREFIX}/bin . Don't forget to
copy the dameon if you configured a different path in MSRDAEMON.

== Setup of msr module ==

likwid-perfctr and likwid-features require the Linux msr kernel module. This module
is part of most standard distro kernels. You have to be root to do the initial setup.

1. Check if the msr module is loaded with  'lsmod | grep msr' . There should be an output.
2. It the module is not loaded load it with  'modprobe msr' . For automatic loading at startup
consult your distros documentation how to do so.
3. Adopt access rights on the msr device files for normal user. To allow everybody access you can 
use 'chmod o+rw /dev/cpu/*/msr' . This is only recommended on save single user desktop systems.

As a general access to the msr registers is not desired on security sensitive
systems you can either implement a more sophisticated access rights settings
with e.g. setgid. A common solution used on many other device files, e.g. for
audio, is to introduce a group and make a chown on the msr device files to that
group. Now if you execute likwid-perfCtr with setgid on that group the
executing user can use the tool but cannot directly write or read the msr
device files.

A secure solution is to use the msr-daemon, which encapsulates the access to the msr
device files and performs a address check for allowed registers. For more information 
how to setup and use this solution have a look at the WIKI page:

http://code.google.com/p/likwid/wiki/MSRDaemon

If you have still problems please let me know on the likwid mailing list:

http://groups.google.com/group/likwid-users





