ag123
Posts: 122
Joined: Sun Dec 18, 2016 7:54 am

RPi 4 heat sink - it made a difference !

Thu Apr 23, 2020 4:14 pm

i got some low cost heat sink from the likes of ebay, aliexpress etc and i did some experiments to assess what kind of difference am i looking at with a heat sink. to do that comparison i did a little code (a benchmark code derived from a matrix multiplication) and a 'driver' python codes that collects temperature data while the benchmark runs.

the benchmark simply does 1000x1000 single precision matrix multiplications, the codes isn't really optimised but is build with g++ -O3 enabled.
i'm getting 230 Mflops for single threaded runs and 514 Mflops for 4 threads concurrent computation on same sized matrices.
the rather low Mflops probably indicates further optimizations is possible. However, the main point of this test is to monitor temperature under load and the benchmark mainly generates a synthetic load.

during some of the early runs, at one point i got a reading of 78 deg C peak without heat sink (this is during the 4 concurrent threads phase of the run). But comparison is difficult as i need to gather temperature data in sync with the run to make a sensible comparison. hence, i did up the codes.

and as it turns out without heat sink my Pi 4 idles at 54 deg C, during the single thread phase of the run it goes up to about 62 deg C, but when all 4 threads concurrent runs are used for the matrix multiplication it goes up to 74 deg C.

then i fitted a 28mm x 28mm x 11mm heat sink, it adheres to the soc with some low cost heat sink compound
the run with heat sink my Pi 4 idles at 47-48 deg C, during the single thread phase of the run it stayed below 54 deg C, but when all 4 threads concurrent runs are used for the matrix multiplication it goes up to 60 deg C. that makes it about 14 deg C lower than without at peak loads.
and about 5 deg C lower at idle

i think these temperatures are still rather warm, hence to get lower temperatures, a fan blowing at the heat sink would be needed.
this experiment is done without a fan.
bench.png
benchmark with sink and no sink
bench.png (66.9 KiB) Viewed 5729 times
rpimon.png
high 78dec no sink
rpimon.png (39.02 KiB) Viewed 5729 times
Pi 4B with 28x28x11mm heat sink seating on top
pi4sink1.jpg
pi4 with heat sink mounted
pi4sink1.jpg (169.37 KiB) Viewed 5729 times
to build this

Code: Select all

c++ -pthread -O3 -o mat main.cpp
main.cpp (this benchmark code is adapted from
https://github.com/mtrebi/matrix-multip ... -threading

Code: Select all

/*

MIT License

Copyright (c) 2016 Mariano Trebino

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <iostream>
#include <random>
#include <chrono>
#include <thread>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>

static const long MATRIX_SIZE = 1000;
static const int THREADS_NUMBER = 4;
static const long N_EXECUTIONS = 10;

struct Matrix {
  float ** elements;

  void initialize_zero() {
    elements = new float*[MATRIX_SIZE];
    for (int i = 0; i < MATRIX_SIZE; ++i) {
      elements[i] = new float[MATRIX_SIZE];
      for (int j = 0; j < MATRIX_SIZE; ++j) {
        elements[i][j] = 0.0f;
      }
    }
  }

  void initialize_random() {
    std::random_device rd;
    std::mt19937 mt(rd());
    std::uniform_real_distribution<double> dist(-1e9, -1e9);
    elements = new float*[MATRIX_SIZE];
    for (int i = 0; i < MATRIX_SIZE; ++i) {
      elements[i] = new float[MATRIX_SIZE];
      for (int j = 0; j < MATRIX_SIZE; ++j) {
        elements[i][j] = dist(mt);
      }
    }
  }

  void print() {
    std::cout << std::endl;
    for (int i = 0; i < MATRIX_SIZE; ++i) {
      std::cout << "|\t";

      for (int j = 0; j < MATRIX_SIZE; ++j) {
        std::cout << elements[i][j] << "\t";
      }
      std::cout << "|" << std::endl;
    }
  }

};

void multiply(Matrix& r, const Matrix& m1, const Matrix& m2);
void single_execution(Matrix& r, long long& elapsed_time, const Matrix& m1, const Matrix& m2);
void multithreading_execution(Matrix& r, long long& elapsed_time, const Matrix& m1, const Matrix& m2);
void multiply_threading(Matrix& result, const int thread_number, const Matrix& m1, const Matrix& m2);
void benchmark_execution(void(*execution_function)(Matrix& r, long long& elapsed_time, const Matrix& m1, const Matrix& m2), int count);
long long milliseconds_now();

int main(int argc, char *argv[]) {
  if(argc == 1) {
    std::cout << "Single execution" << std::endl;
    benchmark_execution(single_execution, N_EXECUTIONS);
    std::cout << "Multi thread execution" << std::endl;
    benchmark_execution(multithreading_execution, N_EXECUTIONS);
  //sleep(10);
  } else if (argc == 2) {
    if(*argv[1] == 's') {
      std::cout << "Single execution" << std::endl;
      benchmark_execution(single_execution, N_EXECUTIONS);
    } else {
      std::cout << "Multi thread execution" << std::endl;
      benchmark_execution(multithreading_execution, N_EXECUTIONS);
    }
  } else if (argc == 3) {
    int count = atoi(argv[2]);
    if(*argv[1] == 's') {
      std::cout << "Single execution" << std::endl;
      benchmark_execution(single_execution, count);
    } else {
      std::cout << "Multi thread execution" << std::endl;
      benchmark_execution(multithreading_execution, count);
    }
    
  }
  std::cout << "End of program" << std::endl;
}

void benchmark_execution(void(*execution_function)(Matrix& r, long long& elapsed_time, const Matrix& m1, const Matrix& m2), int counts) {
  Matrix m1, m2, r;

  long long total_time = 0.0;
  for (int i = 0; i < counts; ++i) {
    long long elapsed_time = 0.0;
    m1.initialize_random();
    m2.initialize_random();
    r.initialize_zero();

    execution_function(r, elapsed_time, m1, m2);
    total_time += elapsed_time;
  }
  std::cout << "matrix size:\t" << MATRIX_SIZE << "\n";
  std::cout << "loops:\t" << counts << "\n";
  int ttime = (double) total_time / counts;
  std::cout << "\tAverage execution took\t" << ttime << " ms" << std::endl;
  int nops = MATRIX_SIZE * MATRIX_SIZE * MATRIX_SIZE +
	 MATRIX_SIZE * MATRIX_SIZE * (MATRIX_SIZE - 1);
  std::cout << "MFlops:\t" <<  nops / ttime / 1000 << "\n";
}

void multiply(Matrix& r, const Matrix& m1, const Matrix& m2) {
  for (int i = 0; i < MATRIX_SIZE; ++i) {
    for (int j = 0; j < MATRIX_SIZE; ++j) {
      float result = 0.0f;
      for (int k = 0; k < MATRIX_SIZE; ++k) {
        const float e1 = m1.elements[i][k];
        const float e2 = m2.elements[k][j];
        result += e1 * e2;
      }
      r.elements[i][j] = result;
    }
  }
}

void single_execution(Matrix& r, long long& elapsed_time, const Matrix& m1, const Matrix& m2) {
  //std::cout << "Starting single thread execution..." << std::endl;
  long long start_time = milliseconds_now();

  //std::cout << "Calculating...." << std::endl;
  multiply(r, m1, m2);

  long long end_time = milliseconds_now();
  //std::cout << "Finishing single thread execution..." << std::endl;

  elapsed_time = end_time - start_time;
}

void multiply_threading(Matrix& result, const int thread_number, const Matrix& m1, const Matrix& m2) {
  // Calculate workload
  const int n_elements = (MATRIX_SIZE * MATRIX_SIZE);
  const int n_operations = n_elements / THREADS_NUMBER;
  const int rest_operations = n_elements % THREADS_NUMBER;

  int start_op, end_op;

  if (thread_number == 0) {
    // First thread does more job
    start_op = n_operations * thread_number;
    end_op = (n_operations * (thread_number + 1)) + rest_operations;
  }
  else {
    start_op = n_operations * thread_number + rest_operations;
    end_op = (n_operations * (thread_number + 1)) + rest_operations;
  }

  for (int op = start_op; op < end_op; ++op) {
    const int row = op % MATRIX_SIZE;
    const int col = op / MATRIX_SIZE;
    float r = 0.0f;
    for (int i = 0; i < MATRIX_SIZE; ++i) {
      const float e1 = m1.elements[row][i];
      const float e2 = m2.elements[i][col];
      r += e1 * e2;
    }

    result.elements[row][col] = r;
  }
}

void multithreading_execution(Matrix& r, long long& elapsed_time, const Matrix& m1, const Matrix& m2) {
  //std::cout << "Starting multithreading execution..." << std::endl;
  long long start_time = milliseconds_now();

  std::thread threads[THREADS_NUMBER];

  for (int i = 0; i < THREADS_NUMBER; ++i) {
    //std::cout << "Starting thread " << i << std::endl;
    threads[i] = std::thread(multiply_threading, std::ref(r), i, std::ref(m1), std::ref(m2));
  }

  //std::cout << "Calculating...." << std::endl;

  for (int i = 0; i < THREADS_NUMBER; ++i) {
    //std::cout << "Joining thread " << i << std::endl;
    threads[i].join();
  }

  long long end_time = milliseconds_now();
  //std::cout << "Finishing multithreading execution..." << std::endl;

  elapsed_time = end_time - start_time;
}

long long milliseconds_now() {
  struct timespec now;
  clock_gettime(CLOCK_MONOTONIC, &now);
  return now.tv_sec * 1000 + now.tv_nsec / 1000000;
}
bench.py python 'driver' code to monior temperature and run the benchmark
note that this code doesn't do the graphs, it saves the time (seconds elapsed and soc temperature to the file with the variable logfile "bench-nosink.log", you would need to find a separate utility to graph it

Code: Select all

#!/usr/bin/python3.6
from threading import Thread
from threading import Event
import threading
import time
import signal
import sys
import subprocess
import pickle

#logfile = ""

logfile = "bench-nosink.log"
lf = open(logfile, 'w+')

msg = list()

def signal_handler(sig, frame):
    print('You pressed Ctrl+C!')
    stopFlag.set()
    sys.exit(0)

class MyThread(Thread):
    def __init__(self, event):
        Thread.__init__(self)
        self.stopped = event

    def run(self):
        while not self.stopped.wait(1.0):
            sample()


beg = time.perf_counter()

def sample():
    ms = int((time.perf_counter() - beg) * 1000)
    with open("/sys/class/thermal/thermal_zone0/temp") as f:
        temp = f.read().strip();
    
    m = list() 
    if (len(msg) > 0):
        m = [ ms, temp]
        for l in msg:
           m.append(l)
        msg.clear()
    else:
        m = [ms, temp]
    if not logfile == "":
      for i in range(0, len(m)):
        lf.write(str(m[i]))
        if i < len(m) - 1:
          lf.write('\t')
      lf.write("\n")
    print(m)

def bench(cmd):
    msg.append("starting")
    for c in cmd:
      msg.append(c)
    with subprocess.Popen(cmd, stdout=subprocess.PIPE) as p:
        msg.append(p.stdout.read().decode("utf-8").split('\n'))

if __name__ == '__main__':    
    stopFlag = Event()
    signal.signal(signal.SIGINT, signal_handler)
    print('Press Ctrl+C')
    thread = MyThread(stopFlag)
    thread.start()
    #signal.pause()
    cmd = ["./mat", 's', '10']
    bt = threading.Thread(target=bench(cmd), daemon=True)
    bt.start()
    bt.join()

    cmd = ["./mat", 'm', '25']
    bt = threading.Thread(target=bench(cmd), daemon=True)
    bt.start()
    bt.join()
    
    time.sleep(300)
    # this will stop the timer
    stopFlag.set()

epoch1970
Posts: 8055
Joined: Thu May 05, 2016 9:33 am
Location: France

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 8:54 am

I don't believe anybody says a heat sink doesn't make a difference to the CPU temperature.

Many will say a heat sink doesn't make a practical difference in computer throughput.
Your benchmark itself didn't manage to push the CPU for long enough in the 80°C area where thermal throttling kicks-in, which does have an effect on performance.

Adding a heat sink is also a great way of creating electrical shorts or otherwise ruining a perfectly good machine, if you're not careful. For one, the physical proximity of the CPU die to the GPIO connector is not ideal.

The computer does not mind at all running with its CPU at 80°C all day. Or more. It is designed and tested to handle that. If a heatsink was a requirement, the machine would come with one.

If your Pi spends its day compiling or computing stuff then you can consider adding passive or even active cooling and see some benefit of that.
Otherwise it is simply not worth the money and the risk.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
jahboater
Posts: 8258
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 9:00 am

Its best to align the heat sink fins with the airflow.

Here is another, rather more effective 8.2K/W, stick-on heat sink from RS:-
https://uk.rs-online.com/web/p/heatsinks/7500951/
40x40x18mm, black colour, with an effective thermal tape.

or this 2.5K/W:
https://uk.rs-online.com/web/p/heatsinks/6744835/

I would monitor the throttling with "vcgencmd get_throttled" and if it always returns zero (0x0) during your typical workload, then no extra cooling is required at all. (Note, it might throttle due to inadequate power supply too).

User avatar
bensimmo
Posts: 5706
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 9:23 am

a large heatsink let's it run cooler for longer until it cannot get rid of the heat, it has sunk all the heat it can.
at which point you need a fan like you say.

but at that point, dump the heatsink and just blow the fan over it. works well.

User avatar
Imperf3kt
Posts: 4675
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 9:24 am

Rotate your heatsink 90 degrees, and stand the Pi upright and watch the temperature drop a few more degrees by simply adjusting its orientation.
55:55:44:44:4C
52:4C:52:42:41

Rose tinted glasses are difficult to see through.

User avatar
jahboater
Posts: 8258
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 9:38 am

bensimmo wrote:
Fri Apr 24, 2020 9:23 am
a large heatsink let's it run cooler for longer until it cannot get rid of the heat, it has sunk all the heat it can.
Two entirely different concepts:

1) thermal inertia (a large heavy heat sink will take more time to warm up)

2) rate of heat loss. How many watts it can dissipate. This is proportional to the temperature (convection) or the fourth power of the temperature (radiation). So as the temperature rises the rate of heat loss increases until equilibrium is reached. Obviously a larger heatsink with bigger fins can dissipate more heat.

Some CPU's exploit thermal inertia to automatically apply a massive overclock for a short period while the heat sink warms up.
Last edited by jahboater on Fri Apr 24, 2020 9:43 am, edited 1 time in total.

User avatar
bensimmo
Posts: 5706
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 9:43 am

I know. But if you start to need a fan, like mentioned, just ignore the heatsink.

if you can get enough convection from your heatsink, with cool enough air, that's quieter. but that's not the case here it seems.

and we're talking Pi4 here, they can sit full load with a fan blowing and no heatsink, at full speed.

User avatar
jahboater
Posts: 8258
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 10:09 am

bensimmo wrote:
Fri Apr 24, 2020 9:43 am
and we're talking Pi4 here, they can sit full load with a fan blowing and no heatsink, at full speed.
Yes. One of my Pi4's sits at full load with no fan and no heat sink and still doesn't throttle - so this discussion is moot :)

Ignoring radiation, chips lose heat by warming the surrounding air. Warm air rises and so moves away to be replaced by cold air which is then heated and so on. A fan moves the warm air away much more effectively.
The heat sink with its much increased surface area and raised fins warms a lot more air. This benefits both forced air cooling (fan) and natural convection.

Until I saw your posts I have never heard of any proper installation with a fan but no heat sink! Take any Intel PC apart for example.

cpc464
Posts: 238
Joined: Tue Jul 08, 2014 5:10 pm

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 10:13 am

Hi ag123

This is great. I want my Pi4 to run cooler but don't want a fan. Passive cooling by 5C when idle / 10C when pushed is definitely worth having. Where did you get the heat sink ?

Jim.
Unix engineer since 1989

fruitoftheloom
Posts: 27225
Joined: Tue Mar 25, 2014 12:40 pm

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 10:48 am

cpc464 wrote:
Fri Apr 24, 2020 10:13 am
Hi ag123

This is great. I want my Pi4 to run cooler but don't want a fan. Passive cooling by 5C when idle / 10C when pushed is definitely worth having. Where did you get the heat sink ?

Jim.

Stand the Raspberry Pi on its side without a case help a lot:

https://www.raspberrypi.org/blog/free-r ... -magpi-90/

https://www.seeedstudio.com/blog/2019/1 ... than-ever/
Take what I advise as advice not the utopian holy grail, and it is gratis !!

richrussell
Posts: 184
Joined: Thu Jan 16, 2020 10:52 am

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 11:51 am

jahboater wrote:
Fri Apr 24, 2020 10:09 am
Until I saw your posts I have never heard of any proper installation with a fan but no heat sink! Take any Intel PC apart for example.
We never needed heatinks on Intel 8086, 286, 386 and 486 until we got to about 100MHz, we just had the fan in the PSU or case. In fact I don't think a heatsink was a requirement on the first Pentiums (although it certainly was on the P90), but it's been a while since I built one of them!

So not quite _any_ Intel PC, just those from the last 25 years or so. :)

ag123
Posts: 122
Joined: Sun Dec 18, 2016 7:54 am

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 12:46 pm

cpc464 wrote:
Fri Apr 24, 2020 10:13 am
Hi ag123

This is great. I want my Pi4 to run cooler but don't want a fan. Passive cooling by 5C when idle / 10C when pushed is definitely worth having. Where did you get the heat sink ?

Jim.
i got mine from aliexpress, i got a bunch of 28x28x11mm ones, there are also 40mm ones around
https://www.aliexpress.com/wholesale?ca ... eatsink+28
i'd think they are similarly available on ebay (and maybe amazon)
i went for 28mm as i thought that 40mm won't fit, but i think one of the members here responded that 40x40mm would after all fit and probably leave very little room for things around it, possibly running into them

get those with all the fins horizontal and cut across into grids and get a moderately tall one (i settled for 11mm). the more segmented fins there are the greater is the area and hence it removes heat more efficiently.. For the height i think there are some kind of trade off. tall fins may give more area but degrades air flow. but somewhat taller ones may work better

the heat sink compound is also one of the cheap ones,
https://www.aliexpress.com/wholesale?ca ... mal+grease
https://www.aliexpress.com/wholesale?ca ... k+compound

for now i'm making do without a fan as well. there is no casing and left in open air hence it would depend on ambient air and convention to remove the heat
temperatures are hovering near 50 deg C idle and moderate loads for a couple of minutes brings it to around 60 deg C
without a fan i think high loads for extensive time may be a problem, but for the occasional high loads it would likely look like the graph i presented in the first post.

ag123
Posts: 122
Joined: Sun Dec 18, 2016 7:54 am

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 12:57 pm

hi all, thanks for the responses and suggestions as well

cpc464
Posts: 238
Joined: Tue Jul 08, 2014 5:10 pm

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 1:02 pm

fruitoftheloom wrote:
Fri Apr 24, 2020 10:48 am

Stand the Raspberry Pi on its side without a case help a lot:

https://www.raspberrypi.org/blog/free-r ... -magpi-90/

https://www.seeedstudio.com/blog/2019/1 ... than-ever/

Yes I know about these. What I liked about ag123's post, and what some of the respondents don't seem able to appreciate, is that he has done the hard bit - getting measured temperature results - and given us the benefit. A nice bit of engineering IMO.

ag123 if you are reading - can you post the link where this heatsink came from. Are you able to test any competing heat sinks? UPDATE sorry just seen your reply.

Cheers,
Jim
Unix engineer since 1989

User avatar
jahboater
Posts: 8258
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 1:20 pm

40x40mm heat sinks fit perfectly on the Pi4 by the way, but no bigger.

Here are some measurements with this one with the Pi mounted vertically in free air and the heat sink fins aligned vertically (stock speeds):-
https://uk.rs-online.com/web/p/heatsinks/7500951/

Its a warm day here in the UK.
The idle temp is around 36/37C.

You can see the test runs where the CPU frequency scales up to the full 1.5GHz
The first run is a 72,000 line C compilation with full optimization (one core).
The second run is cpuburn-a53 which is an unrealistic pathological stress test (NEON on four cores).

Code: Select all

Time       Temp     CPU     Core         Health           Vcore
14:14:14  36.0'C   600MHz  200MHz  00000000000000000000  0.8350V
14:14:24  37.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:14:34  38.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:14:44  39.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:14:54  39.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:15:04  40.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:15:14  39.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:15:24  36.0'C   750MHz  250MHz  00000000000000000000  0.8500V
14:15:35  37.0'C   600MHz  200MHz  00000000000000000000  0.8350V
14:15:45  37.0'C   600MHz  200MHz  00000000000000000000  0.8350V
14:15:55  36.0'C   600MHz  200MHz  00000000000000000000  0.8350V
14:16:05  37.0'C   600MHz  200MHz  00000000000000000000  0.8350V
14:16:15  36.0'C   600MHz  200MHz  00000000000000000000  0.8350V
14:16:25  42.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:16:35  45.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
Time       Temp     CPU     Core         Health           Vcore
14:16:46  45.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:16:56  45.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:17:06  45.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:17:17  45.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:17:27  47.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:17:37  47.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:17:47  48.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:17:58  48.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:18:08  48.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:18:18  47.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:18:29  47.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:18:39  49.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:18:49  49.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:18:59  48.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
14:19:10  49.0'C  1500MHz  500MHz  00000000000000000000  0.8500V
With the latest firmware, the Pi4 is very cool running IMHO. The biggish C compile barely raises the temperature!

cpc464
Posts: 238
Joined: Tue Jul 08, 2014 5:10 pm

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 2:52 pm

Hi jahboater, can you show the same test results but running without the heat sink?
Unix engineer since 1989

User avatar
jahboater
Posts: 8258
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: RPi 4 heat sink - it made a difference !

Fri Apr 24, 2020 3:39 pm

cpc464 wrote:
Fri Apr 24, 2020 2:52 pm
Hi jahboater, can you show the same test results but running without the heat sink?
Not quite the same, but I have another Pi4 here with no heat sink but it has a Unicorn Hat HD mounted on it restricting much of the convection airflow and the board is not mounted vertically.
As you can see it runs a lot hotter, but not worryingly so.
The silly stress test in the second run might eventually cause throttling but the normal heavy workload will not come close.

Code: Select all

Time       Temp     CPU     Core         Health           Vcore
16:30:10  44.0'C   600MHz  200MHz  00000000000000000000  0.8350V
16:30:20  45.0'C   600MHz  200MHz  00000000000000000000  0.8350V
16:30:30  49.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:30:40  51.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:30:50  52.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:31:00  52.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:31:10  53.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:31:21  50.0'C   600MHz  200MHz  00000000000000000000  0.8350V
16:31:31  47.0'C   750MHz  250MHz  00000000000000000000  0.8813V
16:31:41  48.0'C   600MHz  200MHz  00000000000000000000  0.8350V
16:31:51  47.0'C   600MHz  200MHz  00000000000000000000  0.8350V
16:32:01  47.0'C   750MHz  250MHz  00000000000000000000  0.8813V
16:32:11  46.0'C   600MHz  200MHz  00000000000000000000  0.8350V
16:32:21  59.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:32:32  63.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
Time       Temp     CPU     Core         Health           Vcore
16:32:42  66.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:32:52  66.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:33:02  68.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:33:12  69.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:33:23  71.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:33:33  71.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:33:43  72.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:33:54  73.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:34:04  73.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:34:14  74.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:34:24  74.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:34:34  75.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:34:45  76.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:34:55  77.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
16:35:05  75.0'C  1500MHz  500MHz  00000000000000000000  0.8813V
Note the cpuburn stress program would crash a Pi3 in the early days in a few seconds! The Pi4 on the other hand copes easily, probably due to the die shrink.

ag123
Posts: 122
Joined: Sun Dec 18, 2016 7:54 am

Re: RPi 4 heat sink - it made a difference !

Sat Apr 25, 2020 5:21 am

just an update

i ran rosetta@home
viewtopic.php?f=63&t=272072

temperatures goes up to as much as 72 deg C with heat sink on
next i take a fan and blow at the low cost heat sink, temperatures goes down to 44 deg C while running full load 4 threads (cpu load average 4.0 ) !
rpimon-run.png
temp while running rosetta@home
rpimon-run.png (23.92 KiB) Viewed 5238 times
with the fan on, it idles at a mere 32.5 deg C
rpimon-fan.png
temp idle fan on
rpimon-fan.png (31.87 KiB) Viewed 5201 times

cpc464
Posts: 238
Joined: Tue Jul 08, 2014 5:10 pm

Re: RPi 4 heat sink - it made a difference !

Sat Apr 25, 2020 9:49 am

72C with the heatsink on (and no fan)? Well, considering that is full load, its pretty acceptable. Certainly well short of the throttling zone.

Some metal heatsink "cases" are advertised as giving "10C to 15C heat reduction under full load". However, ag123 achieved 10C merely with a large heat sink. I'd also be slightly wary of short circuits with something like this:
https://shop.pimoroni.com/products/alum ... 0673211475

How are you charting the data BTW?


...quite an interesting comparison of thermal cases here. As usual though, the article is a bit lazy. They haven't taken rigorous temperature measurements with each product, just a thermal image. The chart at the very end is interesting however:
https://magpi.raspberrypi.org/articles/ ... and-ranked

Jim
Unix engineer since 1989

ag123
Posts: 122
Joined: Sun Dec 18, 2016 7:54 am

Re: RPi 4 heat sink - it made a difference !

Sat Apr 25, 2020 12:25 pm

the initial part of my tests is just a 1000x1000 matrix multiplication, running many loops of it. i'm using that as a synthetic load,
with and without heat sink, that is the graph you see in the first post. the part that rises initially is single core and the part that rises more towards the peak is quad core concurrent matrix multiplication. for that part the codes are also presented in the 1st post. the python codes simply logs the time, temperature to a file, you would need to use a utility (e.g. a spreadsheet) to plot that data. that graph is done in python, matplotlib. But as it needs to be done as 2 separate runs, hence 2 log files with the time, temperature data anyway, it may perhaps be more convenient to work the data say in a spreadsheet.

the next part which is a real load is rosetta@home
https://boinc.bakerlab.org/
viewtopic.php?f=63&t=272072

for this part there is no comparisons other than the graphs presented 2 posts above.
the part without fan is the climb from around 40 deg C to 72 deg C running rosetta@home 4 concurrent threads all 4 cores engaged, pretty much using all the memory as well. the moment i setup a fan and blow at it, temperature drops pretty significantly to 44 deg C. it actually goes as low as 40 deg C on all 4 threads 2nd graph. the moment the rosetta@home loads stop running it drops to 32.5 deg C ! that's the idle temperature with the 28x28x11 mm heat sink + fan. ambient is about 28 deg C

i kind of need to make a case to mount a proper fan, for now these are all strapped together with loose parts and just about managed to make the fan to blow at it. the heat sink is kind of 'movable' as the thermal grease merely adheres it lightly to the soc, but it sits quite well on flat surface e.g. like in the 1st post. The graphs 2 post above while rosetta@home is running is from rpi-monitor
https://rpi-experiences.blogspot.com/p/rpi-monitor.html

and for those who want to show off their cooling prowess, there is the Raspberry Pi 4 ICE Tower CPU Cooling sink fan lol :D
https://www.cnx-software.com/2019/07/25 ... oling-fan/

cooling really isn't a 'performance' issue, more than it is a Rpi fad and fashion, just as with all the fans of PC overclocking + sink fan cooling, and it is great to have temperature numbers for comparisons, all that 'benchmarks' sites which used to focus on intel, amd cpus and pcs are now zooming into Rpi as part of it, it is good to join the big leagues lol :D

cpc464
Posts: 238
Joined: Tue Jul 08, 2014 5:10 pm

Re: RPi 4 heat sink - it made a difference !

Sat Apr 25, 2020 3:07 pm

Cooling is kind of a performance issue, if it pushes the Pi into throttleback at any time. It places a lower limit on realizable performance. Some people need that performance.

For me it is also a safety issue. I run a number of live web services on a Pi 2 cluster, which is active 24x7. It runs at 42C. If it was 70C instead, I would not be so happy to leave it unattended. The fire brigade might agree. You might call me a nervous Nellie, or say other devices are almost as hot, eg. my central heating boiler, but it isn't quite the same.

Last year I tested the Pi 4 as a NAS, with some great results. It reached 74C during file copies, idling at 69 (ambient temp 23C). No case, no heatsink, board flat.
Unix engineer since 1989

ag123
Posts: 122
Joined: Sun Dec 18, 2016 7:54 am

Re: RPi 4 heat sink - it made a difference !

Sat Apr 25, 2020 3:28 pm

@cpc464, yup agree with your views.
as for my case, as i intend to run loads like Rosetta@home, these can run for hours on the soc running at full loads.
so my thoughts are that while the soc may be able to take the high temperatures for short periods of time, it is uncertain if keeping temperatures high for hours while running full loads all 4 cores could have a detrimental effect on the soc.
hence, i still think there are merits of more aggressive cooling.

Apparently, to get truly significant cooling, it would be necessary to remove all that heat with airflow (i.e. fan blowing at it). And the results shows up with the runs with the fans. Bringing temperatures down from 72 C to 40-44 C running full loads is quite significant. This can in addition open opportunities to overclock the soc, that would then really give performance gains.

i'd guess it is a similar reason both Intel and AMD sells their more 'premium' processors as allowing 'overclocking'. On their own even overclocking is probably infeasible, but that if significant means is done to remove the heat, it then become possible to run the soc at higher frequencies than the rated frequencies

User avatar
jahboater
Posts: 8258
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: RPi 4 heat sink - it made a difference !

Sat Apr 25, 2020 3:33 pm

ag123 wrote:
Sat Apr 25, 2020 3:28 pm
i'd guess it is a similar reason both Intel and AMD sells their more 'premium' processors as allowing 'overclocking'.
Overclocking Intel K series CPU's does not even void the warranty. I believe that this is because the power and temperature management is so sophisticated and safe that overclocking or poor cooling cannot possibly damage the chip.

In the extreme, the Pi4 will lower the voltage and throttle back to 600MHz.

ag123
Posts: 122
Joined: Sun Dec 18, 2016 7:54 am

Re: RPi 4 heat sink - it made a difference !

Sat Apr 25, 2020 3:43 pm

i didn't have a 'K' series cpu unfortunately, but more frequently than not in the various 'benchmark' sites like tom's hardware, anandtech etc in their published 'benchmarks', i more often see power consumed higher and sometimes much higher than the rated TDP of the processors. i'm seeing figures like 100 - 150 watts, that's an incredible amount of heat in that small space if one were to compare that to the old incandescent bulbs.

to get those 'extreme' overclock prowess these days, i'm seeing more 'enthusiasts' resort to using elaborate water cooling and such, as it seemed even a fan cooled solution may not be adequate to remove all that heat while overclocking

ag123
Posts: 122
Joined: Sun Dec 18, 2016 7:54 am

Re: RPi 4 heat sink - it made a difference !

Sat Apr 25, 2020 6:44 pm

next thing tried, overclock to 1.750 ghz overvoltage 2
/boot/config.txt

Code: Select all

over_voltage=2
arm_freq=1750
temperature seemed modestly higher 45 - 47 deg C, heat sink + fan blowing,
have a good heat sink + fan blowing when meddling with overclocks, there seem to be a risk if the fan fail or heat sink dislodge, it may have some bad consequences. this is probably beyond specs and probably will need both the heat sink and a good fan to keep it at this operating point. this would probably benefit cases where data is in the onchip cache, if it needs to hit ram, the pipeline probably stall to fetch the data
4 threads all cores running load average 4.2
CPU frequency: 1750MHz Voltage: 0.9125V
Scaling governor: ondemand
rpimon-oc.png
rosetta@home overclocked 1.75ghz
rpimon-oc.png (25.85 KiB) Viewed 5018 times
Last edited by ag123 on Sat Apr 25, 2020 7:28 pm, edited 1 time in total.

Return to “Advanced users”