I now have a GUI program that runs on Marvin, which takes a program developed on Marvin, deploys it on the four Pi’s that make up the oyster cluster, then uses mpirun to run it in parallel on 16 cores, with the results appearing on Marvin.
I’m just testing my Raspberry Pi cluster, to see if I have sorted out the setup properly this time. Finding the primes up to 10,000 with one core, and then sixteen cores, followed by using 16 cores to find primes up to 100,000 gave these results…
pi@oyster0:~ $ mpirun -hostfile myhostfile -np 1 python3 Programs/prime.py 10000 Find all primes up to: 10000 Nodes: 1 Time elapsed: 4.34 seconds pi@oyster0:~ $ mpirun -hostfile myhostfile -np 16 python3 Programs/prime.py 10000 Find all primes up to: 10000 Nodes: 16 Time elapsed: 0.34 seconds pi@oyster0:~ $ mpirun -hostfile myhostfile -np 16 python3 Programs/prime.py 100000 Find all primes up to: 100000 Nodes: 16 Time elapsed: 23.78 seconds
So, it is all working as it should now. Next step is to add blinkenlights on the supervising machine, Marvin, which has a UnicornHD HAT. After that, I want to get my GUI based supervisor working.
This leaves far too little time to flog stuff on eBay! I shall have to write a program to do that…
Update:
I ran it for the primes under a million, and it was disturbingly slow. I’d hope for something less than ten times as long as for a hundred thousand, but no!
pi@oyster0:~ $ mpirun -hostfile myhostfile -np 16 python3 Programs/prime.py 1000000 Find all primes up to: 1000000 Nodes: 16 Time elapsed: 2279.37 seconds
Almost ten minutes. I’m assuming things ended up swapping memory in and out, or Python doesn’t handle big integers very well. It’s not a problem, but it is one of the reasons I want blinkenlights…
For a while, I have been turning the camera on the Pi in the greenhouse on and off manually. By that I mean…
Connecting to the Pi using VNC
Opening the /var/tmp directory in the file manager
Creating a file called blind to switch the camera off, or
Deleting/renaming the blind file to switch the camera on
Disconnecting from the Pi
That’s clearly a huge faff, so I decided I’d finally make a GUI based program to do the job, using guizero. Other GUI libraries were either immensely complex or mysteriously impossible to install. I looked at a couple of example programs, and cobbled this together…