First plot script
This commit is contained in:
@@ -4,7 +4,10 @@ from pathlib import Path
|
||||
@dataclass(frozen=True)
|
||||
class Configuration:
|
||||
name: str
|
||||
workload: Path
|
||||
workload: str
|
||||
executable: Path
|
||||
pim: bool
|
||||
level: str
|
||||
frequency: str = "3GHz"
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
||||
@@ -57,7 +57,7 @@ for core in processor.get_cores():
|
||||
workload = CustomWorkload(
|
||||
"set_baremetal_workload",
|
||||
{
|
||||
"kernel": BinaryResource(configuration.workload),
|
||||
"kernel": BinaryResource(configuration.executable),
|
||||
},
|
||||
)
|
||||
board.set_workload(workload)
|
||||
|
||||
35
pim_plots.py
Normal file
35
pim_plots.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
df = pd.read_csv("pim_results.csv")
|
||||
|
||||
frequency_filter = df["frequency"] == "3GHz"
|
||||
|
||||
workloads = df["workload"].unique()
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
|
||||
width = 0.25
|
||||
index = 0
|
||||
|
||||
# for workload in workloads:
|
||||
for level in df["level"].unique():
|
||||
level_filter = df["level"] == level
|
||||
|
||||
for pim in [False, True]:
|
||||
workload_filter = df["workload"] == "vadd"
|
||||
|
||||
filtered_df = df[level_filter & workload_filter & frequency_filter]
|
||||
print(filtered_df)
|
||||
|
||||
x = np.arange(len(filtered_df))
|
||||
|
||||
offset = 6*width * index
|
||||
print(x+offset)
|
||||
bars = ax.bar(x + offset, "ticks", width, data=filtered_df, label=level)
|
||||
# ax.bar_label(bars, padding=2)
|
||||
index += 1
|
||||
|
||||
ax.legend(loc="upper left")
|
||||
plt.show()
|
||||
@@ -3,6 +3,7 @@ import csv
|
||||
import copy
|
||||
import dataclasses
|
||||
import json
|
||||
import pandas as pd
|
||||
|
||||
from threading import Thread
|
||||
from pathlib import Path
|
||||
@@ -35,20 +36,15 @@ class Gem5Thread(Thread):
|
||||
],
|
||||
capture_output=True,
|
||||
)
|
||||
# print(out.stderr)
|
||||
# print(out.stdout)
|
||||
|
||||
output = out.stdout.splitlines()[-1]
|
||||
self.statistics = Statistics(**json.loads(output))
|
||||
|
||||
|
||||
workload_directory = Path("kernels")
|
||||
workload_base_directory = Path("kernels")
|
||||
workload_sub_directory = Path("aarch64-unknown-none/release")
|
||||
|
||||
workloads = [
|
||||
"classic_vadd",
|
||||
"classic_vmul",
|
||||
"classic_haxpy",
|
||||
"classic_gemv",
|
||||
# "classic_gemv_layers",
|
||||
"vadd",
|
||||
"vmul",
|
||||
"haxpy",
|
||||
@@ -59,9 +55,33 @@ workloads = [
|
||||
configurations: list[Configuration] = []
|
||||
|
||||
for frequency in ["3GHz", "100GHz"]:
|
||||
for level in ["X1", "X2", "X3", "X4"]:
|
||||
for pim in [False, True]:
|
||||
for workload in workloads:
|
||||
if workload == "gemv_layers" and level != "X4":
|
||||
continue
|
||||
|
||||
executable = workload
|
||||
|
||||
if pim:
|
||||
executable = f"classic_{workload}"
|
||||
|
||||
executable = (
|
||||
workload_base_directory
|
||||
/ level
|
||||
/ workload_sub_directory
|
||||
/ executable
|
||||
)
|
||||
|
||||
configurations.append(
|
||||
Configuration(workload + "_" + frequency, (workload_directory / workload).as_posix(), frequency)
|
||||
Configuration(
|
||||
f"{workload}_{level}_{frequency}",
|
||||
workload,
|
||||
executable.as_posix(),
|
||||
pim,
|
||||
level,
|
||||
frequency,
|
||||
)
|
||||
)
|
||||
|
||||
threads: list[Gem5Thread] = []
|
||||
@@ -71,6 +91,13 @@ for configuration in configurations:
|
||||
thread.start()
|
||||
threads.append(thread)
|
||||
|
||||
results: list[dict] = []
|
||||
|
||||
for thread in threads:
|
||||
thread.join()
|
||||
print(thread.configuration, thread.statistics)
|
||||
|
||||
result = dataclasses.asdict(thread.configuration) | dataclasses.asdict(thread.statistics)
|
||||
results.append(result)
|
||||
|
||||
dataframe = pd.DataFrame(results)
|
||||
dataframe.to_csv("pim_results.csv", index=False)
|
||||
|
||||
Reference in New Issue
Block a user