Book Image

Raspberry Pi Super Cluster

By : Andrew K. Dennis
Book Image

Raspberry Pi Super Cluster

By: Andrew K. Dennis

Overview of this book

A cluster is a type of parallel/distributed processing system which consists of a collection of interconnected stand-alone computers cooperatively working together. Using Raspberry Pi computers, you can build a two-node parallel computing cluster which enhances performance and availability. This practical, example-oriented guide will teach you how to set up the hardware and operating systems of multiple Raspberry Pi computers to create your own cluster. It will then navigate you through how to install the necessary software to write your own programs such as Hadoop and MPICH before moving on to cover topics such as MapReduce. Throughout this book, you will explore the technology with the help of practical examples and tutorials to help you learn quickly and efficiently. Starting from a pile of hardware, with this book, you will be guided through exciting tutorials that will help you turn your hardware into your own super-computing cluster. You'll start out by learning how to set up your Raspberry Pi cluster's hardware. Following this, you will be taken through how to install the operating system, and you will also be given a taste of what parallel computing is about. With your Raspberry Pi cluster successfully set up, you will then install software such as MPI and Hadoop. Having reviewed some examples and written some programs that explore these two technologies, you will then wrap up with some fun ancillary projects. Finally, you will be provided with useful links to help take your projects to the next step.
Table of Contents (15 chapters)
Raspberry Pi Super Cluster
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Have you ever read about parallel computing clusters and supercomputing, and wondered how to do it at home?

Do you have a number of Raspberry Pis and don't know what to do with them?

Then this is the book for you!

The field of parallel computing is certainly an exciting one. With the introduction of the Raspberry Pi, building a cluster at home is even easier. Hobbyists can now construct a small parallel computing cluster at low cost and using minimal physical space.

This book will walk you through building a parallel computing cluster using two Raspberry Pis and commodity off-the-shelf hardware.

Having set up your cluster, you will explore parallel computing paradigms such as MPI and MapReduce through exciting software projects.

Using MPICH and the C programming language, step-by-step guides will walk you through writing your own MPI-based applications. You will then test these in parallel on your two Raspberry Pis.

Following this, MapReduce will be examined through Apache Hadoop, which you will install and set up. You will then learn to interact with Hadoop by writing programs in Java.

Finally Raspberry Pi Super Cluster provides you with some fun jump-off points where you can explore the topics discussed in the book in further detail.

Having completed the various chapters' projects, you will have gained a basic knowledge of parallel computing and how it can be implemented on Raspberry Pi.

What this book covers

Chapter 1, Clusters, Parallel Computing, and Raspberry Pi – A Brief Background, provides an introduction to the topic of parallel computing and its history. You will also learn a little about the Raspberry Pi and why it is a good fit for experimenting with parallel computing.

Chapter 2, Setting Up your Raspberry Pi Software and Hardware for Parallel Computing, builds upon the first chapter by providing a guide to setting up a two node Raspberry Pi cluster and its associated hardware.

Chapter 3, Parallel Computing – MPI on the Raspberry Pi, introduces the topics of MPI (Message Passing Interface), and MPICH. These are explored through examples in the C programming language.

Chapter 4, Hadoop – Distributed Applications on the Raspberry Pi, explores Apache Hadoop and Java through practical examples. From installing Java through to Hadoop configuration, you will get a taste of the two technologies.

Chapter 5, MapReduce Applications with Hadoop and Java, explores the paradigm of MapReduce: the core technology at the heart of Hadoop.

Chapter 6, Calculate Pi with Hadoop and MPI, expands upon previous chapters with experiments on calculating Pi using Hadoop and MPICH. Here you will work with a Java example and write another C application implementing MPI.

Chapter 7, Going Further, finishes off the book with some projects ranging from building a Lego Raspberry Pi case to writing a Fortran application. You will also learn about some alternative approaches to powering your Raspberry Pi.

Appendix, provides you with a list of resources for further reading and exploration. Links to topics covered in this book are provided for the reader to follow up.

What you need for this book

The following list includes the recommended and optional hardware to complete the projects in this book:

  • Two Raspberry Pi Model B's

  • An HDMI monitor and cable

  • USB keyboard

  • USB mouse

  • Two Micro-USB power units compatible with the Raspberry Pi

  • Three network cables

  • A small network switch

  • Two Raspberry Pi compatible SD cards

  • Internet connection

  • A desk mounted power strip with both USB and mains outlet (optional)

  • Raspberry Pi cases/project enclosures (optional)

  • USB hard drive (optional for a project in Chapter 7, Going Further)

  • Lego (optional)

Who this book is for

Have you ever wanted to build your own super computer? Wonder what parallel computing is all about and want to experiment with it? Have a bunch of Raspberry Pis and not sure what to do with them? Then this book is for you.

Aimed at the super computing novice and Raspberry Pi enthusiast alike, this is the perfect introductory text for those wishing to get their hands dirty building their own system.

While some programming experience is required, no prior knowledge of the technologies associated with parallel computing is assumed.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Navigate into mpich3 and create the following two directories."

A block of code is set as follows:

/*
Hello RPI implemented using MPI
*/

#include <stdio.h>
#include <mpi.h>

Any command-line input or output is written as follows:

ssh [email protected] 'sudo echo "raspberrypi2" | sudo tee /etc/hostname; sudo shutdown -r now'

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Select your SD card drive from the Device dropdown on the right-hand side".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.