1 | #!/usr/bin/python |
---|
2 | # @author Cesar Fuguet <cesar.fuguet-tortolero@lip6.fr> |
---|
3 | # @date 28 August, 2014 |
---|
4 | |
---|
5 | import sys |
---|
6 | import matplotlib.pyplot as pyplot |
---|
7 | |
---|
8 | # get statistics file name |
---|
9 | assert len(sys.argv) > 1, "Introduce the stats file" |
---|
10 | filename = sys.argv[1] |
---|
11 | |
---|
12 | clusters = [] |
---|
13 | cycles = [] |
---|
14 | |
---|
15 | # parse the ffst stats file |
---|
16 | with open(filename, 'r') as filedat: |
---|
17 | # skip comment lines at the beginning of the file |
---|
18 | line = filedat.readline() |
---|
19 | while line[0] == '#': line = filedat.readline() |
---|
20 | |
---|
21 | # get the number of faultconfigs and init cycles array |
---|
22 | nfaultconfigs = int(line) |
---|
23 | for i in xrange(nfaultconfigs): |
---|
24 | cycles.append([]); |
---|
25 | |
---|
26 | # get the name of configurations |
---|
27 | faultconfigs = [] |
---|
28 | for i in xrange(nfaultconfigs): |
---|
29 | line = filedat.readline() |
---|
30 | faultconfigs.append(line.rstrip('\n ')) |
---|
31 | |
---|
32 | # read statistics |
---|
33 | # first column is the number of clusters (X axis) |
---|
34 | # other columns are number of cycles per fault configuration (Y axis) |
---|
35 | line = filedat.readline() |
---|
36 | while line != "": |
---|
37 | partitions = line.split() |
---|
38 | if len(partitions) == 0: |
---|
39 | line = filedat.readline() |
---|
40 | continue |
---|
41 | |
---|
42 | clusters.append(int(partitions[0])) |
---|
43 | for i in xrange(nfaultconfigs): |
---|
44 | if int(partitions[i+1]) == -1: |
---|
45 | cycles[i].append(None) |
---|
46 | else: |
---|
47 | cycles[i].append(int(partitions[i+1])) |
---|
48 | |
---|
49 | line = filedat.readline() |
---|
50 | |
---|
51 | # plot the different configurations |
---|
52 | for c in xrange(len(cycles)): |
---|
53 | pyplot.plot(clusters, cycles[c], label = faultconfigs[c], marker = 'o') |
---|
54 | |
---|
55 | # x axis parameters |
---|
56 | pyplot.xlabel('number of clusters') |
---|
57 | pyplot.xticks(clusters) |
---|
58 | pyplot.xlim(0, max(clusters)) |
---|
59 | #pyplot.xticks(xrange(0, 257, 64) |
---|
60 | #pyplot.xscale('log', basex=2, subx=clusters) |
---|
61 | |
---|
62 | # y axis parameters |
---|
63 | pyplot.ylabel('number of cycles') |
---|
64 | |
---|
65 | # show figure with legend and grid |
---|
66 | pyplot.title('Number of Cycles per Mesh Dimensions and Faulty Cores') |
---|
67 | pyplot.legend(loc = 'lower right') |
---|
68 | pyplot.grid() |
---|
69 | pyplot.show() |
---|
70 | |
---|
71 | # vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab |
---|