1#!/usr/bin/perl 2 3# Do a run for a range of parameters 4 5if (($#ARGV != 0) && ($#ARGV != 1)) { 6 print STDERR "Usage: do-run.pl [-p] <logdir>\n"; 7 print STDERR "Options:\n"; 8 print STDERR "\t-p\tDisplay output directly; do not send to log file\n"; 9 exit -1; 10} 11 12$LOGDIR = shift; 13if ($LOGDIR eq "-p") { 14 $DIRECT_OUTPUT = 1; 15 $LOGDIR = shift; 16} 17 18$SERVER = "mm56"; 19 20$MINCLIENTS = 256; 21$MAXCLIENTS = 8192; 22 23$MAXNODES = 16; 24 25sub calcNodes { 26 my ($numclients) = shift; 27 28 $l = int(log($numclients) / log(2)); 29 if (($l % 2) != 0) { 30 $nodes = 2 ** (($l-1)/2); 31 $threads = 2 ** (($l+1)/2); 32 } else { 33 $nodes = 2 ** ($l/2); 34 $threads = 2 ** ($l/2); 35 } 36 37 while ($nodes > $MAXNODES) { 38 $nodes /= 2; 39 $threads *= 2; 40 } 41 42 return ($nodes, $threads); 43} 44 45for ($totalclients = $MINCLIENTS; $totalclients <= $MAXCLIENTS; $totalclients *= 2) { 46 ($nodes, $threads) = &calcNodes($totalclients); 47 $t = $nodes * $threads; 48 print STDERR "Target is $totalclients, nodes=$nodes, threads=$threads, total=$t\n"; 49 50 if ($DIRECT_OUTPUT) { 51 $opt = "-p"; 52 } 53 54 $cmd = "run-client.pl $opt $LOGDIR $SERVER $nodes $threads"; 55 print STDERR "Cmd is $cmd\n"; 56 system($cmd); 57 print STDERR "Done, sleeping ...\n"; 58 sleep(10); 59} 60 61