Browse Source

SCRIPTS: Added plot of power consumption and 2 core GPU

Added another graph with information about the power consumption of the
benchmarks.

Now the plot script plots also the informations relative to the
benchmark with the secondary GPU (the one with only 2 cores).
Andrea Gus 8 năm trước cách đây
mục cha
commit
d2132ee301
1 tập tin đã thay đổi với 31 bổ sung7 xóa
  1. 31 7
      utils/plot.py

+ 31 - 7
utils/plot.py

@@ -5,8 +5,9 @@ import matplotlib.pyplot as plt
 import matplotlib.patches as mpatches
 
 # Import data from file
-data_cpu = np.genfromtxt('results/cpu/times.dat', dtype=None, delimiter=' ', names=['name', 'time'])
-data_gpu = np.genfromtxt('results/gpu/times.dat', dtype=None, delimiter=' ', names=['name', 'time'])
+data_cpu = np.genfromtxt('results/cpu/total.dat', dtype=None, delimiter=',', names=['name', 'time', 'power'])
+data_gpu_primary = np.genfromtxt('results/gpu-primary/total.dat', dtype=None, delimiter=',', names=['name', 'time', 'power'])
+data_gpu_secondary = np.genfromtxt('results/gpu-secondary/total.dat', dtype=None, delimiter=',', names=['name', 'time', 'power'])
 
 # Generate an array as placeholder for the x axis (we need to pass from a list to an array to take advantage of range)
 x = range(0, 17)
@@ -18,9 +19,11 @@ for elem in data_cpu['name']:
     elem = elem.replace("/OpenCL", "")
     stripped_names.append(elem)
 
-# Create the bar plot
-plt.bar(x, data_cpu['time'], width=0.5, color='b', align='edge')
-plt.bar(x, data_gpu['time'], width=-0.5, color='r', align='center')
+
+# Create the bar plot for the time values
+plt.bar(x, data_cpu['time'], width=0.3, color='b', align='edge')
+plt.bar(x, data_gpu_primary['time'], width=-0.3, color='r', align='center')
+plt.bar(x, data_gpu_secondary['time'], width=-0.3, color='g', align='edge')
 plt.xticks(x, stripped_names)
 plt.title('Execution time of the various benchmarks expressed in seconds')
 plt.xlabel('Benchmark')
@@ -28,9 +31,30 @@ plt.ylabel('seconds')
 
 # Add some patches as legend of the colors used for the various benchmarks
 red_patch = mpatches.Patch(color='blue', label='Execution time for cpu')
+blue_patch = mpatches.Patch(color='red', label='Execution time for gpu(4 core)')
+green_patch = mpatches.Patch(color='green', label='Execution time for gpu(2 core)')
+
+plt.legend(handles=[red_patch, blue_patch, green_patch])
+
+plt.savefig('times.pdf')
+plt.show()
+
 
-blue_patch = mpatches.Patch(color='red', label='Execution time for gpu')
+# Create the bar plot for the power values
+plt.bar(x, data_cpu['power'], width=0.3, color='b', align='edge')
+plt.bar(x, data_gpu_primary['power'], width=-0.3, color='r', align='center')
+plt.bar(x, data_gpu_secondary['power'], width=-0.3, color='g', align='edge')
+plt.xticks(x, stripped_names)
+plt.title('Power consumption of the various benchmarks expressed in Watt/hour')
+plt.xlabel('Benchmark')
+plt.ylabel('Watt/hour')
+
+# Add some patches as legend of the colors used for the various benchmarks
+red_patch = mpatches.Patch(color='blue', label='Power consumption for cpu')
+blue_patch = mpatches.Patch(color='red', label='Power consumption for gpu(4 core)')
+green_patch = mpatches.Patch(color='green', label='Execution time for gpu(2 core)')
 
-plt.legend(handles=[blue_patch, red_patch])
+plt.legend(handles=[red_patch, blue_patch, green_patch])
 
+plt.savefig('power.pdf')
 plt.show()