-
Notifications
You must be signed in to change notification settings - Fork 267
TutorialLikwidPerf
Since LIKWID 4.3 it is possible to use Linux kernel's perf_event interface to measure the events and still benefit from the features of LIKWID (Performance groups, derived metrics and the MarkerAPI).
To configure LIKWID, set ACCESSMODE=perf_event before compiling. Afterwards,
just do a make && make install. No root permissions required for installation
if the install destination is writable or the user.
Currently, perf_event does not support thermal readings, thus this does not work with the perf_event backend. There might also be some other drawbacks when access to a MSR is required (likwid-features, likwid-setFrequencies, ...)
When running LIKWID with perf_event, you can limit the measurements to some PID.
Commonly, likwid-perfctr is used as a wrapper for the real application. If you
want to limit the counting to the application, you can use the --execpid option.
If you want to measure some other application (not wrapped by likwid-perfctr),
you can use the --perfpid <PID> option.
With --perfflags <FLAGS> you can specific additional flags handed over to the
perf_event backend (see flags field for perf_event_open syscall).
LIKWID does more than reading just the performance counter registers. There are other registers that contain useful information like the CPU turbo frequency limits, the state of prefetchers, Uncore frequency (Intel only), ...
Here is a list of features that don't work:
- No thermal readings (likwid-perfctr, counter TMP0 always returns 0)
- No event/counter options except
KERNELoption (likwid-perfctr, fixed in https://github.com/RRZE-HPC/likwid/commit/21249995f4c7abb0d026ee199180f5896a8aab79 and https://github.com/RRZE-HPC/likwid/commit/793339176eed8d6627b08fc158d61abac7d982e0) - No reading and writing of CPU prefetcher settings (no likwid-features)
- No reading and writing of CPU and Uncore frequencies (no likwid-setFrequencies)
- No CPU turbo frequency limits (likwid-powermeter -i)
- No reading of the performance energy bias (likwid-powermeter -i)
LIKWID specifies counter names so you can address in which counter the event should
be measured. Perf_event doesn't allow to specify the counter as it schedules the
events more freely and decides itself where to count the event (at least I havn't found a way).
Although you cannot specify more counters that are available on your system as
LIKWID limits it, perf_event might schedule them differently as you think, e.g.
the instructions event of perf_event does not always use the fixed-purpose counter
that counts only instructions but uses a general-purpose counter for that. If you
have specified additional events that have to use the general-purpose counters,
perf_event might multiplex the events on the general-purpose counters (commonly no
problem but in rare cases the counts might be off a little).
The great commandline tool for perf_event is perf. It provides a set of pre-
defined events but it is also possible to add raw events. If you want to measure
a specific event known by LIKWID, you can use the event data to add it as a raw
event to perf.
When running likwid-perfctr -e or likwid-perfctr -E <searchstr> you get a
list like this:
UOPS_RETIRED_ALL, 0xC2, 0x1, PMC
UOPS_RETIRED_CORE_ALL, 0xC2, 0x1, PMC
UOPS_RETIRED_RETIRE_SLOTS, 0xC2, 0x2, PMC
The first is the event name, followed by the event identifier and the umask. The final entry in a line defines the counter (group) that can be used for the event.
For events in the PMC group, you can use r<umask><eventid> as input to perf,
so if we want to add UOPS_RETIRED_ALL, it looks like this:
perf -e r01C2 a.out
You can probably add event options as well but you have to get the bit index from
sysfs. The data resides in /sys/devices/cpu/format/. LIKWID option names and
perf option names are not similar, but not difficult:
-
EDGEDETECT->edge -
THRESHOLD->cmask -
INVERT->invert -
ANYTHREAD->any
I didn't find any documentation how to add Uncore raw events.
-
Applications
-
Config files
-
Daemons
-
Architectures
-
AMD
-
Intel
- Intel Atom
- Intel Pentium M
- Intel Core2
- Intel Nehalem
- Intel NehalemEX
- Intel Westmere
- Intel WestmereEX
- Intel Xeon Phi (KNC)
- Intel Silvermont & Airmont
- Intel Goldmont
- Intel SandyBridge
- Intel SandyBridge EP/EN
- Intel IvyBridge
- Intel IvyBridge EP/EN/EX
- Intel Haswell
- Intel Haswell EP/EN/EX
- Intel Broadwell
- Intel Broadwell D
- Intel Broadwell EP
- Intel Skylake
- Intel Coffeelake
- Intel Kabylake
- Intel Xeon Phi (KNL)
- Intel Skylake X
- Intel Cascadelake SP/AP
- Intel Tigerlake
- Intel Icelake
- Intel Icelake X
- Intel SappireRapids
- Intel EmeraldRapids
- Intel GraniteRapids
- Intel SierraForrest
-
ARM
-
POWER
-
Tutorials
-
Miscellaneous
-
Contributing