12345678910111213141516171819202122232425262728 |
- 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 < 4.5]
- gpu_data = gpu_data[gpu_data < 4.5]
- plt.rc('font', **dict(family='serif'))
- plt.figure(figsize=(6, 4))
- # 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, bins=100, color='#3b5b92', label='GPU')
- plt.hist(cpu_data, bins=100, color='#d54d4d', label='CPU')
- # plt.semilogy()
- plt.xlabel(u'Latency in \u00b5s')
- plt.ylabel('Frequency')
- plt.legend(loc='upper right')
- plt.savefig('latency-hist.pdf', dpi=300, bbox_inches='tight')
|