8 months ago

ClusterHAT review: Raspberry Pi cluster computer kit

Make a cluster computer with a Raspberry Pi and four Pi Zeros

ClusterHAT is an ingenious solution to the problem of building a cluster computing. Learning distributed computing is something of a challenge, and this small hardware kit is the answer.

Our ClusterHAT review looks at how to build a cluster computer using a Raspberry Pi and four Pi Zero boards.

This article is by Lucy Hattersley and appears in The MagPi – The Official Raspberry Pi magazine issue 55. Click here to download your free copy.

Building a computer cluster is one of the most impressive Raspberry Pi projects. And being able to program cluster computers is one of the most highly valued skills in the world of big data.

A cluster is a set of computers networked together and used as a single system. Each computer (or ‘node’) is scheduled to work on the same task, controlled by a master computer.

Knowing how to manage, and use, clustered computers and supercomputers is a pretty valuable skill. It’s also one of the areas at the absolute forefront of computing technology.

But it has always been difficult to get started. Traditionally, cluster computing has been an expensive hobby. You need lots of computers (preferably identical) and a network controller and the skill to network them all together. This difficulty is before you even start learning how to manage several computers working in tandem.

On top of all that, it can be expensive to run multiple full-sized computers. Energy costs quickly ramp up when you’re running a cluster.

Setting up a Raspberry Pi ClusterHAT

The Cluster HAT removes the expense and effort required to create a cluster. This lower barrier to entry makes it a lot easier to get on with the more important act of learning cluster computing technologies.

The HAT sits on top of a Raspberry Pi 2/3 and you slot four Pi Zero computers on to the HAT (via the USB connection).

Get a free Pi Zero W when you subscribe to The MagPi for 12 months

A USB cable is run from the Raspberry Pi to the HAT to provide power to the four Pi Zero boards. The latter are controlled directly via the GPIO pins.

You need a microSD card for each Pi Zero, and one for the controlling Raspberry Pi. So that’s five SD cards in total.

We costed up a Raspberry Pi, Cluster HAT, four Pi Zero boards, and four official microSD cards – it comes to £102. That’s by far the cheapest cluster computer you will find on the market. For those looking to get into cluster computing, this is a game-changer.

Getting started with ClusterHAT

ClusterHAT setup

Setting up the Cluster HAT hardware was an absolute breeze. Screw the four pins on to a Raspberry Pi 3 board and insert the supplied USB cable, then attach the HAT (wiring the cable between the board and HAT). Attach the USB power to the HAT and then slot on the four Pi Zero boards. The whole setup took less than five minutes.

Software is well handled too. A dedicated site provides image files for the controller (the Pi 2/3) and one image file for each Pi Zero board.

The Cluster HAT version of Raspbian boots into the command line, but offers a script for controlling the cluster. For example:

This command-line code switches on all four Pi Zero boards. You can also control them separately, using p1-4. Such as:

It takes a few moments for each Pi Zero to power up and load its software, at which point it’ll appear in ifconfig.

Access each node using SSH (enabled by default):

Here you can use ifconfig to find the IP address Cluster HAT has assigned to the Pi Zero (under USB Ethernet).

Benchmark tests of ClusterHAT cluster computer

ClusterHAT speed test and benchmarks

One thing this isn’t, though, is a supercomputer. There’s a good set of benchmarks by Nick Smith on Climbers.net.

Nick used iperf to test the network-over-USB connection and found it comparable to Ethernet.

The slower speed of the Pi Zero boards compared to Raspberry Pi 2/3 boards is much more pronounced.

Nick benchmarked the system using HPC Challenge Benchmark. He found the cluster of four Pi Zero boards ran at roughly half the speed of a single Raspberry Pi 3 board.

The slower speed makes sense when you think about it. Nick explains: “This is partly down to the faster individual cores in the Pi 3, but also the node-node communication is obviously a great deal faster within the Pi 3 SoC compared to communicating between separate Zeros with Ethernet-over-USB.”

So you’re not building a faster Raspberry Pi. However, we don’t think this matters. The aim for most people will be to build a low-cost and relatively easy‑to‑assemble cluster for educational purposes.

Once created, you can start to experiment with the concepts behind cluster computing. The Cluster HAT is ideal for teaching, learning or developing cluster computing ideas.

We suspect it will also appeal to developers who have access to larger cluster computing systems, but not all the time. You can test and run code on the Cluster HAT, then migrate it across to a larger system.

Getting started with distributed computing

ClusterHAT cluster computing

Cluster computing is not a game for beginners. Realistically speaking, prospective learners will need a working knowledge of Python, Java, SQL (and relational database techniques). You’ll also need a good understanding of the Linux command line.

Fortunately, starters are not alone. There’s a vibrant ClusterHAT Google Groups board. There are lots of resources and projects being shared by the community.

One book that is recommended reading is Raspberry Pi Super Cluster (£16.78) by Andrew K Dennis.

Whatever resources you choose, we think the Cluster HAT is a great resource for starting distributed computing. It’s small, cheap, and easy to set up.

You have to leap a lot of hurdles to learn cluster computing. But Cluster HAT removes the expensive and difficult hardware build. It’s then up to you to learn the sophisticated coding techniques.

We tested this board using the original Pi Zero, not the newer Pi Zero W model. We believe the Pi Zero W will work exactly the same (as it has the same hardware). However, the hardware does not need (or use) the wireless networking on the Pi Zero W so it is better (and cheaper) to use the original Pi Zero board.

In the end, this is a compact, neat and cost-effective solution to building a cluster computer. The end-product might lack raw power, but it’s perfect for teaching and learning distributed computing concepts.

  • Michael Van Varenberg

    Hi,

    is it possible to do bitcoin mining with this setup?

    grtz,

    Michael

  • Hilton Garcia Fernandes

    Hello, Michael !

    Due to the fierce war among Bitcoin miners, the amount of computing power needed to be competitive is much larger than this setup. Consider the Bitmain’s Ant S9 for this purpose.

    However, there are newer cryptocoins with small power needs, that you should consider. For instance, Ethereum.

    In any case, it would be better to use a Raspberry 3, that will be more powerful than ClusterHAT — as the author explains, it is more a learning tool than a real cluster.

    Good luck,
    Hilton

  • Clément Clarisse

    There’s a point that i release : while using several same boards on a hat, why not make it for Compute Module which in all ways require already itself a board for running ?

    Even if it seems obvious that’s because a Zero is cheaper n they may want to see how far their board is powerful, i think it will come out in a near future.

  • Karsten Johansson

    I have a sneaking suspicion that what you ask for is what will inevitably come to be. The Compute Module is pretty limited for the “average layman” but the pi zero isn’t. I think for learning purposes, and perhaps even development, the clusterHAT is pretty hard to beat. If you need to crank it up to 11, a bank of Compute Modules could easily contain more units in a reasonably similar amount of space. You’d have to power that HAT separately though, since the 4 zeros is already pretty much the most that you can ask a Pi3 to drive without an external jolt.

  • Karsten Johansson

    You can plug Pi3’s into the cluster hat with a usb adapter cable. They’d all need their own power supply though. Nothing is stopping you from plugging anything particular into the clusterHAT board, since it is essentially just a fancy powered USB hub.

    But indeed a bank of zeros would cost more in electricity than what you would raise by mining. Unless you live in an apartment with utilities included. 🙂

  • Chris Burton

    A Pi3 plugged into the HAT wouldn’t work as a USB Gadget since the USB hub/Ethernet IC is in the way.

  • Chris Burton

    Sadly a compute module wouldn’t fit on a HAT, but I hope to have something soon.

  • Karsten Johansson

    Gah, you’re right. “The Pi3B (like all Pi B models) has a USB hub on board, which blocks gadget mode.” Funny that I specifically mentioned it, but didn’t realize that would actually be in the way.

  • Karsten Johansson

    Gah, you’re right. “The Pi3B (like all Pi B models) has a USB hub on board, which blocks gadget mode.” Funny that I mentioned USB hubs, but didn’t realize the Pi3 has one that would actually be in the way.