#!/usr/bin/env python3 # import statistics import numpy as np import matplotlib.pylab as plt # sizes = [44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 74, 78, 82, 84] files = ['/home/steve/documents/cudadl-data/multiprocess/controller_{}'.format(x) for x in sizes] # avg_launch_count = [] # for fname in files: launch_counts = [] # with open(fname, 'r') as f: for line in f: if line.startswith('Timing'): data = line.split(':', 1)[-1] launch_counts.append(int(data.split(',')[3].strip())) # # # launch_counts.pop(int(len(launch_counts)/2)-1) launch_counts.pop() # remove the middle and last subproblems # (they correspond to the final subproblems for p and q) # avg_launch_count.append(statistics.mean(launch_counts)) # B = 2**np.array(sizes, dtype='object') # plt.semilogx(B, avg_launch_count, '.-', basex=2) plt.xticks(B) plt.xlabel('B') plt.ylabel('Avg Number of Kernel Launches') plt.show() # plt.loglog(B, avg_launch_count, '.-', basey=2, basex=2) plt.xticks(B) plt.xlabel('B') plt.ylabel('Avg Number of Kernel Launches') plt.show()