suppose i have a cluster of 2 pi 4s (8 gig model and 32gb sd cards). i will get 2 seperate computers together having 4 cores and 8gb ram (based on jeff geerling's blog https://www.jeffgeerling.com/blog/2021/why-build-raspberry-pi-cluster). but will i get 64gb storage (or separated as those /dev/nvme*
), 4 hdmi ports, 2 CSI and DSI ports, and 52 GPIO pins? since i don't know, and not that great at finding out all those weird device files under the /dev
directory, i always keep on using the ports on the master node. can someone help?
1 Answer
A cluster doesn't create a single, combined entity. Special software is developed to run applications faster on a cluster, by separating out jobs to each node in the cluster. So yes, in theory, your program would have access to twice as much ram. But the job running on Pi-1 does not actually have access to the ram on Pi-2.
Clusters require a controller node, and then "worker" nodes, (the controller could be on one of the worker pi's, or a separate one)
The controller then assigns each worker a task and somehow tracks/stores the result of the task (might be used as input to a future job)
The advantages are that workers can fail, or be taken off line for maintenance, without stopping the application from running (might slow it down thought). And you are able to accomplish tasks that require more resources. But most of the time, the workers don't interact with each other, they are assigned a task by the controller, and return the results of that task. So a big use of clusters (or at least one that's easy to see the benefit) is data analysis. If you have 10 million rows of data, that contain 100 different numbers, and you need to do some calculations, but each row can be calculated separately(doest rely on any other rows), you can hand off each row to a worker that is free, let the worker do the math, and return the result to the controller to store.
The downside is that you have to have the right type of application (you cant just download minecraft( or any other application) and expect it to run on a cluster, since you are not actually creating a single computer. The application needs to be designed for a cluster, and the controller would need to know how to break apart tasks to assign to workers
Also as a side note, a pi-cluster is never going to as efficent as just buying a desktop and running the application on a single machine. HOWEVER, it is a great way to learn about clusters, and what they can and cant do. It can even be used to design/test cluster software, since the mechanics of the software would be the same on the pi as they would be on a cluster of high end linux servers.
EDIT: In regards to peripherals (USB,HDMI,GPIO) Refer to all this as "IO", you do still have access to these, but not from a single point like you are thinking. Each worker pi could access the IO on its own pi, but the controller node would not list all these devices in /dev/
In most cases, the tasks given to a worker would be such that it wont matter which worker gets assigned each task, so the use cases for external IO is low, since again, the worker only has access to its local IO. GPIO could be used to signal the workers of some event. For example GPIO-1 on all worker nodes might be connected together, so that they could all receive a start or stop signal at the same time, but again the setup has to be the same on each pi, because you want the code running on each worker to be the same.
Each Pi could have an HDMI monitor connected to it, and this might be displaying statistics about what each worker node is processing, but you would not have access to these monitors from the controller node (at least not with some very custom software)
-
so what is the basic summary? (actually the question asks whether i will get more usb, hdmi and gpio ports) Dec 3, 2021 at 3:35
-
1
-
1Yes, the workers only have access to to whats connected to thier own pi. As far as "devices" connected into the cluster it would very much depend on what the device is, and how its being used.– Chad GDec 6, 2021 at 16:17
-
1No, its not. If an ssh is needed by all nodes, then it should be mounted as a network drive. it could even be physically connected to the controller node, and then mounted as a network drive on all the nodes.– Chad GDec 6, 2021 at 17:57
-
1