33
Peep Into π Vishnu Gopal vish.in Barcamp Kerala 5 Sunday 3 May 2009

Peep Into Pi

  • Upload
    vishnu

  • View
    2.648

  • Download
    6

Embed Size (px)

DESCRIPTION

A method to compute PI using distributed, browser-based methods.

Citation preview

Page 1: Peep Into Pi

Peep Into πVishnu Gopal vish.inBarcamp Kerala 5

Sunday 3 May 2009

Page 2: Peep Into Pi

Please visit peepapp.com

Sunday 3 May 2009

Page 3: Peep Into Pi

Area of a circle = πr2

Sunday 3 May 2009

Page 4: Peep Into Pi

π = 22 / 7

(Archimedes, 212 B.C, 3 decimal places)

Sunday 3 May 2009

Page 5: Peep Into Pi

π = 355/113

(Zu Chong Zhi, 480 A.D. 7 decimal places)

Sunday 3 May 2009

Page 6: Peep Into Pi

But what is the exact value of π?

Sunday 3 May 2009

Page 7: Peep Into Pi

π is both Irrational and Transcendental

Sunday 3 May 2009

Page 8: Peep Into Pi

Formulae for π

Sunday 3 May 2009

Page 9: Peep Into Pi

Dartboard Algorithm

Sunday 3 May 2009

Page 10: Peep Into Pi

Area of circle / Area of square = π / 4

AaBb r

Sunday 3 May 2009

Page 11: Peep Into Pi

There are other formulae, like Bellard’s approximation

1000 iterations gives 3000 decimal places

Sunday 3 May 2009

Page 12: Peep Into Pi

Distributed computing

Sunday 3 May 2009

Page 13: Peep Into Pi

BOINC: SETI@HOME

Sunday 3 May 2009

Page 14: Peep Into Pi

Server sends pieces of data to be processed, workers calculate, send data back,

server aggregates and displays result.

Worker 1

Server

Worker 2

Worker 3

Worker 4

Sunday 3 May 2009

Page 15: Peep Into Pi

Pieces of data: MapCalculate

Aggregates: Reduce

Sunday 3 May 2009

Page 16: Peep Into Pi

This is essentially Google’s MapReduce

Sunday 3 May 2009

Page 17: Peep Into Pi

Finding workers should be as easy as possible.

Sunday 3 May 2009

Page 18: Peep Into Pi

Communication should be really easy & capable

Sunday 3 May 2009

Page 19: Peep Into Pi

We change the architecture a bit.

Sunday 3 May 2009

Page 20: Peep Into Pi

Workers = a browserCoordinator = a websiteMaster = a web-service

Worker 1

Coordinater

Worker 2

Worker 3

Worker 4

Master

Master n2

Master n3

Sunday 3 May 2009

Page 21: Peep Into Pi

Enter peepapp.com

Sunday 3 May 2009

Page 22: Peep Into Pi

A browser nowadays is very capable & speedy.

Sunday 3 May 2009

Page 23: Peep Into Pi

The coordinator functions simply as a message queue

Sunday 3 May 2009

Page 24: Peep Into Pi

Master nodes can reside anywhere & take any form.

Sunday 3 May 2009

Page 25: Peep Into Pi

Map & Reduce is done by Master node

Sunday 3 May 2009

Page 26: Peep Into Pi

Calculate is done by the worker nodes

Sunday 3 May 2009

Page 27: Peep Into Pi

peepapp.com current status: map not done.

Sunday 3 May 2009

Page 28: Peep Into Pi

The demo becomes more accurate with more people

Sunday 3 May 2009

Page 29: Peep Into Pi

Peep architecture: nginx, passenger, sinatra/ruby,

starling, memcached

No RDBMS, woot!

Sunday 3 May 2009

Page 30: Peep Into Pi

Contributing to a job is as easy as visiting a web page.

Sunday 3 May 2009

Page 31: Peep Into Pi

Further plans: Make creating a job easy too.

Sunday 3 May 2009

Page 32: Peep Into Pi

Contributing to a job is as easy as visiting a web page.

Sunday 3 May 2009

Page 33: Peep Into Pi

FinisQuestions?

@vishmaker on Twitter

Sunday 3 May 2009