0
votes

I am using openmp to parallelize loops in my code in order to optimize it

I hear that openmp also shows something good or bad cache behavior
How do i see these cache interactions to arrange good cache behavior for my openmp omp pragma loop program?

2

2 Answers

1
votes

OpenMP itself cannot be used to get information about the cache usage of your program. Depending on your platform there are some tools that will give insights to the cache behavior.

On Linux systems you can use perf.

perf stat -e cache-references,cache-misses <your-exe>

outputs statistics about the cache-misses. There are a lot more events that can be used (see here for further details). Common events are collected if you simply run:

perf stat <your-exe>

Another tool that can also be used for Windows is the IntelĀ® Performance Counter Monitor. Although it only works with Intel CPUs it can collect additional information like the occupied memory bandwidth (on supported models).

However, the tools can help you to measure the cache usage of your program, but did not improve it. You have to manually optimize your code and recheck if the cache misses have been reduced.

0
votes

If you're looking to a specific kernel, you might want to consider [PAPI].1