Skip to content

Instantly share code, notes, and snippets.

@friedmud
Last active July 19, 2018 22:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save friedmud/2dd0e9b08cf766c16b7cd95fbc74ceeb to your computer and use it in GitHub Desktop.
thermal_test.C
#include <iostream>
#include <thread>
int main()
{
double stuff = 1.2;
int junk = 2;
for (unsigned long int i=0; i < 100000000; i++)
{
for (unsigned long int j=0; j < 100000000; j++)
{
stuff *= 1.3;
stuff += 2.2;
junk *= 2;
junk += 2;
}
}
std::cout << stuff << std::endl;
std::cout << junk << std::endl;
return 0;
}
@friedmud
Copy link
Author

Definitive thermal throttling pressure test. This is in response to benchmarking being done on 2018 MBPs.

Note that the print statements are simply there to keep the compiler from optimizing out the rest of the computation. They should really never be reached.

Compile using:

clang++ thermal_test.C -o thermal_test

Run in multiple terminals to put tons of pressure on the CPU using:

./thermal_test

@friedmud
Copy link
Author

Here are some results from my 2017 MBP with the i7-7920HQ (4 cores, 4 hyperthreads) clocked at 3.1 GHz with turbo up to 4.1 GHz. Ambient temperature is around 70F / 21C

First, on one core:

screen shot 2018-07-19 at 1 51 42 pm

Now with 4 cores (by running in 4 terminals):

screen shot 2018-07-19 at 1 55 39 pm

With 4 cores pegged... the fans are able to spin up and keep up with the thermal load... so the clock speed just sits at the max turbo it can achieve with all 4 cores going: 3.7GHz. There is no "thermal throttling" here.

But - let's try to load up the hyperthreads too... to see if we can put enough instruction pressure on the CPU to cause it to throttle. We'll do that by running 4 instances simultaneously... then, after it's up to temperature... we'll start up 4 more and see the effect...

screen shot 2018-07-19 at 1 59 05 pm

As you can see - adding the 4 extra processes (8 total) pushes the CPU just a bit beyond its limit... causing it to throttle back to about 3.55GHz. But, overall, it's still able to keep up.

Now... all we need is someone to run this on the new 2018 MPB with the i9. If I had access to one I would do it myself! But I don't have one yet (maybe soon!)

@york-xtrem
Copy link

Hi @friedmud!

Could you publish the results here when you have them?
I know you're waiting for someone with the new macbook to run it ;)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment