]> git.somenet.org - pub/astra/parallel.git/blob - openmp/prefix/parseDat.py
split hillis to hillis_sum and hillis_partial
[pub/astra/parallel.git] / openmp / prefix / parseDat.py
1 #!/usr/bin/env python2
2
3 from optparse import OptionParser
4
5 parser = OptionParser()
6 parser.add_option("-i", "--infile", dest="infilename", help="read unparsed data from FILE", metavar="FILE", default="prefix.pre.dat")
7 parser.add_option("-o", "--outfile", dest="outfilename", help="write parsed data to FILE.alg.dat", metavar="FILE", default="prefix")
8
9 (options, args) = parser.parse_args()
10
11 in_file = open(options.infilename, "r")
12
13 algos = {
14                 'datapar': [],
15                 'hillis_sum': [],
16                 'hillis_partial': [],
17                 'seq': [],
18                 'recurse': []
19                 }
20
21 text = in_file.read()
22 lines = text.split("\n")
23 for line in lines:
24         if line == "":
25                 continue
26         elements = line.split(" ")
27         for elem in elements:
28                 (key, value) = elem.split("=", 1)
29                 if key == 'binname':
30                         (_, prog) = value.split("/", 1)
31                 elif key == 'size':
32                         size = value
33                 elif key == 'time':
34                         time = value
35         algos[prog].append({'size': size, 'time': time})
36
37 in_file.close()
38
39 for key in algos:
40         out_file = open(options.outfilename+"."+key+".dat", "w")
41         for res in algos[key]:
42                 out_file.write(res['size']+";"+res['time']+"\n")
43         out_file.close()
44