How to Stress Test Temperature on Raspberry Pi (Stressberry)

I am using Raspberry Pi 4 Model B Rev 1.2. OS is latest PI OS available on pi website.

cat /proc/version
Linux version 5.4.51-v7l+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1333 SMP Mon Aug 10 16:51:40 BST 2020

Hey,

I believe I may have found the source of the issues. If you take a look at the files in the original repo of the project the two commands don’t appear to exist anymore. You’ll notice that where any of the arguments such as that in the partition of the script that I’ve linked below are stated you’re able to use them in the CLI for plot. I’m not able to find --hide-legend or --line-width in the file, it may be worth adding this as an issue on their repo so they can check whether the removal was intentional, or part of an issue during a merge. Please let us know if you have any further questions!

### For Example
parser.add_argument(
    "--not-transparent",

Bryce
Core Electronics | Support

This worked fine on one of my pi 4’s but on the other I got this error below:
Traceback (most recent call last): File "/home/pi/.local/bin/stressberry-run", line 10, in <module> sys.exit(run()) File "/home/pi/.local/lib/python3.7/site-packages/stressberry/cli/run.py", line 152, in run yaml.dump( AttributeError: module 'yaml' has no attribute 'dump'

No fix found yet.

Cheers

Hey Brendan,

Interesting, can you please open the IDLE and try from yaml import dump I’m curious to see whether we get any results or an error message, we may need to reinstall the library to get it correctly recognized.

Bryce
Core Electronics | Support

This returns nothing on the ‘good’ pi i.e. success. Errors on the ‘broken’ pi.

These commands return the same result on both pi’s:
pip --version
pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)
pi@picentral:~ $ pip3 --version
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

trying to install pyyaml again on the ‘broken’ pi:
pi@picentral:~ $ sudo pip3 install pyyaml
Looking in indexes: Simple index, piwheels - Simple index
Requirement already satisfied: pyyaml in /usr/local/lib/python3.7/dist-packages (5.3.1)

Tried to uninstall:
pi@picentral:~ $ pip3 uninstall pyyaml
Can’t uninstall ‘PyYAML’. No files were found to uninstall.

What? Majority of files in these folders are 0 bytes.
/home/pi/.local/lib/python3.7/site-packages/yaml
/home/pi/.local/lib/python3.7/site-packages/PyYAML-5.3.1.dist-info

One of these commands (sudo or not?) has fixed it.
pi@picentral:~ sudo pip3 install --upgrade --no-deps --force-reinstall pyyaml Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting pyyaml Using cached https://www.piwheels.org/simple/pyyaml/PyYAML-5.3.1-cp37-cp37m-linux_armv7l.whl Installing collected packages: pyyaml Found existing installation: PyYAML 5.3.1 Uninstalling PyYAML-5.3.1: Successfully uninstalled PyYAML-5.3.1 Successfully installed pyyaml-5.3.1 pi@picentral:~ pip3 install --upgrade --no-deps --force-reinstall pyyaml
Looking in indexes: Simple index, piwheels - Simple index
Collecting pyyaml
Using cached https://www.piwheels.org/simple/pyyaml/PyYAML-5.3.1-cp37-cp37m-linux_armv7l.whl
Installing collected packages: pyyaml
Found existing installation: PyYAML 5.3.1
Can’t uninstall ‘PyYAML’. No files were found to uninstall.
Successfully installed pyyaml-5.3.1
pi@picentral:~ $

reference:
Can I force pip to reinstall the current version?

It’s working now but can’t say I’ve enjoyed my first foray into python. Linux is hard enough by itself without another layer obscuring things.

Hope my write up helps someone.

Cheers

Couple of questions.

Are you running the RPi from SD card?

Are you using different SD cards for the two RPis?

Corruption of the file system on SD cards is common and easy to do, and can result in this sort of thing. The RPi4 can be now be booted from USB stick or SSD. Much more reliable than SD card.

The --force-reinstall option SHOULD reinstall the package even if it is already installed.

Edit: I hate autocorrect.

1 Like

I wrote a little test harness script thing that I called stressthepi.sh
It datetime stamps the filenames so they don’t get overwritten.
Just run it from any directory you want the output files in eg. TemperatureTests
It opens the png image at the end.

    #!/bin/bash

    DATETIME=$(date +"%Y-%m-%dt%H%M")

    /home/pi/.local/bin/stressberry-run -n "Testrun"$DATETIME -d 600 -i 120 --cooldown 10 -c 4 $DATETIME.out

    MPLBACKEND=Agg /home/pi/.local/bin/stressberry-plot $DATETIME.out -d 300 -f -l 400 1600 -t 30 90 -o $DATETIME.png --not-transparent

    xdg-open $DATETIME.png
2 Likes

Nice, that’s a handy little script. Saved it into my collection :slight_smile:

2 Likes

I found this discussion while looking for a way to test the cooling efficiency of my new Argon ONE case on a Raspberry Pi 4 Model B Rev 1.2 4GB system.

I have clocked the system at 1750MHz so I wanted to make sure everything was under control. The graph below was the outcome. I had to rescale the axes to get the higher frequency to correctly display. Ambient room temp was 18 deg C

I have the V2 case which now has the IR receiver as well as the jumper to control the power management functionality. It also has full height HDMI ports which is a big improvement over the initial release

2 Likes

A Delta T of about 37°C - not bad!

I had:
stressberry-plot: error: unrecognized arguments: --hide-legend --line-width 2
when running the plot command, so I removed the two unsupported arguments.
I have a raspberry4 with this case: https://smile.amazon.co.uk/gp/product/B07XL17RQ4/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1

i think for the m-2 case and the core clocks there reasonable scores…i hope to get an m-2 with the large HDMI add-on board… though still think that they are pricey…as far as stress testing goes i think i hold the world record but don’t quote me on that…on my rev 1.1 4GB running Ubuntu and mate desktop. my setup was bizarre indeed…only thing i did not have was liquid nitrogen

1 Like


Hi all,
Does someone know what’s wrong with my test? as you can see the orange lines are cropped at 90©.

RPI 400

Thanks

Hi John,

How interesting, can you please show us the command you’ve used to plot that? I had a look at the arguments you can provide it and you should be able to change the upper y limit on the plot as it just uses the pyplot library.

Hi there

I have run the stressberry test following your instructions however when i try to plo the graph using the following command

MPLBACKEND=Agg /home/pi/.local/bin/stressberry-plot mytest.out -f -d 300 -f -l 400 1600 -t 30 90 -o mytest.png --hide-legend --not-transparent --line-width 2

I get the following error

RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
File “/home/pi/.local/bin/stressberry-plot”, line 10, in
sys.exit(plot())
File “/home/pi/.local/lib/python3.7/site-packages/stressberry/cli/plot.py”, line 9, in plot
import dufte
File “/home/pi/.local/lib/python3.7/site-packages/dufte/init.py”, line 1, in
from .main import legend, style
File “/home/pi/.local/lib/python3.7/site-packages/dufte/main.py”, line 3, in
import matplotlib as mpl
File “/home/pi/.local/lib/python3.7/site-packages/matplotlib/init.py”, line 107, in
from . import _api, cbook, docstring, rcsetup
File “/home/pi/.local/lib/python3.7/site-packages/matplotlib/rcsetup.py”, line 26, in
from matplotlib.colors import Colormap, is_color_like
File “/home/pi/.local/lib/python3.7/site-packages/matplotlib/colors.py”, line 82, in
from matplotlib import _api, cbook, scale
File “/home/pi/.local/lib/python3.7/site-packages/matplotlib/scale.py”, line 18, in
from matplotlib.ticker import (
File “/home/pi/.local/lib/python3.7/site-packages/matplotlib/ticker.py”, line 179, in
from matplotlib import transforms as mtransforms
File “/home/pi/.local/lib/python3.7/site-packages/matplotlib/transforms.py”, line 46, in
from matplotlib._path import (
ImportError: numpy.core.multiarray failed to import

Can you please help to advise please,

Thanks

Hi Rav,

Thanks for making a post! I’ve moved your post into the forum thread for our stressberry article, so it’ll be easier to find for others in future.

0x is a hexadecimal number. You need to update your NumPy / version of Python:
pip install numpy --upgrade

You should also run:
sudo apt update
sudo apt full-upgrade

Just to make sure everything’s up to date.

Hi Oliver

I followed your instructions, installed uodates/upgrades and installed numpy then rebooted and tried again.

pi@raspberrypi:~/TemperatureTests $ MPLBACKEND=Agg /home/pi/.local/bin/stressberry-plot mytest.out -f -d 300 -f -l 400 1600 -t 30 90 -o mytest.png --hide-legend --not-transparent --line-width 2
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
File “/home/pi/.local/bin/stressberry-plot”, line 10, in
sys.exit(plot())
File “/home/pi/.local/lib/python3.7/site-packages/stressberry/cli/plot.py”, line 9, in plot
import dufte
File “/home/pi/.local/lib/python3.7/site-packages/dufte/init.py”, line 1, in
from .main import legend, style
File “/home/pi/.local/lib/python3.7/site-packages/dufte/main.py”, line 3, in
import matplotlib as mpl
File “/home/pi/.local/lib/python3.7/site-packages/matplotlib/init.py”, line 107, in
from . import _api, cbook, docstring, rcsetup
File “/home/pi/.local/lib/python3.7/site-packages/matplotlib/rcsetup.py”, line 26, in
from matplotlib.colors import Colormap, is_color_like
File “/home/pi/.local/lib/python3.7/site-packages/matplotlib/colors.py”, line 82, in
from matplotlib import _api, cbook, scale
File “/home/pi/.local/lib/python3.7/site-packages/matplotlib/scale.py”, line 18, in
from matplotlib.ticker import (
File “/home/pi/.local/lib/python3.7/site-packages/matplotlib/ticker.py”, line 179, in
from matplotlib import transforms as mtransforms
File “/home/pi/.local/lib/python3.7/site-packages/matplotlib/transforms.py”, line 46, in
from matplotlib._path import (
ImportError: numpy.core.multiarray failed to import

Hi Graham, Thanks for this thread.
I had the exact error message as Rav, albeit months later. Spend quite a while to solve it. I had numpy version 1.6.1, that could not be updated in the Raspberry Pi 4 B. After a few hours of search found that installing version 1.21.1 solves the issue. But, could not install it by either of the following commands.

pip install --user numpy
or
sudo pip install numpy

Had to use sudo pip3 install numpy
Reference here: raspbian - How can I install numpy and pandapower? - Raspberry Pi Stack Exchange

After that I was able to run Brendan’s script to get the graphs.

I am a newbie to both Linux and Python. Got my Raspberry 4 B yesterday along with this partially open case.

Have a homegrown heatsink installed with Arctic Ceramique2 thermal compound and a 12V fan running at 7V. The following are the graphs of the stress tests of the rig with the fan and without the fan. The room temp. here is about 30 C.



Thanks again for the tips. Registered in forum to post the solution to Rav’s issue, even though it is old.

Regards
G

3 Likes

Hey G,

Welcome to the forum and good find!
I bet this will help someone down the line :smiley:

Nice temps! I’d be keen to see your heatsink

Liam.

4 Likes

Thanks for the warm welcome, Liam.
I slightly modified the heatsink setup. Instead of anchoring it to the top part of the case, just let it sit on the processor and put Kapton tape to hold the arms together to prevent going sproing and touching the GPIO headers. In the photo, the GPIO headers have a strip of Kapton tape as well to prevent any mishap shorts.

Yesterday, during the mod, spread the thermal paste a bit more and “reinstalled” the heatsink. The thermal profile with the fan did not change much, but, is better when the fan is off.

Here is a photo of the heatsink - Remember, you asked, so don’t go WTF :smile:
It is 0.127mm soft copper strip, cut to 14mm width and folded at 14mm length to fit the top of the CPU. Considering the RPi4B consumes at the max 1A at heavy load, the heat generated is not much. I have some heatsinks coming in and some blue thermal tape sheet as well. Will make comparison of the heatsinks with Ceramique2 thermal paste and then the blue tape.

Thermal performance with heatsink and fan

Thermal performance without fan - only heatsink

Regards

G

4 Likes