4

I am new to Raspberry Pi's (as well as this stackexchange) and would like to use them to learn how to build a small cluster. (Currently using this guide: https://medium.com/@glmdev/building-a-raspberry-pi-cluster-784f0df9afbd)

I am a mathematics graduate student and so I am trying to gauge whether or not this project will actually be of use for some of my work. I would want to use a cluster for doing hundreds of millions of parallel linear algebra computations in R, Python and SageMath.

I would like to get an idea of the computational power of just one Raspberry Pi 4 Model B 2019 Quad Core 64 Bit WiFi Bluetooth (4GB). How would this compare to a cluster with something like Intel Core i3 processors, for example. Any advice and suggestions would be greatly appreciated! Thank you for your time!

Perhaps this post is relevant: Cost-effectiveness of Pi cluster

  • Hi @bark, Welcome and nice to meet you. I skimmed Parts 1, 2, and 3, and I impressed. Let me give some quick comments. (1) The project is very well presented for newbies. (2) Of course it is an advanced topic in parallel/ concurrent computing, but using Open MPI and python make it not scary at all for newbies. (3) Of course newbies need to understand that it is not at all a weekend project. If you only know blinking a LED using python, you might need one year's hobbyist time to complete the project. – tlfong01 Jan 3 at 3:17
  • (4) For sharing storage, newbies might like to first try Samba and PureFTD sharing files with Win10. All Rpi might be a bit hard for newbies to develop and troubleshoot (Yes, I am a WinPC guy and sort of linux newbie.) (5) For mass storage, I am using 1/2Gb USB SSD and found it newbie friendly than HDD, because tthey just look like USB drives. (6) The project started 2018. Rpi4B appeared 2019 and a couple of things got greatly improved, including USB3, 1Gb Ethernet, both of which help making the cluster a couple of time more powerful and faster. (7) Python MPI is of course good, ... – tlfong01 Jan 3 at 3:22
  • Pyhon 3.7x already it self has mutl-processing (more newbie friendly than old style multi-threading). Of course python is ideal for google style concurrent processing, including TensorFlow which almost always uses python as examples. (8) We need to know this is kind of educational/learning project. We need to appreciate that we are not make use of GPU, and USB3, though so much faster, is still a severe communication bottleneck, limiting performance of parallel processing. (9) I have been reading similar Rpi based cluster projects these years, for learning, I would give 5 marks out of 5. – tlfong01 Jan 3 at 3:33
  • Just thinking aloud, sorry for the typos. I have 4 Rpi4B 1/2 Gb, and have been playing with python 3.7 multiprocessing, 1/2TB USB SSD, Win10/Rpi3B+ Samba/PureFTD, etc. I also have a 4 years old PC with CORE i5, 6GB RAM, Nvidia, etc. As I said, Rpi USB3 slow communication and no GPU is the fatal weakness, Rpi x 4 can't compare with single evil Wintel PC! :) – tlfong01 Jan 3 at 3:40
  • @tlfong01 Thanks for your input! I'll definitely be using this as a learning project then and not expect to run any serious computations on it! I think I will certainly enjoy being able to play around with it and then perhaps build another cluster with perhaps some better single board computers that could have something analogous to the CORE i5 for a processor! – bark Jan 3 at 17:11
4

For a rough measurement, I generated a 2000 x 2000 matrix with random integer entries between 0 and 9, and timed computation of the determinant in SageMath (I did this twice, with similar results). On my Raspberry Pi 4B, the computation took 15 minutes, compared to just over 3 minutes on my 10-year-old desktop with a quad-core i7-860 processor. The least expensive new i3 processor that I found on Newegg is the quad-core i3-9100F for $90, and according to the benchmarks here, that i3 has more than twice the computing power of my old i7. So I estimate it would take around ten Pi 4's to match a single i3 processor in terms of computing power.

As a side note: my Pi 4 has 4 GB memory, and the CPU has been the bottleneck in all of the Sage computations I have tried, by a large margin (memory usage rarely goes above 10%). For your cluster, you might get better bang for your buck using more 1 or 2 GB models, compared to fewer 4 GB models.

2

As Julian mentioned, a Pi based solution won't win any calculation benchmark records. That isn't what they are intended for; however, if you are looking simply as a learning testbed then it is an inexpensive way to play with symmetric and asymmetric cluster type computing and algorithms/etc. I use a blend of Pi3s, Pi4s, and AMD64 arch machines operating together as a Kubernetes cluster (k3os) for the very purpose of working with/testing blended architecture operations and parallel computing. The intent is not to be "a fast supercomputer" (I use GPGPU for heavy calc work) but in my case to look at mesh algorithms where I specifically need slower for easier observation.

I personally use MPI with Python across a blended pi3/pi4/amd64 cluster (k3os using MPICH deployments). Where a Pi cluster "works" is for small, inexpensive incremental gains or for inexpensive R&D.

-1

Hi @bark given you're a math graduate you might like to know that you have a full version of Mathematica 12.0 included as part of Raspbian. Mathematica has a built in benchmarking capability, which may meet your requirements. Mathematica supports parallel computing out of the box, and given the Pi's limited resource I've had more success creating a Mathematica cluster using them than with my collection of Mac Pros. So you might like to investigate creating your own Mathematica cluster.

Unlike Python, R etc Mathematica is capable of compiling functions down to native machine code via C. That may also help top optimise your linear algebra code, but I strongly suspect Mathematica's support is already highly optimised so that may not be necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.