Raspberry Pi Planet Simulator Cluster

We've just constructed a small cluster of Raspberry Pi single board computers and set it to work simulating the climate of Planet Earth. For further details on the background to this project please see the accompanying blog article.

To do so we referred to Prof. Simon Cox's instructions on how to make a (rather larger!) "Raspberry Pi Supercomputer". One significant difference is that we found we didn't need to build the Message Passing Interface for the Pi, because it's now available off the shelf from Raspbian. Prof. Cox suggests using mpich2, so we tried that first. However the version we installed from the Rasbian repository caused the Planet Simulator (PlaSim for short) to complain about overlapping input and output buffers, so we installed OpenMPI instead. The Planet Simulator is written mostly in Fortran, so we needed to put the GNU Fortran compiler on our master Pi too, but once again we didn't need to build it ourselves. That said, here are our installation notes using a Windows laptop.

We used one 512 Mb Pi running X as our "master", plus two 256 Mb headless "slaves". Assuming the following IP addresses:

  • Master – 192.168.2.100
  • Slave 1 – 192.168.2.101
  • Slave 2 – 192.168.2.102

1. Download the latest Rasbian image from the Raspberry Pi downloads page

2. Install it on an 8 Gb SD card using v0.7 of Win32DiskImager

3. On first use ensure the secure shell is enabled and expand the filesystem to use all the SD card. At this stage ensure the X server is DISABLED. Alternatively this can be done subsequently using:

  • sudo raspi-config

4. Login as user pi, then make sure all the basics are up to date:

  • sudo apt-get update
  • sudo apt-get upgrade

5. Install OpenMPI

  • sudo apt-get install openmpi-bin openmpi-dev

6. Shutdown, then turn off the power and remove the SD card

  • sudo poweroff

7. Using win32diskimager read the SD card, then write an additional 2 SD cards for the slaves.

8. Put the SD cards in the three Pis and then apply power. On the master Pi only then…

9. Install the X11 development support, plus some standard X fonts for later use:

  • sudo apt-get install libx11-dev
  • sudo apt-get install xfonts-base

10. Enable the X server using:

  • sudo raspi-config

11. After rebooting, start LXTerminal and create a public private key-pair. For additional security specify a passphrase. For ease of use later don't!

  • ssh-keygen -t rsa
  • cat ~/.ssh/id_rsa.pub | ssh [email protected] "mkdir .ssh;cat >> .ssh/authorized_keys"
  • cat ~/.ssh/id_rsa.pub | ssh [email protected] "mkdir .ssh;cat >> .ssh/authorized_keys"

12. Install GNU Fortran and tcsh:

  • sudo apt-get install gfortran
  • sudo apt-get install tcsh

13. Use Midori to download the Planet Simulator from GitHub

14. Unpack the PlaSim source. In our case we had version 16.022, so:

  • tar -zxvf most16.022.tgz
  • cd most16.022

15. The Planet Simulator needs a little tweak to use a cluster. Skip to step 17 if you only want to experiment on a single Raspberry Pi. Download our most16.diff, then:

  • patch -o most.new most.c most16.diff
  • mv most.c most.old
  • cp most.new most.c

16. Create a suitable "machinefile" for your cluster:

  • leafpad plasim/dat/machinefile &

which should contain something along the lines of:

127.0.0.1
192.168.2.101
192.168.2.102

17. Configure everything for the Raspberry Pi environment:

  • ./configure.sh

18. Run the Model Starter and design your first climate experiment. Finish by using the "Save & Exit" option:

  • ./most.x
Starting the University of Hamburg's Planet Simulator, for a cluster of 3 Raspberry Pis

Configuring the University of Hamburg's Planet Simulator, for a cluster of 3 Raspberry Pis

Building the University of Hamburg's Planet Simulator, for a single Raspberry Pi

Building the University of Hamburg's Planet Simulator, for a single Raspberry Pi

19. Only if you are using a cluster:

20. At long last you should be able to simulate the climate of Planet Earth!

  • cd plasim/run
  • ./most_plasim_run
Running the University of Hamburg's Planet Simulator on 3 Raspberry Pis

Running the University of Hamburg's Planet Simulator on 3 Raspberry Pis

21. Experiment at your leisure! Try the following, then go back to step 18:

  • touch Expert

Comments on Raspberry Pi Planet Simulator Cluster »

July 8, 2014

maganj3m @ 5:58 pm

Hello,

Thank you very much for the tutorial. I've followed all the steps and everything is running smooth but:

– most_plasim_run asks for passphrase for key '/home/pi/.ssh/id_rsa'
– 2nd node (192.168.2.102) is idle, no most_plasim_t42 running at all, only running at master (192.168.2.100) and 1st node (192.168.2.101)

Could you help me?

Regards

July 19, 2014

Jim Jim @ 5:17 pm

Hi,

most_plasim_run asks for passphrase for key '/home/pi/.ssh/id_rsa'

See paragraph 11 above, and para 33 in Simon Cox's instructions

2nd node (192.168.2.102) is idle

Do you have 3 CPUs selected in the Model Starter?
Do you have a "192.168.2.102" line in the machinefile on the master Pi?

If your answer to both those questions is yes I'm afraid a lot more digging will be required. What does the start of most16.022/plasim/run/MOST_DIAG.001 have to say about CPUs?

[…] ???? Planet Simulator ????????????????????????? ?????? […]

October 12, 2014

Mark Kwiatkowski @ 5:07 pm

Hello,

When I try to run it I get the following error:

mpiexec was unable to launch the specified application as it could not find an executable:

Executable: most_plasim_t21_l10_p4.x
Node: 192.168.1.2

while attempting to start process rank 1.
————————————————————————–
cp: cannot stat `plasim_status': No such file or directory
mv: cannot stat `plasim_status': No such file or directory

I've followed every step.

Regards,
Mark

November 7, 2014

Jim Jim @ 12:55 pm

Hi Mark,

I have fixed one small step I left out originally. See step 12(b) above.

However I doubt that is the cause of your problem. Can you provide a more complete log? Does that IP address refer to your "master", or one of the "slaves"

April 29, 2015

Edilbert Kirk @ 12:39 pm

The number of cores must follow the rule 2^n, so the Planet Simulator can use 1,2,4,8,… cores, but not 3. If you enter an illegal number it uses the nearest legal number below, in the case of 3 it drops down to 2.

May 9, 2015

Jim Jim @ 10:20 am

Thanks very much for your input Edilbert.

In due course I suspect I'll have a few more questions, but for the moment it's just been pointed out to me via PM that the original download link in step 13 above no longer works. I note the PlaSim source is currently available from GitHub:

https://github.com/Edilbert/PLASIM

so the I've changed the link destination. However the Planet Simulator web site and forum seem to have vanished. Have they reappeared elsewhere?

May 19, 2015

Edilbert Kirk @ 6:32 am

Hi Jim,

The University of Hamburg switched to a new Content Management System. The new one doesn't allow a forum, so it had to be shut down. All other contents have to be transferred or re-designed, which will take a lot of time. So currently the github repository is the only source from our side.

Best wishes,

Edilbert

February 6, 2016

Mark Kwiatkowski @ 1:01 pm

Hi Jim,

IP address refers to one of the "slaves".

Regards,
Mark

Leave a Comment

Fields marked by an asterisk (*) are required.

Subscribe without commenting