8 Node +1 Master: RaspberryPi Cluster running MPI and crunching numbers...

My quest for learning and building parallelism turned a new page. I mustered the courage to build a Raspberry Pi MPI cluster to test and code MPI. Couple of my friends at the Uiniversity of Alberta have been running MPI based code to crunch fluid dynamics problems. My goal was to build a farm of CPUs I can dedicate to do #STUFF at a very cheap price point.



  1. Has to be affordable
  2. Has to look presentable

Parts List:


  1. 9 x Raspberry Pi from www.element14.com
  2. 9 x 8GB Class 10 SD Cards (local computer store)
  3. 5V 12A, 60W PSU
  4. 18 x Female to Female jumper cables
  5. 18 x header pins
  6. 1 x PCB, 1 x 440uF capacitor, 1 x 220 & 1 x LED
  7. 16 Port 10/100 MB switch (had one available)
  8. 10 x CAT 5 patch cables




I used my 3D printer to print these frames I found on Thingiverse.



I used PLA and the finished product looked quite nice. took about 2 hours to print 4 frames. After about 5 hours I had the bottom and the top pieces printed. I also started installing Raspbian on the 9 SD cards. I used Win32DiskImager on a Windows 7 machine to create the SD cards. I started inserting the Pi(s) into the bottom pieces and then realized the biggest issue with this concept will be delivering power to the PIs. So I decided to build my own. The PIs draw about 450mA - 550mA depending on CPU load. with 9 of them I needed a PSU that can provide at least 5.5 A to be safe. I soon realized that when these PIs power on they can draw upto 700mA. So I purchased a 5V 12A switching PSU from my local store and built a simple power distribution circuit.


The dip switches can turn the PIs on or off. The main purpose of the 220uF capacitor is to smooth out the voltage probably not required. The red LED tell me that the PSU is ON and supplying power. I built 2 of these. was trying out couple different designs. The used the female jumpers to power the PIs.

2013-11-16 21.02.35.jpg

Once the PIs were powered up I SSHed into them and used "sudo raspi-config" to configure the CPU to run at 800MHz, gpu ram to 16MB and expanded the image to utilize 8GB. I could feel my goal getting close to completion with every key stroke. I wrote a little shell script to automate the MPI installation and configuration. Its not 100% automated but close enough:

apt-get update && apt-get upgrade -y
sudo apt-get install gfortran -y
mkdir mpi_install
cd mpi_install
wget http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/1.4.1p1/mpich2-1.4.1p1.tar.gz
tar xfz mpich2-1.4.1p1.tar.gz
cd mpich2-1.4.1p1
./configure && make && sudo make install
echo "Please answer the following questions to continue:"
wget https://github.com/downloads/philleonard/MPICH2-Armel-Raspberry-Pi/install.py
sudo python install.py

And that was it. My MPI cluster is ready. Since then I have run several example codes. Yes including the calculate the digits of PI.

I will post more with code examples and performance review as soon as get some more time. Till then Happy Hacking.

Source: http://asysadminsblog.blogspot.com