5

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

bark
  • 53
  • 4

3 Answers3

5

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.

Julian Rosen
  • 166
  • 3
3

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.

Nick
  • 774
  • 4
  • 16