Is it possible to control the CPU core clocks on macOS?

I would like to have any direct control of CPU core clocks. Is this possible on new MacBooks and macOS ?

I use Intel Power Gadget and Macs Fan Control tools for monitoring the CPU and fans speeds on MacBook Pro 2018 with i9.

Underclocking in Mathematica

While running some specific calculations in Mathematica it happens that the CPU gets underclocked from 2.9G to 2.3G in serial and even to 1.5G during parallel computations. This might be Mathematica related, but so far I see no reason for underclocking so heavily. At the start of computation the Turbo Boost is acting, the clock speed is higher and then after about a minute it abruptly reduces, simultaneously after the CPU temperature touches 100C. The average temperature is probably 80C, but with Turbo Boost adjusting the clock, at some point temperature touches 100C and the CPU gets underclocked. The temperature reduces to ~60C, but until the end of computation this process never gets higher CPU nor Turbo Boost. After some more time (5-10 minutes) it will underclock for the second time, although the temperature is stable.

However, if I run another application on the side, the Intel Power Gadget can read higher core frequency (it shows just the average or the maximum, not per core/thread). Also the total core power increases, but only while this second process is running, as if the Mathematica process is forbidden to use CPU on higher clock. It's like the OS does not allow higher CPU frequency for the "dangerous" thread, although the temperature can decrease eventually to <50C.

Mathematica task is long but does not change in nature, it multiplies big matrices over and over again just with different numbers.

All of this is followed with fans running on higher than default speeds, because I increase them with the Control tool. I am absolutely sure the system could support higher CPU frequency during this, but it does not go for it. My suspicion is on OS, since CPU does not even reach to throttle and there is a clear process preference. Increasing the process' priority did not make a change.

I am not sure about what is happening here, which is the reason I give longer description of the problem. Also because there might be a different solution to it other than changing the frequency manually, especially if this is impossible to do.


There are a few variables of unknown quality and quantity.

The i9 MacBook Pros were known to provide strange behaviour due to potentially high power consumption, temperature but not performance output, throttling. Not only the machines are new, so is the OS Mojave. All this can then be amplified by a bug in the software to run. Even Mathematica is not perfect. In this case it seems that the task is single-threaded and pretty taxing for the one core that has to handle this. Internal management of the Intel chip may then take over what is not in Apple's control, given the hardware conditions and designs chosen.

While there might be some reason to hope for further updates to the MacBook Pro's firmware, the macOS Mojave's handling of this or Mathematica to squish bugs or provide workarounds, that is unsatisfying as it does not provide you to try something on your own.

Some fixes are said to have been delivered for this as of 10.3.6 supplemental update and presumably also rolled into 10.14. As it is unclear whether these are installed or not, make sure you have the latest versions of all software. Although presently these fixes are known to improve things generally and considerably, they fail to deliver improvements for exactly Mathematica.

Even if mentioning disasterous thermal design will attract downvotes, this is just another case. Case, cooling system and an i9 just are not he perfect mix.

The generally known ways to tinker with these settings –– although in no way a guaranteed fix for the current problem at hand –– are the following options:

  • Disabling TurboBoost with TurboBoost Switcher
  • Volta: Ultimate Power Control for Mac**$**
  • VoltageShift (explanation)

Background:

Apple MacBook Pro 2018: Much more performance with a few clicks
The new MacBook Pros have problems with the performance utilization of the Coffee Lake processors. We show why Apple's power management fails and how you can fix it with just a few clicks.

2018 macbook pro runs faster if you limit the cpu via software Further fueling the dumpster fire that the 2018 Macbook Pro is turning out to be, notebookcheck.net has discovered that by manually limiting power consumption you can actually get better performance.

Apparently, Apple elected to ONLY use temperature as a parameter for ramping up clock speeds, which results in the cpu not having enough time to cool down before trying to boost again. This leads to fluctuations that severely harm performance.

2018 i9 MacBook Pro throttling discussion [merged]
Reviews are finally rolling in on YouTube. Finally a review compared exporting a video on a maxed out 15” 2018 vs 2017. The 2017 finished exporting it 2 minutes faster because the i9 throttled so bad causing worse performance when compared to the maxed i7 CPU in the 2017 model.

Tested: Thermal conditions in the 2018 i9 MacBook Pro dramatically hampering performance
So, Apple can also change the fan speed thresholds to accommodate a CPU load better, by setting them to kick in sooner, and faster than it does at present. This probably won't completely eliminate the thermal situation, but it will lengthen the time it will take to get there at the cost of a louder device when under heavy load. Users can do this with Macs Fan Control, or similar utility.

We didn't expect a fix from Apple any time soon. But, at least the first steps were taken with a patch on July 24. Time will tell how much of a difference that patch makes, and how well it holds up over time.

Tests Confirm Apple's Throttling Fix Improves Performance for 2018 MacBook Pro Models [Updated]
The bug fix came in the form of a supplemental update to macOS High Sierra 10.13.6, which many new MacBook Pro owners have now installed on their machines. Multiple MacBook Pro owners and media sites have been testing the new patch, and the results appear to be largely positive -- the throttling issue has been resolved for the most part and the machines are performing better.

Unfortunately, Mathematica is the exception:

In all other published practice benchmarks with the exception of Mathematica, the results with and without patch fluctuated within the measurement accuracy range. These tests are either completed too quickly, do not require full CPU power throughout, or test the SSD speed.
MacBook Pro 2018 im Test: Auswirkungen des Throttling-Updates


I have resolved the issue of system dynamical underclocking during computations.

My code was optimised to save results of certain calculations and avoid redoing these in future. Soon after the start, this table of saved results becomes so huge that operations of search/read/write require many memory access calls. Each CPU core is fast in calculation, but slowed down by waiting for memory access.

After optimising the management of memory, the code is able to run calculations on all cores at full (multi-core) speed for several hours without any overheating and underclocking problems.