summarize_data_multiprocess.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env python3
  2. #
  3. import statistics
  4. import numpy as np
  5. import matplotlib.pylab as plt
  6. #
  7. sizes = [44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 74, 78, 82, 84]
  8. files = ['/home/steve/documents/cudadl-data/multiprocess/controller_{}'.format(x) for x in sizes]
  9. #
  10. avg_launch_count = []
  11. #
  12. for fname in files:
  13. launch_counts = []
  14. #
  15. with open(fname, 'r') as f:
  16. for line in f:
  17. if line.startswith('Timing'):
  18. data = line.split(':', 1)[-1]
  19. launch_counts.append(int(data.split(',')[3].strip()))
  20. #
  21. #
  22. #
  23. launch_counts.pop(int(len(launch_counts)/2)-1)
  24. launch_counts.pop()
  25. # remove the middle and last subproblems
  26. # (they correspond to the final subproblems for p and q)
  27. #
  28. avg_launch_count.append(statistics.mean(launch_counts))
  29. #
  30. B = 2**np.array(sizes, dtype='object')
  31. #
  32. plt.semilogx(B, avg_launch_count, '.-', basex=2)
  33. plt.xticks(B)
  34. plt.xlabel('B')
  35. plt.ylabel('Avg Number of Kernel Launches')
  36. plt.show()
  37. #
  38. plt.loglog(B, avg_launch_count, '.-', basey=2, basex=2)
  39. plt.xticks(B)
  40. plt.xlabel('B')
  41. plt.ylabel('Avg Number of Kernel Launches')
  42. plt.show()