Stability Testing an Overclocked Raspberry Pi
Checking RAM Reliability with Memtester after Overclocking
In the third part of the series of posts concerning Overclocking and Stability Testing the Raspberry Pi, we will use Memtester to test the Pi’s RAM.
What is Memtester?
Memtester is a memory testing tool which:
- Tests the stability of the RAM
- Natively runs on a single CPU core, but can be run on all cores using multiple remote SSH sessions, or the Screen tool
The Memtester Man page at Linux.die.net states:
memtester is an effective userspace tester for stress-testing the memory subsystem. It is very effective at finding intermittent and non-deterministic faults
Assistance for those new to Linux
Making changes to the Overclock settings on the Pi, and testing the changes for stability, requires a little knowledge of the Linux command shell. Please see my related post for a basic guide which should help those new to Linux and/or Raspbian get started: Don’t Fear The Command Line: Raspbian Linux Shell Commands and Tools – Part 1
The Memtester software package can be installed easily using the command line / shell via the Raspbian OS’s APT Package Management Tool.
The APT maintains a repository of available packages, and their dependencies (other packages which a given package requires). Before installing a new package it is good practice to first update the repository list to ensure that you obtain the latest version of whichever package you wish to install, and to avoid dependency issues.
To update the APT repository, at the command shell, type:
sudo apt-get update
To install the Memtester package, type:
sudo apt-get install memtester
Running the Memtester Script on a Single CPU Core
TO Run Memtester on a single core, at the command line specify the
memtester program, along with two parameters:
- 1. The amount of memory to test, followed by a lowercase ‘m’ – do not leave a space between the two. The program will attempt to lock the required amount of RAM, but will use the nearest available amount if this is not possible.
- 2. The number of iterations to run the test over.
For example, to run the test twice on 500 Megabytes of RAM, type:
memtester 500m 2
Running the Memtester script on all four ARM cores
The Memtester tool itself is not multi-threaded, but it is possible to execute the tool on each of the ARM’s four cores to ensure that the RAM, and CPU, is being thoroughly tested. This will generate a lot of heat in the system, which greatly increases the chances of an overclock instability being discovered.
Why is this a good idea? When running intensive software including emulators the CPU, GPU, and RAM can all be stretched to their limits, causing instabilities to be uncovered which may not have arisen when the system isn’t under constant high loads.
Two Approaches to Running Memtester on Multiple Cores
1. Using multiple sessions logged in from a remote computer
A remote shell client programme, such as PuTTY can be used to connect to the Raspberry Pi from another machine (Windows, Linux, Android, Mac, etc.)
As Linux (upon which Raspbian is built) is natively a multitasking Operating System, we can simply open a PuTTY connection four times and run Memtester in each of the remote shells (using the command provided in the above section ‘Running the Memtester Script on a Single CPU Core’). The amount of memory specified has been reduced to accommodate running four instances in parallel. The number of iterations has been increased to 4, to ensure a thorough test.
memtester 140m 4
This will run the memory test tool across all four cores of the Raspberry Pi 2 (this is not necessary with the Pi 1, which has only a single core)
2. Using the Linux Screen tool to run multiple sessions directly on the Raspberry Pi (or from a single remote session)
Using the Screen tool, a single command session can be used to spawn as many virtual shells as required. This can be done either when directly connected to the Pi, using a USB keyboard, or via a remote connection, such as PuTTY (see above).
The use of Screen will be covered in a separate post. For now, assuming you have the Screen package installed:
To launch the Screen tool issue the command:
The tool will display an information page. Press ‘Enter’ to close the page.
To Create a new virtual shell instance:
Ctrl + 'a', then
Ctrl + 'c'
Run an instance of the Memtester tool using the command specified in the above section ‘Using multiple sessions logged in from a remote computer’:
memtester 140m 4
Repeat this sequence three more times; Memtester will now be running in parallel on all four cores.
To cycle between the virtual shell instances:
To access the Next virtual shell instance:
Ctrl + 'a', then
Ctrl + 'n'
To access text Previous virtual shell instance:
Ctrl + 'a', then
Ctrl + 'p'
To exit a virtual shell instance:
At the command line for the specific instance, issue the command:
- To access the Next virtual shell instance:
Finishing the Stability Testing Process
Assuming the system proves to be stable having run through testing the RAM with Memtester, the final test covers the micro SD storage using the Stability Test Script
A Labour of Love
- Links: Raspberry Pi and Gaming Emulation via RetroPie
- Don’t Fear The Command Line: Raspbian Linux Shell Commands and Tools – Part 1: Just the Basics
- Navigating the Raspberry Pi’s File System. Raspbian Linux Shell Commands and Tools – Part 2
Overclocking and Stability Testing the Raspberry Pi
- Part 1: Overclocking
- Part 2: Stress testing the CPU with mprime
- Part 4: Stress testing the SD card storage with the Stability Test Script