123456789101112131415161718192021222324252627282930313233 |
- import sys
- import numpy as np
- import matplotlib.pyplot as plt
- c = np.loadtxt('ipedirectgma.1024.cpu.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'))
- plt.figure(figsize=(4, 4.2))
- 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)
- plt.hist(gpu_data, weights=gpu_weights, bins=50, color='#3b5b92', label='GPU', linewidth=0)
- plt.hist(cpu_data, weights=cpu_weights, bins=50, color='#d54d4d', label='CPU', linewidth=0)
- plt.xticks([2.0, 3.0, 4.0, 5.0])
- plt.yticks([0,0.25,0.5])
- # plt.semilogy()
- plt.xlabel(u'Latency in \u00b5s')
- plt.ylabel('Frequency')
- plt.legend(loc='upper right',frameon=False)
- plt.savefig('latency-hist.pdf', dpi=300, bbox_inches='tight')
|