A Cluster of Raspberry Pi Picos Makes the Mandlebrot Set Work Whizz By Faster

Eight Raspberry Pi Picos talking over an I2C network provide a fourfold speed-up to visualizing a classic fractal set.

Gareth Halfacree
11 months agoHW101

Cornell University students Ryan Kolm and Ignacio De Jesus Romo Jimenez have created a compact distributed computing system for calculating the Mandlebrot set — using Raspberry Pi Pico microcontroller boards.

"Besides its inherent aesthetic appeal, the Mandelbrot set also serves as an excellent benchmark for parallel computation power, in that its algorithm contains no dependencies between results," the students explain of their choice of computational load. "This means that work can be done simultaneously on many different devices, and none of them ever rely on the results of another device. To put this into computer architecture language, the algorithm presents no possible data hazards."

Named for Benoit Mandelbrot's visualizations of the set in 1980, though first defined two years earlier by Robert W. Brooks and Peter Matelski, the Mandlebrot set is a two-dimensional set which can be drawn as an infinitely-complicated fractal. While modern computers can easily visualize the set in real time, its complexity made it an ideal benchmark for classic computer systems — and even supercomputers — of yesteryear.

Kolm and Jimenez aren't running their calculator on a modern computer, though, nor on vintage hardware, but on a cluster of Raspberry Pi Pico boards dubbed the "Computron". With a dual-core RP2040 microcontroller running at a stock 133MHz and 264kB of RAM, they're dinky devices by today's standards but beasts by comparison to what Mandelbrot had available at the time.

Eight of the Raspberry Pi Pico boards are connected over an I2C network, sharing data and the workload, with one also taking the job of sending the calculated visualization to a VGA display. "Originally, we did not plan on using I2C as our final communication protocol," the students admit. "Instead, we had planned on using CAN as our network protocol.

"To us, CAN was a sound compromise between the speed of SPI and the ease of use of I2C. However, because our CAN transceivers came in later than expected, we decided to start our work with I2C. Though we wished to be able to implement our project in both I2C and CAN in order to compare the two, we ended up only having time to implement the I2C version of our parallel computer."

Kolm and Jiminez aren't the first to have the idea of using Raspberry Pi Pico boards for distributed computing. Back in April Derek Woodroffe showed off the PicoCray, a cluster of Raspberry Pi Pico boards arranged to mimic the layout of a classic Cray-1 supercomputer and communicating over an I2C network — though while it was also used to calculate the Mandelbrot set, the actual real-world performance was disappointingly slower than doing the same on a single Raspberry Pi Pico.

The cluster created by Kolm and Jiminez, though, proved more successful — demonstrating a fourfold speed improvement when the workload was distributed across all eight Raspberry Pi Pico boards than when it was running on a single board. "The 4x speedup is less than the 8x you'd expect from using eight times the hardware," the pair admit, "but it's a solid basis for speeding up the Mandelbrot set."

The students' full write-up is available on the project website, with source code published behind a Cornell registration barrier.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles