Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
4995 Discussions

VTune shows variable frequency while cpupower/cpu-freq not

RN1
New Contributor I
587 Views

I have an openmp "hello world" program. I have set "performance" governor with cpupower (old cpu-freq) to every core (because I have intel_pstate module).

While I run VTune, I execute:

sudo cpupower --cpu all frequency-info | grep 'CPU freq'

to check the frequencies. I get always this:

current CPU frequency: 2.70 GHz (asserted by call to hardware)
current CPU frequency: 2.70 GHz (asserted by call to hardware)
current CPU frequency: 2.70 GHz (asserted by call to hardware)
current CPU frequency: 2.70 GHz (asserted by call to hardware)

And when it finishes:

current CPU frequency: 2.35 GHz (asserted by call to hardware)
current CPU frequency: 2.79 GHz (asserted by call to hardware)
current CPU frequency: 2.76 GHz (asserted by call to hardware)
current CPU frequency: 2.66 GHz (asserted by call to hardware)

But then, VTune shows variable frequencies (attached image). Why?

 

 

0 Kudos
2 Replies
McCalpinJohn
Honored Contributor III
587 Views

The underlying issue is that Intel processors are free to ignore frequency requests when cores are idle.   If all the cores are busy, cpupower's measured frequency should be correct, but if a core is not busy, running cpupower --frequency-info can return any value between the "maximum efficiency frequency" and the maximum allowed frequency.

This is one of the reasons why Intel discourages attempts to determine the instantaneous frequency, and instead recommends using performance counters (or the APERF/MPERF MSRs) to compute the average frequency over longer time periods.

VTune is reporting the average frequency for each core over short intervals using the performance counters.  These values will go up and down depending on the processor utilization and the frequency governor settings.  I seem to recall reading that cpupower frequency-info measures the frequency over a short interval, but if the core was idle at the beginning of the interval, you will get a lower number than you may have expected -- the interval is not long enough to "ramp up" the CPU frequency to the target value.

To test this stuff, I have a simple infinite loop code that increments a counter forever and prints out the performance counters (including the computed average frequency) every 10 billion increments.  I use "taskset" to pin this to a specific core and then verify that the average frequency while the processor is busy matches the frequency that I requested with cpupower frequency-set or whatever other tool I am working with.
 

0 Kudos
RN1
New Contributor I
587 Views

Thank you very much.

0 Kudos
Reply