import matplotlib.pyplot as plt
#from labellines import labelLines

gflops = [76.8 for i in range(40)]
bandwidth = [11.1647142 * i for i in range(40)]
fig = plt.figure()

plt.plot(gflops, color='red', lw=2, label="peak performance (76.8 GFLOPS/s)")
plt.plot(bandwidth, color='blue', lw=2, label="peak STREAM bandwith (11.16 GB/s)")

x_labels_locations = [1/8 * pow(2, i) for i in range(9)]
x_labels = ["1/8", "1/4", "1/2", "1", "2", "4", "8", "16", "32"]

y_labels = [pow(2, i) for i in range(8)]
y_label_locations = list(range(len(y_labels)))

test_ai = [0.00004299902112]

test_gflops = [0.0000001]

plt.scatter(test_ai, test_gflops)

#plt.ylim(1, 300)
plt.yscale("log")
plt.xscale("log")
plt.xticks(x_labels_locations, x_labels)
plt.yticks(y_labels, y_labels)
plt.xlabel("AI (FLOPs/Byte)")
plt.ylabel("Attainable GFLOPs/s")
plt.legend()
plt.title("Roofline figure for comp on an Intel i7-2760QM")
plt.savefig("roofline.png")
