script/mpiruns.pl untested

filter: Statementstmt 0.0% 0 / 43 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 56 CC 1 SCAR 6.9
CC
1
Cov
0%
thread_entry
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2  
3 # read pidlist avery N seconds and (kill -9|STOP) a random pid
4 # usage mpd-kill.pl --time=5 --hostname=node-0.phenyxtest --username=evaleto --loop
5  
6 use Data::Dumper;
7 use Parallel::Mpich::MPD;
8 use threads;
9  
10 use Getopt::Long;
11 my($time, $verbose, $loop, $parallel, $hosts);
12 $time=1;
13 $usename="evaleto";
14 if (!GetOptions(
15 "time=s"=>\$time,
16 "verbose" =>\$verbose,
17 "parallel=s" =>\$parallel,
18 "hosts=s" =>\$hosts,
19 "loop" =>\$loop,
20 )|!defined($time)|!defined($parallel)){
21 printf STDERR "Usage:\n";
22 printf STDERR "mpdruns --time=20 --parallel=5\n\n";
23 exit 1;
24 }
25  
26  
27  
28 $Parallel::Mpich::MPD::Common::DEBUG=1;
29 #$Parallel::Mpich::MPD::Common::WARN=1;
30  
31 Parallel::Mpich::MPD::Common::env_Check();
32 Parallel::Mpich::MPD::Common::env_Print();
33 Parallel::Mpich::MPD::boot();
34 print "#running mpiexec\n";
35 print "#\n";
36  
37  
38 sub thread_entry{
39 my $stdout="";
40 my $stderr="";
41 my $pid="";
42 my $alias=Parallel::Mpich::MPD::makealias();
43 print "\nrunning: /opt/rockAround 100000 100 [alias=$alias]\n";
44 print "------------------------------------------------------\n";
45 Parallel::Mpich::MPD::createJob(cmd => '/opt/rockAround', params => '100000 100', alias => $alias, machinesfile => $hosts, pid=>\$pid, stdout => \$stdout, stderr=> \$stderr);
46
47 print "job->alias[$alias] --->[pid=$pid]\n";
48 print " +-->[out]\n$stdout\n";
49 print " +-->[err]\n$stderr\n";
50 print "------------------------------------------------------\n\n\n\n";
51 }
52  
53 do{
54 for ($i=0;$i<$parallel;$i++){
55 threads->new(\&thread_entry);
56 }
57 sleep $time;
58 }while (1 && defined($loop));
59