source: branches/reconfiguration/platforms/tsar_generic_iob/scripts/plot_ffstend.py @ 1064

Last change on this file since 1064 was 991, checked in by cfuguet, 8 years ago

reconf: force the python version 2.7 in simulation scripts.

File size: 2.0 KB
Line 
1#!/usr/bin/env python2.7
2# @author Cesar Fuguet <cesar.fuguet-tortolero@lip6.fr>
3# @date   28 August, 2014
4
5import sys
6import matplotlib.pyplot as pyplot
7
8# get statistics file name
9assert len(sys.argv) > 1, "Introduce the stats file"
10filename = sys.argv[1]
11
12clusters = []
13cycles   = []
14
15# parse the ffst stats file
16with 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
52for c in xrange(len(cycles)):
53    pyplot.plot(clusters, cycles[c], label = faultconfigs[c], marker = 'o')
54
55# x axis parameters
56pyplot.xlabel('number of clusters')
57pyplot.xticks(clusters)
58pyplot.xlim(0, max(clusters))
59#pyplot.xticks(xrange(0, 257, 64)
60#pyplot.xscale('log', basex=2, subx=clusters)
61
62# y axis parameters
63pyplot.ylabel('number of cycles')
64
65# show figure with legend and grid
66pyplot.title('Number of Cycles per Mesh Dimensions and Faulty Cores')
67pyplot.legend(loc = 'lower right')
68pyplot.grid()
69pyplot.show()
70
71# vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
Note: See TracBrowser for help on using the repository browser.