You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.2 KiB
Python

import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
import numpy as np
Y = [1100, 2150, 3200, 4250, 5300, 6350, 7400, 8450, 9500]
Y2 = [1100, 2150, 3200, 4250, 5300, 6350, 7400, 8450, 9500]
Y_ARM = [912, 1736 , 2560 , 3352, 4216, 5304 , 5840, 6704, 7464]
Y_ARMO3 = [173, 329, 480, 633, 789, 945, 1098, 1308, 1406]
Y_gcc = [2296, 5119, 6715, 9078, 10830, 12541, 15041, 16780, 18883]
Y_O3 = [165, 287, 380, 559, 900, 901, 776, 1122, 1574]
f_RISCV1 = 50e6
f_RISCV2 = 100e6
f_ARM = 800e6
f_PC = 2400e6
X = []
for i in range(9) :
Y[i] = (Y[i]*1e9)/f_RISCV1
Y2[i] = (Y2[i]*1e9)/f_RISCV2
Y_ARM[i] = (Y_ARM[i]*1e9)/f_ARM
Y_ARMO3[i] = (Y_ARMO3[i]*1e9)/f_ARM
Y_gcc[i] = (Y_gcc[i]*1e9)/f_PC
Y_O3[i] = (Y_O3[i]*1e9)/f_PC
X.append(50*(1+i))
plt.scatter(X, Y, color="b", marker="x", label="RISCV 50 MHz")
plt.scatter(X, Y2, color="g", marker="x", label="RISCV 100 MHz")
plt.scatter(X, Y_ARM, color="b", label="mesures ARM")
plt.scatter(X, Y_ARMO3, color="g", label="mesures ARM -O3")
plt.scatter(X, Y_gcc, color="b",marker="*", label="desktop -O0 2,4Ghz")
plt.scatter(X, Y_O3, color="g", marker="*",label="desktop -O3 2,4Ghz")
x = np.array(X).reshape(-1, 1)
y = np.array(Y).reshape(-1, 1)
y2 = np.array(Y2).reshape(-1, 1)
reg = LinearRegression().fit(x, y)
reg2 = LinearRegression().fit(x, y2)
print("score obtenu : " + str(reg.score(x, y)))
print("score obtenu : " + str(reg.score(x, y2)))
print("attente à zéro : {}".format(reg.intercept_))
print("attente à zéro : {}".format(reg2.intercept_))
x_lin = [0, max(X)]
y_lin = [reg.predict(np.array([0]).reshape(-1, 1)), reg.predict(np.array([x_lin[1]]).reshape(-1, 1))]
y_lin2 = [reg2.predict(np.array([0]).reshape(-1, 1)), reg2.predict(np.array([x_lin[1]]).reshape(-1, 1))]
y_lin = [y_lin[0][0][0], y_lin[1][0][0]]
y_lin2 = [y_lin2[0][0][0], y_lin2[1][0][0]]
# plt.plot(x_lin, y_lin, color = "r", label="RegLin 50 score : {:.4f}".format(reg.score(x, y)))
# plt.plot(x_lin, y_lin2, color = "r")
plt.yscale("log")
plt.xlim([0, 500])
plt.ylim([0, 1000000])
plt.legend()
plt.title("Temps d'exécution en fonction de n_max")
plt.ylabel("T (ns)")
plt.xlabel("N_max")
plt.show()
plt.savefig("M2_SETI/A2/fibonacci/linéaire.png")