-
Notifications
You must be signed in to change notification settings - Fork 1
/
get-plot.perl
executable file
·111 lines (97 loc) · 2.6 KB
/
get-plot.perl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#! /usr/bin/perl
# @serializations = ( "data", "ibis", "sun" );
# @ibises = ( "tcp", "net.bytes.gen.tcp_blk", "panda","net.gm" );
# @nodes = ( 1, 2, 4, 8, 16, 32 );
while ( <> ) {
chomp;
# printf "current $_\n";
( $runs, $ibis, $ser, $node, $min, $av, $speedup, $eff ) = split;
# printf ( "Runs $runs Ibis $ibis Serialization $ser Nodes $node speedup $speedup\n");
$ibis =~ s/\//-/g;
if ( $node =~ /^[0-9]+$/) {
$ix = $ibis . "/" . $ser . "@" . $node;
$data{ $ix } += $speedup;
$n { $ix } ++;
$archx = $ibis . "/" . $ser;
$archn { $archx } ++;
if ($node > $max_node) {
$max_node = $node;
}
$found = 0;
foreach ( @serializations ) {
if ( $_ eq $ser ) {
$found = 1;
break;
}
}
if ( ! $found ) {
@serializations = sort( @serializations, $ser );
}
$found = 0;
foreach ( @nodes ) {
if ( $_ eq $node ) {
$found = 1;
break;
}
}
if ( ! $found ) {
@nodes = sort { $a <=> $b } ( @nodes, $node );
}
$found = 0;
foreach ( @ibises ) {
if ( $_ eq $ibis ) {
$found = 1;
break;
}
}
if ( ! $found ) {
@ibises = sort( @ibises, $ibis );
}
}
}
{
$axis_round = 5;
use integer;
$max_node = $axis_round * ( ($max_node + $axis_round - 1) / $axis_round );
}
mkdir "plots" or printf "Warning: directory plots exists; will overwrite\n";
foreach ( "tcp", "myrinet" ) {
$network = $_;
open PLOT, ">plots/plot-$network.plot" or die "Cannot open/w 'plot-$network.plot'";
printf PLOT ("set terminal postscript color 18\n");
printf PLOT ("set output \"plot-$network.ps\"\n");
printf PLOT ("set xrange \[0:$max_node\]\n");
printf PLOT ("set yrange \[0:$max_node\]\n");
printf PLOT ("set key reverse left Left\n");
printf PLOT ("set xlabel \"processors\"\n");
printf PLOT ("set ylabel \"speedup\"\n");
printf PLOT ("plot f(x) = x, f(x) title \"perfect\" \\\n");
# printf PLOT ("plot \\\n");
foreach ( @serializations ) {
$ser = $_;
foreach ( @ibises ) {
$ibis = $_;
$archx = $ibis . "/" . $ser;
if ($archn { $archx } > 0) {
if ( ( $network eq "tcp" && $ibis =~ /(tcp|sun)/ ) ||
( $network ne "tcp" && $ibis !~ /(tcp|sun)/ ) ) {
$name = "plots/plot-$ibis-$ser.data";
printf PLOT " , \'$name\' with linespoints \\\n";
open DATA, ">$name" or die "Cannot open '$name'";
foreach ( @nodes ) {
$node = $_;
$ix = $ibis . "/" . $ser . "@" . $node;
if ( $n { $ix } > 0) {
printf DATA ("%4d %8.3f\n", $node, $data{ $ix });
}
}
close DATA;
}
}
}
}
close PLOT;
}
foreach ( "tcp", "myrinet" ) {
system "gnuplot", "plots/plot-$_.plot";
}