Raspberry Pi Super Cluster - Andrew K. Dennis - E-Book

Raspberry Pi Super Cluster E-Book

Andrew K. Dennis

0,0
27,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

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.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 146

Veröffentlichungsjahr: 2013

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Raspberry Pi Super Cluster
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Clusters, Parallel Computing, and Raspberry Pi – A Brief Background
A very short history of parallel computing
Supercomputers
Multi-core and multiprocessor machines
Commodity hardware clusters
Cloud computing
Big data
Raspberry Pi and parallel computing
Programming languages and frameworks
Summary
2. Setting Up your Raspberry Pi Software and Hardware for Parallel Computing
Setting up our work environment
HDMI-capable monitor or VGA/DVI monitor and adapter
USB keyboard and mouse
Two micro-USB power units
A desk-mounted power strip with both USB and mains outlets (optional)
Three Ethernet/RJ45 network cables
A small network switch
An existing Internet connection
Two SD cards that are compatible with the Raspberry Pi
Housing units for the Raspberry Pi boards and Lego (optional)
USB hard drives (optional)
Future expansion and a scalable setup
Completing the initial setup
Using an SD card as our Raspberry Pi's storage device
SD card setup
Formatting our card
Mac OS X SD card formatting instructions
Windows 8 SD card formatting instructions
Linux instructions for SD card formatting
BerryBoot version 2
Downloading the BerryBoot version 2 ZIP file
Mac OS X
Windows 8
Linux
Starting up the Raspberry Pi
The installation process
Installation complete
Testing SSH and setting up keys
Connecting via SSH
Mac OS X and Linux users
Windows 8 users with PuTTY
SSH running successfully
Setting up your SSH RSA keys
The ssh-agent and ssh-add tools
SSH setup complete
Wrapping up
Editing text files on Raspbian
Installing Fortran
Terminal multiplexing with Screen
Summary
3. Parallel Computing – MPI on the Raspberry Pi
MPI – Message Passing Interface
MPI implementations – MPICH and OpenMPI
Creating an environment and downloading MPICH
Building and installing MPICH
Configuring your Raspberry Pi to run with MPICH
Testing our MPICH installation
Building our second Raspberry Pi
Windows 8
Mac OS X
Linux
Powering up the second Raspberry Pi
RSA key setup for SSH
Writing an MPI-based application
MPI – point-to-point communication
Summary
4. Hadoop – Distributed Applications on the Raspberry Pi
A brief introduction to Apache Hadoop
Installing Java
Installing Apache Hadoop
Hadoop configuration
Testing our Hadoop server
Setting up our second Raspberry Pi
Summary
5. MapReduce Applications with Hadoop and Java
MapReduce
MapReduce in Hadoop
HDFS – The Hadoop distributed file system
The WordCount MapReduce program
Testing our application
Summary
6. Calculate Pi with Hadoop and MPI
Monte Carlo simulators
A Hadoop application to calculate Pi
Pi with C language and MPI
Summary
7. Going Further
Booting from an external USB HDD
Building a Lego enclosure
Experimenting with MPI and Fortran
Power for multiple devices
USB wall plates
Battery power
Using a PC power supply
Power over Ethernet
Summary
A. Appendix
Fortran and C/C++
MPI, Hadoop, and parallel computing
Raspberry Pi cases and clusters
Index

Raspberry Pi Super Cluster

Raspberry Pi Super Cluster

Copyright © 2013 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: November 2013

Production Reference: 1131113

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78328-619-5

www.packtpub.com

Cover Image by Aniket Sawant (<[email protected]>)

Credits

Author

Andrew K. Dennis

Reviewers

Prasanna Gautam

Sungjin Han

Claes Jakobsson

Acquisition Editors

Anthony Albuquerque

Edward Gordon

Commissioning Editor

Amit Ghodake

Technical Editors

Faisal Siddiqui

Sonali S. Vernekar

Project Coordinator

Aboli Ambardekar

Proofreader

Stephen Copestake

Indexer

Monica Ajmera Mehta

Graphics

Abhinash Sahu

Production Coordinator

Alwin Roy

Cover Work

Alwin Roy

About the Author

Andrew K. Dennis is the Manager of Application Development at Prometheus Research. Prometheus Research is a leading provider of integrated data management for research and the home of HTSQL, an open source navigational query language for RDMS.

Andrew has a Diploma in Computing and a BS in Software Engineering; he is currently studying a second BS in Creative Computing in his spare time.

He has over 10 years of experience working in the software industry in the UK, Canada, and USA. This experience includes e-Learning, CMS and LMS development, SCORM consultancy, web development in a variety of languages, open source application development, and running a blog dedicated to maker culture and home automation.

His interests include web development, e-Learning, 3D printing, Linux, the Raspberry Pi and Arduino, open source projects, parallel computing, home automation, amateur electronics, home networking, and software engineering.

Many of these topics were covered in his previous book from Packt Publishing, Raspberry Pi Home Automation with Arduino.

I would like to thank my wife Megen for supporting me throughout this project, my parents for their support with my interest in technology whilst growing up, and the team at Prometheus Research for making this a great and interesting place to work and helping to change the face of data management.



I would also like to thank Aboli Ambardekar, Amit Ghodake, 
and Edward Gordon at Packt Publishing for their guidance throughout this process, and the technical reviewers for their thoughtful comments.

About the Reviewers

Prasanna Gautam is an engineer who wears many different hats depending on the occasion. He graduated from Trinity College in 2011 with honors in Computer Science and Mathematics. At Trinity, he worked on building robots that extinguished fires in firefighting contests, implemented the JAUS communication protocol in LabView, and worked on architecting robots to work in realtime. He's worked on the Linux Network stack on phones, writing task distribution algorithms to be used on the Open Science Grid, and building Beowulf clusters ranging from 8 to 80 nodes.

Currently, he works as a Software Engineer at ESPN where he still gets to wear his hats. He and Andrew met at NewHaven.io and found they had the same idea with regard to teaching people about Parallel computing by getting them to set up their own clusters on Raspberry Pis. Fortunately, Andrew was already writing the book. In his free time, Prasanna attempts to play the guitar and make sense of music theory.

Sungjin Han loves to play games and tinker with Linux and Ruby. In this sense, the Raspberry Pi was an interesting toy and a powerful tool for him.

Thanks to all the people who make the world more convenient and happier, especially the ones on many open source projects.

Claes Jakobsson started his career in the mid-90s and quickly became involved in the open source community—hacking code and organizing stuff in his hometown of Stockholm. Although Perl is the primary focus, he forays into PostgreSQL, cURL, and other projects. His daytime occupation has been mostly with financial systems, but at night embedded systems, microcontrollers, virtual machines, and compilers keep his mind sharp. He is a technologist at heart with a sharing mind and is always eager to see what happens next.

www.PacktPub.com

Support files, eBooks, discount offers and more

You might want to visit www.PacktPub.com for support files and downloads related to your book.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. 

Why Subscribe?

Fully searchable across every book published by PacktCopy and paste, print and bookmark contentOn demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

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'sAn HDMI monitor and cableUSB keyboardUSB mouseTwo Micro-USB power units compatible with the Raspberry PiThree network cablesA small network switchTwo Raspberry Pi compatible SD cardsInternet connectionA 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 <[email protected]>, 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 <[email protected]> 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 <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.

Chapter 1. Clusters, Parallel Computing, and Raspberry Pi – A Brief Background

The domain of parallel computing is an interesting one, but building a cluster for fun has often required the use of expensive or bulky off-the-shelf hardware, such as desktop PC's or implementing complex virtual machine setups.

So what is a cluster? This term will come up often in the following chapters and essentially means, in the context of this book, a group of separate devices networked together. Each device on this network is often referred to as a node.

Thanks to the Raspberry Pi's low cost and small physical footprint, building a cluster to explore parallel computing has become far cheaper and easier for users at home to implement. Not only does it allow you to explore the software side, but also the hardware as well.