-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph_times.py
28 lines (22 loc) · 888 Bytes
/
graph_times.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pandas as pd
import matplotlib.pyplot as plt
# Load data from CSV files
gpu_data = pd.read_csv('time_gpu.csv', header=None, names=['swarm_size', 'avg_time', 'std_dev'])
cpu_data = pd.read_csv('time_cpu.csv', header=None, names=['swarm_size', 'avg_time', 'std_dev'])
# Create the plot
plt.figure(figsize=(10, 6))
# Plot GPU data
plt.errorbar(gpu_data['swarm_size'], gpu_data['avg_time'], yerr=gpu_data['std_dev'],
fmt='o-', label='GPU', capsize=5, markersize=5, color='blue')
# Plot CPU data
plt.errorbar(cpu_data['swarm_size'], cpu_data['avg_time'], yerr=cpu_data['std_dev'],
fmt='o-', label='CPU', capsize=5, markersize=5, color='orange')
# Add title and labels
plt.title('Performance Comparison: GPU vs CPU')
plt.xlabel('Swarm Size')
plt.ylabel('Average Time (microseconds)')
plt.legend()
plt.grid()
# Show the plot
plt.tight_layout()
plt.show()