Build Supercomputers with Raspberry Pi 3 - Carlos R. Morrison - E-Book

Build Supercomputers with Raspberry Pi 3 E-Book

Carlos R. Morrison

0,0
31,19 €

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

Mehr erfahren.
Beschreibung

Author Carlos R. Morrison (Staff Scientist, NASA) will empower the uninitiated reader to quickly assemble and operate a Pi3 supercomputer in the shortest possible time. The lifeblood of a supercomputer, the MPI code, is introduced early, and sample MPI code provides additional practice opportunities for you to test the effectiveness of your creation. You will learn how to configure various nodes and switches so that they can effectively communicate with each other. By the end of this book, you will have successfully built a supercomputer and the various applications related to it.

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

EPUB
MOBI

Seitenzahl: 184

Veröffentlichungsjahr: 2017

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

Build Supercomputers with Raspberry Pi 3
Credits
About the Author
About the Reviewer
www.PacktPub.com
Why subscribe?
Customer Feedback
Dedication
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
Downloading the color images of this book
Errata
Piracy
Questions
1. Getting Started with Supercomputing
Von Neumann architecture
Flynn's classical taxonomy
Historical perspective
Serial computing technique
Parallel computing technique
The need for greater processing speed
Additional analytical perspective
Sources for reference
Summary
2. One Node Supercomputing
Linux installation
PC processor
Accessing processor technical details
Write/run serial π code
Message passing interface
Basic MPI code
MPI π code
Critical MPI for loop structure
MPI Euler code
MPI Leibniz code
MPI Nilakantha code
Summary
3. Preparing the Initial Two Nodes
Listing of parts
The Pi2/Pi3 computer
Project overview
Super stack assembly
Preparing the master node
Transferring the code
Preparing the slave node
Summary
4. Static IP Address and Hosts File Setup
Configuring static IP address of the master Pi
Configuring a network switch static IP address
Hosts file setup
Summary
5. Creating a Common User for All Nodes
Adding a new user for all nodes
ID key generation
ID key transfer
Summary
6. Creating a Mountable Drive on the Master Node
Summary
7. Configuring the Eight Nodes
Automating mounting of drives
Setting up the host file for all nodes
Formatting the remaining slave SD cards
Copying the slave1 SD card image to the main computer drive
Copying the slave1 image to the remaining slave SD cards
Summary
8. Testing the Super Cluster
Wielding the -H command
Pi2 supercomputing
Pi3 supercomputing
Creating bash files
Using unrestrained MPI code logic
Summary
9. Real-World Math Application
MPI Taylor series sine(x) function
MPI Taylor series cosine(x) function
MPI Taylor series tan(x) function
MPI Taylor series ln(x) function
Summary
10. Real-World Physics Application
MPI concurrent wave equation and code
Drawing graphs
Summary
11. Real-World Engineering Application
MPI Fourier series sawtooth signal
Summary
A. Appendix
Definitions 

Build Supercomputers with Raspberry Pi 3

Build Supercomputers with Raspberry Pi 3

Copyright © 2017 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: March 2017

Production reference: 1210317

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham 

B3 2PB, UK.

ISBN 978-1-78728-258-2

www.packtpub.com

Credits

Author

Carlos R. Morrison

Copy Editor

Safis Editing

Reviewer

Dr. Isaiah M. Blankson

Project Coordinator

Kinjal Bari

Commissioning Editor

 Vijin Boricha

Proofreader

Safis Editing

Acquisition Editor

Namrata Patil

Indexer

Tejal Daruwale Soni

Content Development Editor

Mamata Walkar

Graphics

Kirk D'Penha

Technical Editor

Varsha Shivhare

Production Coordinator

Melwyn Dsa

About the Author

Carlos R. Morrison was born in Kingston, Jamaica, West Indies. He received a B.S. (Hons) degree in physics with a mathematics minor in 1986 from Hofstra University, Hempstead, NY, and an M.S. degree in physics in 1989 from Polytechnic University, Brooklyn, NY.

In 1989, he joined the NASA Glenn Research Center, Cleveland, OH, as a staff scientist in the solid-state physics branch and, in 1999, he transferred to the structures and dynamics branch. He has authored and coauthored several journal and technical articles associated with aerospace and electromagnetic devices. He holds several patents, including one on the Morrison Motor for which he won the 2004 R&D 100 Award, and software technologies used to control magnetic bearings. He is currently engaged in research associated with room temperature and superconducting reluctance motors, and Simulink Simulation of said motors.

Mr. Morrison is a member of the American Physical Society and the National Technical Association.

I would like to thank Dr. Isaiah Blankson for reading the manuscript, and for building and testing the Pi cluster.

About the Reviewer

Dr. Isaiah M. Blankson received his PhD in Aeronautics and Astronautics from the Massachusetts Institute of Technology, Cambridge, MA, USA. He is a specialist in hypersonic aerodynamics and propulsion. His current research involves the use of computational (CFD) and experimental methods for Magneto Hydrodynamic (MHD) energy bypass engine concepts for space-access vehicles, and non-equilibrium plasma for applications in hypersonic aerodynamics and propulsion. Previously, he was an aerospace scientist at the General Electric Global Research Center (CRD) in Niskayuna, NY. He has several US patents, including one on an MHD-controlled turbojet engine for space access, and another on an exoskeletal gas-turbine engine. He is the author of numerous technical publications, and an associate fellow of the American Institute of Aeronautics and Astronautics (AIAA). Over the years, he has received many awards, including the distinguished presidential rank award for sustained superior accomplishment in 2012. As chief scientist at IMB and associates LLC, he develops and tests small-platform supercomputers for solving complex engineering problems. 

Here are some of the other books he has worked on:

Reviewer of selected chapters: Book to be published (2017) by Cambridge University Press, UKPlasma Physics for Engineering, by Dr. Joseph J. S. Shang and Dr. Sergey T. Surzhikov

www.PacktPub.com

For support files and downloads related to your book, please visit www.PacktPub.com.

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.

https://www.packtpub.com/mapt

Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.

Why subscribe?

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

Customer Feedback

Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/1787282589.

If you'd like to join our team of regular reviewers, you can e-mail us at [email protected]. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!

Dedication

This book is dedicated to the memory of my mother, Volda O. Morrison, who, in my formative years, provided encouragement, and support buttressing my interest in physics. Also, to my wife, Peta-Gaye, and daughters Camille, and Brittany who encouraged me to keep writing, and finally, to my younger brother Ramong who endured many of my antics throughout our earlier years.

Preface

This book explains how to build and operate a powerful eight or 16-node Pi2 or Pi3 supercomputer. You will be provided detailed systematic instructions on installing the Linux/Ubuntu operating system on your PC, and its use in configuring, communicating with, and ultimately operating your Pi supercomputer.

Initially, you will learn how to write and run a serial and a Message Passing Interface (MPI) π code on your PC, which is then used as a one-node supercomputer. Armed with this knowledge, you will then configure a Pi one-node, 4-core supercomputer on which you subsequently run the previous mentioned MPI π code. Next, you will assemble a two-node, 8-core Pi supercomputer on which, again, you will execute said MPI π code, and finally, you will construct an eight or 16-node Pi supercomputer, which you will employ to solve complex calculations incorporating the MPI construct.

What this book covers

Chapter 1, Getting Started with Supercomputing, provides an overall perspective on the concept of supercomputing. The chapter discusses Von Neumann’s architecture, Flynn’s classical taxonomy, a historical perspective on supercomputing, serial and parallel computing techniques, and justifications – including an analytical perspective – for greater processing speeds.

Chapter 2, One Node Supercomputing, discusses how to do supercomputing on one node, in this instance, your PC. You will be instructed how to install Linux/Ubuntu on your PC, which you will then use to run a serial and MPI π code. Next, you will learn about the critical for loop construct that is used to assign tasks among the cores/processes. Finally, you will write/copy, and run/generate π from the MPI Euler, Leibniz, and Nilakantha infinite series.

Chapter 3, Preparing the Initial Two Nodes, discusses how to build a two-node Pi supercomputer. Initially, you will be presented with a list of parts. You will then learn about the origin of the Pi microcomputer, and its technical specs. Next, you will be shown how to configure the master node in preparation for transferring the requisite MPI test codes from your PC to the master node. Finally, you will configure the first slave node in preparation for the creation a two-node (master and slave1) supercomputer.

Chapter 4, Static IP Address and Hosts File Setup, discusses how to configure the static IP address of the master, slave1, and network switch. Next, you will learn how to set up the hosts file.

Chapter 5, Creating a Common User for All Nodes, discusses how to create a new user for the master node, how to create a password for the new user on the master node, how to create a new user for the slave1 node, and how to create a password for the new user on the slave1 node. In addition, you will learn how to generate a special key on the master node, which is required for seamless transitioning between the nodes without using a password. You will then learn how to copy the special key from the master node to the slave1 node. Next, you will edit the .bashrc file on the master node to facilitate seamless special key access to all the nodes. Finally, you will learn how to use the which command.

Chapter 6, Creating a Mountable Drive on the Master Node, discusses how to use the mkdir command to make a directory/folder, the chown command for changing ownership of the export drive from the root user to a new user, and the rpcbind command, which allows the master Pi to export the export drive on the master to slave nodes. You will learn how to edit the exports file, which at facilitates exporting the export drive on the master node to the slave nodes, use the nfs-kernel-server command; edit the bootup script rc.local, which will make the export drive on the master node mountable for use by the slave nodes; use the mount command to manually mount the export drive containing the MPI codes; use the cat command to display the content of a file; use the cp -a command to copy files/codes to the export drive; and use the -H command to task any or all nodes; and cores to work on a given problem.

Chapter 7, Configuring the Eight Nodes, discusses how to configure the eight or 16-node Pi supercomputer. You will be shown how to edit the fstab file on the slave1 node to set up an automatic mount command, the rc.local file on the slave1 node to automatically mount the export drive containing the MPI test code folder, the hosts files on the master and slave1 nodes to reflect the temporary IP address, and host names on the remaining six or fourteen slave nodes. You will then be shown how to use the SD formatter for Windows to format the remaining slave SD cards, and win32 Disk Imager to copy the slave1 SD card image to the remaining slave nodes in the cluster. You will then edit/update, once again, the hosts file on the master and slaves to reflect their actual IP addresses, edit the interfaces file on the super cluster nodes, and finally, update the MAC and IP address on the network switch for the remaining slave nodes.

Chapter 8, Testing the Super Cluster, discusses how to use the shutdown -h now command to shut down your Pi computer, the -H command to solve the MPI π function in record time, and create convenience bash files to enhance the user experience while operating the supercomputer.

Chapter 9, Real-World Math Application, discusses how to write and run serial and MPI Taylor series, sine, cosine, tangent, and the natural log functions.

Chapter 10, Real-World Physics Application, discusses how to write and run the MPI code for a vibrating string.

Chapter 11, Real-World Engineering Application, discusses how to write and run a serial and MPI sawtooth Fourier series code.

What you need for this book

You will need Linux/Ubuntu OS installed on your PC with the option to access the Windows OS, and a basic working knowledge of the C language.

Who this book is for

This book targets hobbyists and enthusiasts who want to explore building supercomputers with microcomputers. Researchers will also find this book useful. Prior programming knowledge is necessary; knowledge of supercomputers is not.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "How to use the shutdown -h now command to shut"

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

alpha@Mst0:/beta/gamma $ time mpiexec -H Mst0,Mst0,Mst0,Mst0,Slv1,Slv1,Slv1,Slv1,Slv2,Slv2 MPI_08_b

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "On a Windows 7 machine, click on Systems & Security, then click on System, then DeviceManager, and click on Processor."

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 disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in 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 at 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 this book 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.

You can download the code files by following these steps:

Log in or register to our website using your e-mail address and password.Hover the mouse pointer on the SUPPORT tab at the top.Click on Code Downloads & Errata.Enter the name of the book in the Search box.Select the book for which you're looking to download the code files.Choose from the drop-down menu where you purchased this book from.Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

WinRAR / 7-Zip for WindowsZipeg / iZip / UnRarX for Mac7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Build-Supercomputers-with-Raspberry-Pi-3. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/BuildSupercomputerswithRaspberryPi3_ColorImages.pdf.

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—may be a mistake in the text or the code—we would be grateful if you could 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 to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted 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 author and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.

Chapter 1. Getting Started with Supercomputing

The prefix super in the moniker supercomputer may, to the ill-informed, conjure up images of the electronic supervillain HAL 9000 in Arthur C. Clarke's classic movie 2001: A Space Odyssey or the benevolent superhero Clark Kent, aka Superman, who inhabits the DC comic universe. However, the tag supercomputer is, in fact, associated with a non-fictional entity that has no ill-will towards humans - at least not at this moment in time. Supercomputing and supercomputers are the subject matter of this book.

In this chapter, we introduce the reader to the basics of supercomputing, or more precisely, parallel processing. Parallel processing is a computational technique that is currently enjoying widespread usage at many research institutions, including universities and government laboratories, where machines routinely carry out computation in the teraflops (1 billion floating point operations per second) and petaflops (1,000 teraflops) domain. Parallel processing significantly reduces the time needed to analyze and/or solve complex and difficult mathematical and scientific problems, such as weather prediction, where a daunting myriad of physical atmospheric conditions must be considered and processed simultaneously in order to obtain generally accurate weather forecasting.

Supercomputing is also employed in analyzing the extreme physical conditions extant at the origin of the much-discussed Big Bang event, in studying the dynamics of galaxy formation, and in simulating and analyzing the complex physics of atomic and thermonuclear explosions - data that is crucial to the military for maintaining and designing even more powerful weapons of mass destruction - holy crap!! This doesn't bode well for humanity. Anyway, these are just a few examples of tasks germane to parallel processing. Following are images of events that are being studied/simulated by scientist employing supercomputers:

The enhanced processing speed, so central to parallel computing, is achieved by assigning chunks of data to different processors in a computer network, where the processors then concurrently execute similar, specifically designed code logic on their share of the data. The partial solution from each processor is then gathered to produce a final result. You will indeed be exploring this technique later when you run example codes on your PC, and then on your Pi2 or Pi3 supercomputer.

The computational time compression associated with parallel computing is typically on the order of a few minutes or hours, rather than weeks, months, or years. The sharing of tasks among processors is facilitated by a communication protocol for programming parallel computers called Message Passing Interface (MPI). The MPI standard, which came to fruition between the 1980s and early 1990s, was finally ratified in 2012 by the MPI Forum, which has over 40 participating organizations.

You can visit https://computing.llnl.gov/tutorials/mpi/ for a brief history and tutorial on MPI, and https://computing.llnl.gov/tutorials/parallel_comp/ for parallel computing. You can also visit http://mpitutorial.com/tutorials/ for additional information and a tutorial on MPI programming.

In this chapter, you will learn about the following topics:

John von Neumann's stored-program computer architectureFlynn's classical taxonomyHistorical perspective on supercomputing and supercomputersSerial processing techniquesParallel processing techniquesThe need for greater processing speedAdditional analytical perspective on the need for greater processing speed

Von Neumann architecture

Dr. John von Neumann:

John von Neumann circa the 1940s

Any discussion concerning computers must include the contributions of the famed Hungarian mathematician/genius Dr. John von Neumann. He was the first to stipulate, in his famous 1945 paper, the general requirements for an electronic computer. This device was called a stored-program computer