34 lines
947 B
Python
Executable file
34 lines
947 B
Python
Executable file
import os
|
|
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
import pandas as pd
|
|
|
|
# IO: This loads the timings for you
|
|
threads, timings = [], []
|
|
for file in os.listdir('timings'):
|
|
with open(f'timings/{file}', 'r') as f:
|
|
n, t = f.read().strip().split(',')
|
|
threads.append(int(n))
|
|
timings.append(float(t))
|
|
threads = np.array(threads)
|
|
timings = np.array(timings)
|
|
dat = {'timings': timings, 'threads': threads}
|
|
|
|
data = pd.DataFrame(dat)
|
|
|
|
averages = data.groupby('threads').aggregate(['mean','std'])
|
|
averages.to_csv('data.csv')
|
|
fig, axs = plt.subplots()
|
|
|
|
# CREATE YOUR PLOT HERE
|
|
# Remember to label your axis
|
|
# Feel free to make it pretty
|
|
means = averages['timings']['mean']
|
|
stds = averages['timings']['std']
|
|
|
|
axs.plot(averages.index, means)
|
|
axs.fill_between(averages.index, means-stds, means+stds, alpha=0.3)
|
|
axs.set_xlabel('Num threads')
|
|
axs.set_ylabel('Time (s)')
|
|
plt.show()
|
|
plt.savefig('threads_v_timings.png', dpi=300)
|