1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import sys
- import numpy as np
- import matplotlib.pyplot as plt
- from mpl_toolkits.axes_grid.axislines import Subplot
- c = np.loadtxt('ipecamera2.1024.gpu.txt')
- g = np.loadtxt('ipedirectgma.1024.gpu.txt')
- cpu_data = c[:,1]
- gpu_data = g[:,1]
- cpu_data = cpu_data[cpu_data < 5]
- gpu_data = gpu_data[gpu_data < 5]
- #plt.rc('font', **dict(family='serif'))
- fig = plt.figure(1, (4,3.2))
- ax = Subplot(fig, 111)
- fig.add_subplot(ax)
- cpu_weights = np.ones_like(cpu_data)/float(len(cpu_data))
- gpu_weights = np.ones_like(gpu_data)/float(len(gpu_data))
- # divide by 2 for one-way latency
- # plt.ylim(0.1, 10000)
- # plt.hist(gpu_data, bins=200, label='GPU', log=True)
- # plt.hist(cpu_data, bins=200, label='CPU', log=True)
- ax.hist(gpu_data, weights=gpu_weights, bins=50, color='#3b5b92', label='Setup 1', linewidth=0)
- ax.hist(cpu_data, weights=cpu_weights, bins=50, color='#aec6cf', label='Setup 2', linewidth=0)
- plt.xticks([2.0, 3.0, 4.0, 5.0])
- plt.yticks([0,0.25,0.5])
- ax.axis["right"].set_visible(False)
- ax.axis["top"].set_visible(False)
- # plt.semilogy()
- plt.xlabel(u'Latency in \u00b5s')
- plt.ylabel('Frequency')
- plt.legend(loc='upper right',frameon=False)
- plt.savefig('latency-hist-gpu.pdf', dpi=300, bbox_inches='tight')
|