Parallel::Pvm::Scheduler - Perl extension for distributing jobs through PVM
use Parallel::Pvm::Scheduler; my $prm = new Parallel::Pvm::Scheduler(); # Create an array of tasks: $tasks[0][0] = "/myhome/program1"; $tasks[0][1] = "program1 parameter 1"; $tasks[0][2] = "program1 parameter 2"; $tasks[1][0] = "/myhome/program2_noparameters"; $tasks[2][0] = "/myhome/program1"; $tasks[2][1] = "program1 parameter 1"; # Submit the tasks for ($i = 0; $i < $taskcount; $i++) { $prm->submit("user-defined task description", $args[$i]); } # Wait for the tasks to complete $prm->recaptureHosts(1);
Parallel-Pvm-Scheduler is a module designed to allow one to distribute a large number of independent jobs across a cluster using PVM. It first queries the number of available machines in the cluster, then submits exactly 1 jobs per available machine. When a job is finished, it recaptures the machine and submits the next job. It repeats this until all the jobs are complete.
If all the available machines are used, it will wait until 1 becomes free before submitting the next job, hence it will sleep until a task is complete.
None by default.
Parallel::Pvm perl module
Ryan Golhar, <golharam@umdnj.edu<gt>
Copyright 2006 by Ryan Golhar
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Title : new Usage : my $prm = new Parallel::Pvm::Scheduler(); Function: Creates and initialized a PVM resource manager Returns : Parallel::Pvm::Scheduler
Title : getHostCount Usage : $hostcount = $prm->getHostCount(); Function: Returns the number of hosts within the PVM Returns : integer
Title : getFreeHostCount Usage : $freehostcount = $prm->getFreeHostCount(); Function: Returns the number of free hosts within the PVM Returns : integer
Title : submit Usage : $prm->getFreeHostCount($taskdesc, @argv); Function: Submits a task contained with an argument vector Args : $taskdesc is a taskdescription. It can be anything set by the user @argv is an argument vector. The first element is the program to execute the remaining elements are the parameters to the program. Notes : To execute multiple programs in serial for a single task, make a perl script and submit the perl script as the task.
Title : recaptureHosts Usage : $prm->recaptureHosts($block); Function: Checks tasks for completion and prints their output Args : $block = 0, then iterate through all the tasks and query for their completion. if done, free the machine = 1, then iterate through all tasks waiting for them to complete. Does not return until the tasks are complete.
Title : _allocateHost Function: Internal Function: Used to allocate which host runs the next task
Title : _deallocateHost Function: Internal Function: Frees a host making it available for another task
To install Parallel::Pvm::Scheduler, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parallel::Pvm::Scheduler
CPAN shell
perl -MCPAN -e shell install Parallel::Pvm::Scheduler
For more information on module installation, please visit the detailed CPAN module installation guide.