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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
#!/usr/bin/perl
#
# Copyright by the Board of Trustees of the University of Illinois.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the files COPYING and Copyright.html. COPYING can be found at the root
# of the source code distribution tree; Copyright.html can be found at the
# root level of an installed copy of the electronic HDF5 document set and
# is linked from the top-level documents page. It can also be found at
# http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have
# access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu.
#
#
# Generates an ASCII and Excel-importable file of tables representing
# the output of running the "pio_perf" command. The name of the input
# file is important. The name should reflect the command-line options
# used in the performance test. It needs to be of the form:
#
# f#[GMK].i#.d#.X#[GMK].x#[GMK]..*
#
# For example:
#
# PIO_output_f1G.i2.d1.X2M.x128K.frost
#
# for a 1GB sized file ran for 2 iterations with 1 dataset from xfer
# buffer size of 128KB to 2MB on the frost machine.
#
# The output file will have the same name as the input, but will append
# ".ascii" for the ASCII file and ".excel" for the Excel-importable
# file.
#
# The data structure used in this program looks like:
#
# %results = {
# num_proc => (
# %xfer_size => (
# %posix = {
# 'write-only' => ##,
# 'write-close' => ##,
# 'read-only' => ##,
# 'read-close' => ##
# },
# %mpio = {
# 'write-only' => ##,
# 'write-close' => ##,
# 'read-only' => ##,
# 'read-close' => ##
# },
# %phdf = {
# 'write-only' => ##,
# 'write-close' => ##,
# 'read-only' => ##,
# 'read-close' => ##
# }
# )
# )
# }
if ($#ARGV != 0) {
print "gen_report.pl [FILE]\n";
exit 1;
}
my ($ascii_output, $excel_output);
foreach my $arg (@ARGV) {
if ($arg !~ /^-/) {
$arg =~ /f([0-9]+.)\.i([0-9]+)\.d([0-9]+)\.X([0-9]+.)\.x([0-9]+.)\.(.*)/;
my $output = "result_f" . $1 . ".X" . $4 . ".x" . $5 . "." . $6;
$ascii_output = $output . ".ascii";
$excel_output = $output . ".excel";
open(INPUT, "<$arg") or die "error: cannot open file $arg: $!\n";
open(ASCII_OUTPUT, ">$ascii_output") or
die "error: cannot open file $ascii_output: $!\n";
open(EXCEL_OUTPUT, ">$excel_output") or
die "error: cannot open file $excel_output: $!\n";
} else {
die "error: unrecognized option: $arg\n";
}
}
my %results;
my $num_procs = 0;
my ($xfer_size, $avg_type, $type);
my $posix = 0, $mpio = 1, $phdf5 = 2;
##"==== End of Parameters ===="
while (<INPUT>) {
if (/Number of processors = ([0-9]+)/) {
$num_procs = $1;
}
if (/Transfer Buffer Size: ([0-9]+)/) {
$xfer_size = $1;
}
$type = $posix if /POSIX/;
$type = $mpio if /MPIO/;
$type = $phdf5 if /PHDF5/;
if (/Write Open/) {
$avg_type = "write-close";
} elsif (/Write/) {
$avg_type = "write-only";
} elsif (/Read Open/) {
$avg_type = "read-close";
} elsif (/Read/) {
$avg_type = "read-only";
}
if (/Maximum Throughput: ( ?[0-9]+\.[0-9]{2}) MB\/s/) {
$results{$num_procs}{$xfer_size}[$type]{$avg_type} = $1;
}
}
sub create_excel_output_header {
my $output_header;
my $kb = 1024;
my $mb = $kb * $kb;
foreach my $key (sort { $a <=> $b } keys(%{$results{$num_procs}})) {
if ($key < $mb) {
$key /= $kb;
$output_header .= "\t". $key . "K";
} else {
$key /= $mb;
$output_header .= "\t". $key . "M";
}
}
$output_header;
}
sub create_excel_output_string {
my ($t) = @_;
my $output_content = "";
foreach my $procs (sort { $b <=> $a } keys(%results)) {
$output_content .= "\n$procs Procs";
$output_content .= "\n" . create_excel_output_header;
$output_content .= "\n POSIX";
foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
$output_content .= "\t$results{$procs}{$xfer}[0]{$t}";
}
$output_content .= "\n MPIO";
foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
$output_content .= "\t$results{$procs}{$xfer}[1]{$t}";
}
$output_content .= "\n PHDF5";
foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
$output_content .= "\t$results{$procs}{$xfer}[2]{$t}";
}
$output_content .= "\n";
}
$output_content;
}
sub is_defined {
my ($t) = @_;
my $def = 1;
foreach my $procs (sort { $b <=> $a } keys(%results)) {
foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
if (!defined($results{$procs}{$xfer}[0]{$t})) {
$def = 0;
}
}
foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
if (!defined($results{$procs}{$xfer}[0]{$t})) {
$def = 0;
}
}
foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
if (!defined($results{$procs}{$xfer}[0]{$t})) {
$def = 0;
}
}
}
$def;
}
sub write_excel_file {
print EXCEL_OUTPUT "\nWrite-Only\n";
print EXCEL_OUTPUT create_excel_output_string("write-only");
print EXCEL_OUTPUT "\nWrite-Close\n";
print EXCEL_OUTPUT create_excel_output_string("write-close");
if (is_defined("read-only")) {
print EXCEL_OUTPUT "\nRead-Only\n";
print EXCEL_OUTPUT create_excel_output_string("read-only");
print EXCEL_OUTPUT "\nRead-Close\n";
print EXCEL_OUTPUT create_excel_output_string("read-close");
}
}
sub create_ascii_output_header {
my $output_header = " " x 12 . "|";
my $kb = 1024;
my $mb = $kb * $kb;
foreach my $key (sort { $a <=> $b } keys(%{$results{$num_procs}})) {
if ($key < $mb) {
$key /= $kb;
$output_header = sprintf("$output_header %-4s |", $key . "K");
} else {
$key /= $mb;
$output_header = sprintf("$output_header %-4s |", $key . "M");
}
}
$output_header;
}
sub create_ascii_output_string {
my ($t) = @_;
my $output_content = "";
my $output_header = create_ascii_output_header;
foreach my $procs (sort { $b <=> $a } keys(%results)) {
$output_content .= "\n$procs Procs";
$output_content .= "\n$output_header\n";
$output_content .= "-" x length($output_header);
$output_content .= "\n POSIX |";
foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
$output_content = sprintf("$output_content %-6s |",
$results{$procs}{$xfer}[0]{$t});
}
$output_content .= "\n ";
$output_content .= "-" x (length($output_header) - 4);
$output_content .= "\n MPI/IO |";
foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
$output_content = sprintf("$output_content %-6s |",
$results{$procs}{$xfer}[1]{$t});
}
$output_content .= "\n ";
$output_content .= "-" x (length($output_header) - 4);
$output_content .= "\n PHDF5 |";
foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
$output_content = sprintf("$output_content %-6s |",
$results{$procs}{$xfer}[2]{$t});
}
$output_content .= "\n";
$output_content .= "=" x length($output_header);
$output_content .= "\n";
}
$output_content;
}
sub write_ascii_file {
print ASCII_OUTPUT "\nWrite-Only";
print ASCII_OUTPUT "\n----------\n";
print ASCII_OUTPUT create_ascii_output_string("write-only");
print ASCII_OUTPUT "\n\nWrite-Close";
print ASCII_OUTPUT "\n-----------\n";
print ASCII_OUTPUT create_ascii_output_string("write-close");
if (is_defined("read-only")) {
print ASCII_OUTPUT "\n\nRead-Only";
print ASCII_OUTPUT "\n---------\n";
print ASCII_OUTPUT create_ascii_output_string("read-only");
print ASCII_OUTPUT "\n\nRead-Close";
print ASCII_OUTPUT "\n----------\n";
print ASCII_OUTPUT create_ascii_output_string("read-close");
}
}
write_excel_file;
write_ascii_file;
|