A brief and basic introduction to Parallel Distributed Computing in Perl
Version: 0.101GRID::Machine::perlparintro is a brief and basic introduction to Parallel Distributed Computing in Perl.
License: Perl Artistic License
Operating System: Linux
$ time gridpipes.pl 1 1000000000
Process 0: machine = beowulf partial = 3.141593 pi = 3.141593
Pi = 3.141593. N = 1000000000 Time = 27.058693
pp2@nereida:~/LGRID_Machine/examples$ time gridpipes.pl 2 1000000000
Process 0: machine = beowulf partial = 1.570796 pi = 1.570796
Process 1: machine = orion partial = 1.570796 pi = 3.141592
Pi = 3.141592. N = 1000000000 Time = 15.094719
pp2@nereida:~/LGRID_Machine/examples$ time gridpipes.pl 3 1000000000
Process 0: machine = beowulf partial = 1.047198 pi = 1.047198
Process 1: machine = orion partial = 1.047198 pi = 2.094396
Process 2: machine = nereida partial = 1.047198 pi = 3.141594
Pi = 3.141594. N = 1000000000 Time = 10.971036
The total computational power of institutions as a whole has dramatically rised in the last decades, but due to distributed ownership and administration restrictions, individuals are not able to capitalize such computing power. Many machines sit idle for very long periods of time while their owners are busy doing other things. Many of them run some sort of UNIX, have Perl installed and provide SSH access.
If such is your scenario you can use GRID::Machine to have perl interpreters running in those nodes and make them collaborate to give you more computational power and more fun. All this without having to ask administrators or having to install any additional software.
This tutorial introduces the basics of parallel computing by means of a simple program that distributes the evaluation of some mathematical expression between several machines. The computational results show that - when the problem is large enough - a substantial improving is gained in performance: The execution times is reduced to the half by using two machines.