My Raspberry Pi cluster, named “Oyster” because of something to do with the Walrus and the Carpenter, had been out of commission for months, so I eventually got to work and tried to set it up from scratch, as an alternative to checking everything over and over again, and failing to find anything wrong. Oyster used to look like this, but the Pi 3s in Lego compatible cases ran too hot.

At first, I attempted to use my only Pi 4, “Marvin”, as the control machine for the four Pi 3s in Oyster, but I got something wrong in the setup, and it didn’t work. I had been thinking 20 cores would obviously be better than 16, but suspected the two different user names in use might be causing the problem. It probably wasn’t, as I now think the ssh communication for the cluster is done anonymously. Possibly. Anyway, I changed my mind about 20 cores, when I thought about the other tasks Marvin runs, and how I didn’t want them slowed down. Sixteen will do. Unless I get some more Pi 3s and add them to the cluster…
Anyway, I went through all the setup described in Ashwin Pajankar’s e-book* about Raspberry Pi “supercomputers”, again. Twice. I found some online guides, and checked the setup with those, too. I could run programs on the four cores of oyster0, but not on the other three Pis. Eventually, I spotted that I had forgotten to create the file “known-hosts” on the controlling Pi. The message passing software, python3-mpi4py, would probably have told me this, if I had run it in verbose mode, but I didn’t. Still, it now works, and I have a sixteen core Pi cluster running.

I have added a program, running on Marvin, that lights up LEDs to show the state of the Pis in the cluster, and intend to add further blinkenlights to show the activity of each of the sixteen cores.
# Program to monitor status of Oyster cluster, displaying up/down indication.
#import os
import time
import subprocess as sp
machines = ["oyster0", "oyster1", "oyster2", "oyster3"]
while True:
for i in range(len(machines)):
machine = machines[i]
state = sp.call(['ping', '-c', '1', machine], stdout=sp.DEVNULL)
if state == 0:
colour = "0 200 0" # Green means UP
else:
colour = "200 0 0" # Red means DOWN
row = "12 "
if machine == "oyster0":
column = "0 "
elif machine == "oyster1":
column = "4 "
elif machine == "oyster2":
column = "8 "
elif machine == "oyster3":
column = "12 "
message = "set_pixel " + row + column + colour
fp = open("/home/chris/ftp/files/blinkenlights" + machine, 'w')
fp.write(message)
fp.close()
time.sleep(1)
This code sends a text file to my Unicorn HD server program, which enables more than one program to write to its 256 LEDs, without messing up each other’s displays.
My plans for further development include improving my set of framework code for running parallel programs on the cluster, and more (or possibly less) importantly, to send messages to Marvin for the blinkenlights.
[* I haven’t included a link to AP’s e-book, because it’s easy to find online, and he is charging far too much for it, while others are giving us the same information free.]