forked from KULeuven-MICAS/zigzag
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
30 lines (24 loc) · 934 Bytes
/
example.py
File metadata and controls
30 lines (24 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from datetime import datetime
import pickle
from zigzag import api
from zigzag.visualization.results.plot_cme import (
bar_plot_cost_model_evaluations_breakdown,
)
model = "resnet"
workload_path = "zigzag/inputs/workload/resnet18.onnx"
accelerator_path = "zigzag/inputs/hardware/aimc.yaml"
mapping_path = "zigzag/inputs/mapping/default_imc.yaml"
pickle_filename = f"outputs/aimc-{model}-saved_list_of_cmes.pickle"
energy, latency, cmes = api.get_hardware_performance_zigzag(
workload=workload_path,
accelerator=accelerator_path,
mapping=mapping_path,
opt="energy",
dump_folder=f"outputs/{datetime.now()}",
pickle_filename=pickle_filename,
)
print(f"Total network energy = {energy:.2e} pJ")
print(f"Total network latency = {latency:.2e} cycles")
with open(pickle_filename, "rb") as fp:
cmes = pickle.load(fp)
bar_plot_cost_model_evaluations_breakdown(cmes, save_path="outputs/plot_breakdown.png")