Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Raspberry Pi Super Cluster

You're reading from  Raspberry Pi Super Cluster

Product type Book
Published in Nov 2013
Publisher Packt
ISBN-13 9781783286195
Pages 126 pages
Edition 1st Edition
Languages
Author (1):
Andrew K. Dennis Andrew K. Dennis
Profile icon Andrew K. Dennis

A Hadoop application to calculate Pi


Hadoop comes packaged with a number of example applications. We are of course interested in calculating П program in particular.

The source code for this application can be downloaded from Apache's website at the following URL:

https://svn.apache.org/repos/asf/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/QuasiMonteCarlo.java

The JAR file containing the compiled class can be found on your machine at:

/home/pi/hadoop/hadoop-1.2.1/hadoop-examples-1.2.1.jar

Let's navigate to this directory:

cd ~/hadoop/hadoop-1.2.1

We are now going to run the example. The program takes two inputs: the number of maps and the number of samples. Try running the following demonstration:

hadoop jar hadoop-examples-1.2.1.jar pi 2 4

You should now see something similar to:

Number of Maps  = 2
Samples per Map = 4
Wrote input for Map #0
Wrote input for Map #1
Starting Job
…
Job Finished in 273.167 seconds
Estimated value...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}