Site logo

Expert CFD and Engineering Simulation Consulting

Fluid dynamics, CFD, science, HPC and industry views

Initial OpenFOAM Parallel Performance on Pi Cluster

There has been a few queries on the web about parallel scaling of OpenFOAM on Raspberry Pi’s after a good write up on the Pointwise blog following our first tweet on getting it installed. The graph below shows the scaling for up to four Pi’s on or 3D driven cavity test case. You can see linear scaling only up to 2 Pi’s. Important things to remember here are: OpenFOAM matrix solvers have different parallel performance, and the locations of partition boundaries also affects inter process communications. We’re planning a little project to look at these and other effects of parallel scaling in OpenFOAM. A small cluster of Pi’s is a great (cheap!) way to do this...

Screen Shot 2014-02-17 at 19.59.36

Raspberry Pi OpenFOAM Installation

As you can see, we’ve updated our website. We hope you like the new look. Below are the details of getting OpenFOAM up and running on Raspberry PI’s. It’s quick, fun, and educational so we thought we should keep on the site.

Hardware The hardware is as follows: 2x Raspberry Pi, 2x mains power adapters, 1x 8GB SD card borrowed from a DSLR camera, 1x 16GB SD purchased with “wheezy” Raspion OS pre-installed, 1x Netgear FS308 10/100Mbs network switch with mains adapter and a couple of cat5 cables. We also got a couple of transparent perspex cases for the PI’s - these are only for aesthetic purposes, but it is a good idea to get some type of case to give your Pi’s some protection.

OS Install For the 8GB SD card we downloaded “wheezy” Raspian OS from and installed using a simple command line process below from

>diskutil list
identify the disk (not partition) of your SD card. e.g. disk4 (not disk4s1)

>diskutil unmountDisk /dev/
e.g. diskutil unmountDisk /dev/disk4

>sudo dd bs=1m if=.img of=/dev/
e.g. sudo dd bs=1m if=2012-12-16-wheezy-raspbian.img of=/dev/disk4

This did take a while, due to buffering the image write. On a Mac its faster if you use

>sudo dd bs=1m if=.img of=/dev/<rdisk# from diskutil>
e.g. sudo dd bs=1m if=2012-12-16-wheezy-raspbian.img of=/dev/rdisk4

There’s a bunch of other GUI ways of doing the same thing.

The 16GB card came with “wheezy” pre-installed so none of the above necessary.

Start-Up & Config Both Pi’s were started by connecting to HDMi on a monitor. The Raspi-config screen greets you on boot. We changed the hostnames of the Pi’s to pi1 and pi2 and changed the passwords to the same simple text. We set the hostnames and specific IP addresses for the pi’s under the DHCP settings of the router for quick and easy remote access. Also we expanded the filesystem to occupy all of the SD card (it’s 2GB by default). At the LX terminal command line we ran

>sudo apt-get update
>sudo apt-get upgrade
>sudo apt-get dist-upgrade

to make sure the packages and wheezy distribution are up to date.

We then downloaded OpenFOAM compiled specifically for the Pi from . A quick mention for the guys at Rheologic is required here as the Pi compilation is very stable (no issues with OpenFOAM or openMPI during any of the tests here) and they are very helpful and friendly.

We installed OpenFoam in the /opt directory and updated the OpenFOAM bashrc to point here (it’s one of the standard options). We then added

source /opt/OpenFOAM/OpenFOAM-2.2.1/etc/bashrc

to the top of our /home/pi/.bashrc file. It needs to be at the top before the commands that state if not running interactively don’t do anything because when running openMPI the call to parallel pi’s is not interactive, and we need the user .bashrc to have sourced the OpenFOAM bashrc.

Before running the OpenFOAM tests, we changed the Pi’s to boot to command line only with no GUI using

>sudo raspi-config

We didn’t test it explicitly but initial OpenFOAM runs looked to be significantly slower when the PI’s were running the GUI OS. All the tests below were performed by ssh’ing into the P’s from a Mac with XQuartz running as an X11 server.
Nov 2016
Oct 2016
Aug 2014