finish lab06

This commit is contained in:
kai
2025-04-26 14:00:55 +02:00
parent fdd1c2b89c
commit b858ec4042
5 changed files with 48 additions and 12 deletions

Binary file not shown.

BIN
lab06/diff.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
lab06/dyn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

36
lab06/plot_scaling.py Normal file
View File

@@ -0,0 +1,36 @@
import json
import math
import matplotlib.pyplot as plt
import pandas
# Path to the benchmark results JSON
plot_diff = "./results/diff_theads.csv"
plot_dyn = "./results/dyn_n.csv"
data_diff = pandas.read_csv(plot_diff)
data_dyn = pandas.read_csv(plot_dyn)
plt.figure(figsize=(8, 5))
plt.plot(
data_diff["threads"],
data_diff["time"],
color="blue",
)
plt.xlabel("threads")
plt.ylabel("time")
plt.grid(True)
plt.tight_layout()
plt.savefig("diff.png")
plt.figure(figsize=(8, 5))
plt.plot(
data_dyn["max_n"],
data_dyn["time"],
color="red",
)
plt.xlabel("n")
plt.ylabel("time")
plt.grid(True)
plt.tight_layout()
plt.savefig("dyn.png")

View File

@@ -1,13 +1,13 @@
threads,max_n,time
1,10000000,374.345
2,10000000,617.139
3,10000000,742.098
4,10000000,839.706
5,10000000,931.158
6,10000000,947.318
7,10000000,995.98
8,10000000,1009.99
9,10000000,1102.99
10,10000000,1072.84
11,10000000,1127.79
12,10000000,1134.81
1,10000000,372.132
2,10000000,597.529
3,10000000,970.832
4,10000000,1073.46
5,10000000,1227.53
6,10000000,1275.92
7,10000000,1373.25
8,10000000,1367.9
9,10000000,1402.15
10,10000000,1471.25
11,10000000,1475.36
12,10000000,1520.45
1 threads max_n time
2 1 10000000 374.345 372.132
3 2 10000000 617.139 597.529
4 3 10000000 742.098 970.832
5 4 10000000 839.706 1073.46
6 5 10000000 931.158 1227.53
7 6 10000000 947.318 1275.92
8 7 10000000 995.98 1373.25
9 8 10000000 1009.99 1367.9
10 9 10000000 1102.99 1402.15
11 10 10000000 1072.84 1471.25
12 11 10000000 1127.79 1475.36
13 12 10000000 1134.81 1520.45