Keith C. Perry via plug on 12 Dec 2021 21:34:12 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] CPU Scaling


Walt, here's the kernel documentation link...

https://www.kernel.org/doc/html/v4.14/admin-guide/pm/cpufreq.html

As Rich said, this has been around for a long time now.  Typically you're not going to set frequencies directly and instead just change the scaling governor to "performance" if you want to max things out.


~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Keith C. Perry, MS E.E.
Managing Member, DAO Technologies LLC
(O) +1.215.525.4165 x2033
(M) +1.215.432.5167
www.daotechnologies.com


From: "Aaron Mulder via plug" <plug@lists.phillylinux.org>
To: "Philadelphia Linux User's Group Discussion List" <plug@lists.phillylinux.org>
Sent: Sunday, December 12, 2021 9:57:31 PM
Subject: Re: [PLUG] CPU Scaling

I'm not sure which Mac you have, but the single-core max CPU speed might be quite a bit higher than you're quoting, so it may not be that the desktop is 50% faster in terms of clock speed, depending on the "threadedness" of your code.  For instance, the MacBook Pro 13-Inch Core i7 2.3 GHz from 2020 has an i7-1068NG7 CPU which indeed has a base frequency of 2.3 GHz but goes up to 4.1 GHz single-core:

https://everymac.com/systems/apple/macbook_pro/specs/macbook-pro-core-i7-2.3-quad-core-13-2020-4-thunderbolt-3-ports-scissor-specs.html
https://ark.intel.com/content/www/us/en/ark/products/196593/intel-core-i71068ng7-processor-8m-cache-up-to-4-10-ghz.html

Thanks,
       Aaron

On Sun, Dec 12, 2021 at 5:42 PM Walt Mankowski via plug <plug@lists.phillylinux.org> wrote:
Hi,

As usual in December I've been working my way through the awesome Advent of Code problems. (This year we're saving Christmas by riding around in a submarine. Don't ask.)

While working on today's problem I noticed that my code ran about twice as fast on my Apple laptop than my Ubuntu desktop, despite the fact that my desktop's CPUs are over 50% faster (3.5 GHz AMD vs 2.3 GHz Intel Core i7). When I looked in /proc/cpuinfo I saw that the "cpu MHz" field was only 1400!

I did some searches online and discovered this seems to be due to something called "CPU Scaling". I've looked at /proc/cpuinfo subsequently and I've also run cpufreq-info(1) and the numbers vary quite a bit. I'm guessing the system is dynamically adjusting the CPU speed based on the current system load.

I've never noticed this before so I don't know if it's been in effect for a while, or if it's something new in Ubuntu 21.10. I'm not sure yet if I want to keep it or turn it off, but I would like to know more about where it's set and how to tune it. Unfortunately most of the information I've been able to find out about it seems fairly dated and predates Ubuntu's adoption of systemd. Can anyone point me to more up to date information?

Thanks.

Walt

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug