#!/usr/bin/env python #!/bin/env python # # Computers speed up of Streams benchmark results generated by make streams # import os # def process(): import re ff = open('output') data = ff.read() ff.close() hosts = {} triads = {} speedups = {} match = data.split('Number of MPI processes ') for i in match: if i: fields = i.split('\n') size = int(fields[0]) hosts[size] = fields[1:size+1] triads[size] = float(fields[size+5].split()[1]) ff = open('output','a') print 'np speedup' ff.write('np speedup\n') for sizes in hosts: speedups[sizes] = triads[sizes]/triads[1] print sizes,round(triads[sizes]/triads[1],2) ff.write(str(sizes)+' '+str(round(triads[sizes]/triads[1],2))+'\n') ff.close() try: import matplotlib except: print "Unable to open matplotlib to plot speedup" return try: import matplotlib.pyplot as plt except: print "Unable to open matplotlib to plot speedup" return try: plt.title('Perfect and Streams Speedup') plt.plot(hosts.keys(),hosts.keys(),'b-o',hosts.keys(),speedups.values(),'r-o') plt.show() except: print "Unable to display matplotlib to plot speedup" return # # if __name__ == '__main__': import sys process()