throughput.py 813 B

12345678910111213141516171819202122232425262728
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. from mpl_toolkits.axes_grid.axislines import Subplot
  4. gpu_data = np.loadtxt('throughput.gpu')
  5. cpu_data = np.loadtxt('throughput.cpu')
  6. fig = plt.figure(1, (8,4))
  7. ax = Subplot(fig, 111)
  8. fig.add_subplot(ax)
  9. plt.rc('font', **dict(family='serif'))
  10. #plt.figure(figsize=(8, 4))
  11. ax.semilogx(gpu_data[:,0], gpu_data[:,1], '*-', color='#3b5b92', label='GPU Memory')
  12. ax.semilogx(cpu_data[:,0], cpu_data[:,1], 'o-', color='#77DD77', label='Main Memory')
  13. ax.axis["right"].set_visible(False)
  14. ax.axis["top"].set_visible(False)
  15. plt.ylim(0, 7000)
  16. plt.xticks([1e4,1e6,1e8,1e10])
  17. plt.yticks([0,2000,4000,6000])
  18. plt.xlabel('Data size (B)')
  19. plt.ylabel('Throughput (MB/s)')
  20. plt.legend(loc='lower right',frameon=False)
  21. plt.savefig('throughput.pdf', dpi=300, bbox_inches='tight')