2024-08-29 11:19:39 +02:00
|
|
|
import os
|
|
|
|
import numpy as np
|
|
|
|
import matplotlib.pyplot as plt
|
2024-08-30 11:21:26 +02:00
|
|
|
import pdb
|
|
|
|
import glob
|
2024-08-29 11:19:39 +02:00
|
|
|
|
|
|
|
# IO: This loads the timings for you
|
|
|
|
threads, timings = [], []
|
2024-08-30 11:21:26 +02:00
|
|
|
files = os.listdir('timings')
|
|
|
|
files.sort(key= lambda x: int(x.split('_')[0]))
|
|
|
|
for file in files:
|
2024-08-29 11:19:39 +02:00
|
|
|
with open(f'timings/{file}', 'r') as f:
|
2024-08-30 11:21:26 +02:00
|
|
|
if 'None' not in file:
|
|
|
|
n, t = f.read().strip().split(',')
|
|
|
|
threads.append(int(n))
|
|
|
|
timings.append(float(t))
|
2024-08-29 11:19:39 +02:00
|
|
|
threads = np.array(threads)
|
|
|
|
timings = np.array(timings)
|
|
|
|
|
|
|
|
print('This is the data I loaded: threads =', threads, ', timings =',timings)
|
|
|
|
|
|
|
|
fig, axs = plt.subplots()
|
|
|
|
|
|
|
|
# CREATE YOUR PLOT HERE
|
2024-08-30 11:21:26 +02:00
|
|
|
plt.plot(threads, timings, '.--')
|
|
|
|
plt.xlabel('Threads')
|
|
|
|
plt.ylabel('Timings')
|
|
|
|
plt.xscale('log')
|
|
|
|
|
2024-08-29 11:19:39 +02:00
|
|
|
# Remember to label your axis
|
|
|
|
# Feel free to make it pretty
|
|
|
|
|
2024-08-30 11:21:26 +02:00
|
|
|
|
2024-08-29 11:19:39 +02:00
|
|
|
plt.savefig('threads_v_timings.png', dpi=300)
|