Skip to content
systemcoding.dev
Performance

Measure memory bandwidth counters with likwid-perfctr -g MEM

Run likwid-perfctr -g MEM on LIKWID 5.4 to read memory read, write and total bandwidth for a pinned benchmark from the memory controller counters.

1 min read
Summarize in AI

This is how you measure real DRAM bandwidth instead of guessing it from a loop's runtime. LIKWID 5.4 ships a MEM performance group that programs the memory controller counters and reports bandwidth and data volume for the run. Pin the threads with -C so the numbers belong to known cores.

Shell
likwid-perfctr -C 0-3 -g MEM ./stream_triad
Text
Region: whole program (per socket)
| Memory read bandwidth [MBytes/s]  | 21874.3 |
| Memory write bandwidth [MBytes/s] |  7291.4 |
| Memory bandwidth [MBytes/s]       | 29165.7 |
| Memory data volume [GBytes]       |   58.33 |

The values above are an illustration, and yours will differ. The counters sit in the uncore, so they count the whole socket, not only your cores: the table is per socket, and other processes on that socket are included. Run the benchmark on an otherwise idle machine, and check that the MEM group exists for your CPU with likwid-perfctr -a. Read the LIKWID perfctr documentation for the group list per microarchitecture. In a virtual machine the uncore counters are usually not exposed, so the command fails instead of reporting zeros.

Taggedlinux
Share

More snippets

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.