+/EE360P
distributed systems
git clone https://git.julia.blue/+/EE360P
07ca65d
master
1< html > 2<!-- 3Licensed to the Apache Software Foundation (ASF) under one or more 4contributor license agreements. See the NOTICE file distributed with 5this work for additional information regarding copyright ownership. 6The ASF licenses this file to You under the Apache License, Version 2.0 7(the "License"); you may not use this file except in compliance with 8the License. You may obtain a copy of the License at 9 10http://www.apache.org/licenses/LICENSE-2.0 11 12Unless required by applicable law or agreed to in writing, software 13distributed under the License is distributed on an "AS IS" BASIS, 14WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15See the License for the specific language governing permissions and 16limitations under the License. 17--> 18< body > 19 This package consists of a map/reduce application, 20< i > distbbp</ i > , 21 which computes exact binary digits of the mathematical constant π. 22 distbbp is designed for computing the n< sup > th</ sup > bit of π, 23 for large n, say n > 100,000,000. 24 For computing the lower bits of π, consider using< i > bbp</ i > . 25 26< h3 > The distbbp Program</ h3 > 27 The main class is DistBbp 28 and the actually computation is done by DistSum jobs. 29 The steps for launching the jobs are: 30 31< ol > 32< li > Initialize parameters.</ li > 33< li > Create a list of sums.</ li > 34< li > Read computed values from the given local directory.</ li > 35< li > Remove the computed values from the sums.</ li > 36< li > Partition the remaining sums into computation jobs.</ li > 37< li > Submit the computation jobs to a cluster and then wait for the results.</ li > 38< li > Write job outputs to the given local directory.</ li > 39< li > Combine the job outputs and print the π bits.</ li > 40</ ol > 41 42< table >< tr valign =top >< td width =420 > 43< h3 > The Bits of π</ h3 > 44< p > 45The table on the right are the results computed by distbbp. 46</ p > 47< ul > 48< p >< li > Row 0 to Row 7 49< ul >< li > They were computed by a single machine.</ li > 50 51< li > A single run of Row 7 took several seconds.</ li > 52</ ul ></ li ></ p > 53< p >< li > Row 8 to Row 14 54< ul >< li > They were computed by a 7600-task-capacity cluster.</ li > 55< li > A single run of Row 14 took 27 hours.</ li > 56< li > The computations in Row 13 and Row 14 were completed on May 20, 2009. 57 It seems that the corresponding bits were never computed before.</ li > 58</ ul ></ li ></ p > 59< p >< li > The first part of Row 15 (< tt > 6216B06</ tt > ) 60 61< ul >< li > The first 30% of the computation was done in idle cycles of some 62 clusters spread over 20 days.</ li > 63< li > The remaining 70% was finished over a weekend on< i > Hammer</ i > , 64 a 30,000-task-capacity cluster, which was also used for the 65< a href ="http://developer.yahoo.net/blogs/hadoop/2009/05/hadoop_sorts_a_petabyte_in_162.html "> petabyte sort benchmark</ a > .</ li > 66< li > The log files are available 67< a href ="https://issues.apache.org/jira/secure/attachment/12408543/1e15log.zip "> here</ a > .</ li > 68< li > The result was posted in 69< a href ="http://developer.yahoo.net/blogs/hadoop/2009/05/hadoop_computes_the_10151st_bi.html "> this YDN blog</ a > .</ li > 70 71</ ul ></ li ></ p > 72< p >< li > The second part of Row 15 (< tt > D3611</ tt > ) 73< ul >< li > The starting position is 1,000,000,000,000,053, totally 20 bits.</ li > 74< li > Two computations, at positions< i > n</ i > and< i > n</ i > +4, were performed. 75< li > A single computation was divided into 14,000 jobs 76 and totally 7,000,000 tasks. 77 It took 208 years of CPU-time 78 or 12 days of cluster (with 7600-task-capacity) time.</ li > 79< li > The log files are available 80< a href ="https://issues.apache.org/jira/secure/attachment/12412297/D3611.tar.gz "> here</ a > .</ li > 81 82< li > The computations were completed on June 30, 2009. 83 The last bit, the 1,000,000,000,000,072< sup > nd</ sup > bit, 84 probably is the highest bit (or the least significant bit) of π 85 computed ever in the history.</ li > 86</ ul ></ li ></ p > 87 88</ td >< td width =20 ></ td >< td > 89< table border =1 width =400 cellpadding =5 > 90< tr >< th width =30 ></ th >< th > Position< i > n</ i ></ th >< th > π bits (in hex) starting at< i > n</ i ></ th ></ tr > 91 92< tr >< td align =right > 0</ td >< td align =right > 1</ td >< td >< tt > 243F6A8885A3</ tt >< sup > *</ sup ></ td ></ tr > 93< tr >< td align =right > 1</ td >< td align =right > 11</ td >< td >< tt > FDAA22168C23</ tt ></ td ></ tr > 94< tr >< td align =right > 2</ td >< td align =right > 101</ td >< td >< tt > 3707344A409</ tt ></ td ></ tr > 95< tr >< td align =right > 3</ td >< td align =right > 1,001</ td >< td >< tt > 574E69A458F</ tt ></ td ></ tr > 96 97< tr >< td align =right > 4</ td >< td align =right > 10,001</ td >< td >< tt > 44EC5716F2B</ tt ></ td ></ tr > 98< tr >< td align =right > 5</ td >< td align =right > 100,001</ td >< td >< tt > 944F7A204</ tt ></ td ></ tr > 99< tr >< td align =right > 6</ td >< td align =right > 1,000,001</ td >< td >< tt > 6FFFA4103</ tt ></ td ></ tr > 100< tr >< td align =right > 7</ td >< td align =right > 10,000,001</ td >< td >< tt > 6CFDD54E3</ tt ></ td ></ tr > 101< tr >< td align =right > 8</ td >< td align =right > 100,000,001</ td >< td >< tt > A306CFA7</ tt ></ td ></ tr > 102 103< tr >< td align =right > 9</ td >< td align =right > 1,000,000,001</ td >< td >< tt > 3E08FF2B</ tt ></ td ></ tr > 104< tr >< td align =right > 10</ td >< td align =right > 10,000,000,001</ td >< td >< tt > 0A8BD8C0</ tt ></ td ></ tr > 105< tr >< td align =right > 11</ td >< td align =right > 100,000,000,001</ td >< td >< tt > B2238C1</ tt ></ td ></ tr > 106< tr >< td align =right > 12</ td >< td align =right > 1,000,000,000,001</ td >< td >< tt > 0FEE563</ tt ></ td ></ tr > 107< tr >< td align =right > 13</ td >< td align =right > 10,000,000,000,001</ td >< td >< tt > 896DC3</ tt ></ td ></ tr > 108 109< tr >< td align =right > 14</ td >< td align =right > 100,000,000,000,001</ td >< td >< tt > C216EC</ tt ></ td ></ tr > 110< tr >< td align =right > 15</ td >< td align =right > 1,000,000,000,000,001</ td >< td >< tt > 6216B06</ tt > ...< tt > D3611</ tt ></ td ></ tr > 111</ table > 112 113< p >< sup > *</ sup > 114By representing π in decimal, hexadecimal and binary, we have 115 116< ul >< table >< tr > 117< td > π</ td >< td > =</ td >< td >< tt > 3.1415926535 8979323846 2643383279</ tt > ...</ td > 118</ tr >< tr > 119< td ></ td >< td > =</ td >< td >< tt > 3.243F6A8885 A308D31319 8A2E037073</ tt > ...</ td > 120</ tr >< tr > 121< td ></ td >< td > =</ td >< td >< tt > 11.0010010000 1111110110 1010100010</ tt > ...</ td > 122 123</ td ></ tr ></ table ></ ul > 124The first ten bits of π are< tt > 0010010000</ tt > . 125</ p > 126</ td ></ tr ></ table > 127 128 129< h3 > Command Line Usages</ h3 > 130 The command line format is: 131< ul >< pre > 132$ hadoop org.apache.hadoop.examples.pi.DistBbp \ 133 <b> <nThreads> <nJobs> <type> <nPart> <remoteDir> <localDir></ pre ></ ul > 134 And the parameters are: 135< ul >< table > 136< tr > 137< td > <b></ td > 138< td > The number of bits to skip, i.e. compute the (b+1)th position.</ td > 139</ tr > 140< tr > 141< td > <nThreads></ td > 142< td > The number of working threads.</ td > 143</ tr > 144< tr > 145< td > <nJobs></ td >< td > The number of jobs per sum. 146</ tr > 147< tr > 148< td > <type></ td >< td > 'm' for map side job, 'r' for reduce side job, 'x' for mix type.</ td > 149</ tr > 150< tr > 151< td > <nPart></ td > 152< td > The number of parts per job.</ td > 153</ tr > 154< tr > 155< td > <remoteDir></ td > 156< td > Remote directory for submitting jobs.</ td > 157</ tr > 158< tr > 159< td > <localDir></ td > 160< td > Local directory for storing output files.</ td > 161</ tr > 162</ table ></ ul > 163 Note that it may take a long time to finish all the jobs when <b> is large. 164 If the program is killed in the middle of the execution, the same command with 165 a different <remoteDir> can be used to resume the execution. For example, suppose 166 we use the following command to compute the (10^15+57)th bit of π. 167< ul >< pre > 168$ hadoop org.apache.hadoop.examples.pi.DistBbp \ 169 1,000,000,000,000,056 20 1000 x 500 remote/a local/output</ pre ></ ul > 170 It uses 20 threads to summit jobs so that there are at most 20 concurrent jobs. 171 Each sum (there are totally 14 sums) is partitioned into 1000 jobs. 172 The jobs will be executed in map-side or reduce-side. Each job has 500 parts. 173 The remote directory for the jobs is remote/a and the local directory 174 for storing output is local/output. Depends on the cluster configuration, 175 it may take many days to finish the entire execution. If the execution is killed, 176 we may resume it by 177< ul >< pre > 178$ hadoop org.apache.hadoop.examples.pi.DistBbp \ 179 1,000,000,000,000,056 20 1000 x 500 remote/b local/output</ pre ></ ul > 180</ body > 181</ html >