updating
This commit is contained in:
29
scripts/build_workloads.sh
Normal file
29
scripts/build_workloads.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
. "$(dirname "$0")/env.sh"
|
||||
|
||||
echo "[build_workloads] Compiling all workloads..."
|
||||
|
||||
# Compile tinyml_kws
|
||||
echo "[build_workloads] Compiling tinyml_kws..."
|
||||
arm-linux-gnueabihf-gcc -O2 -static -o "$RUN/tinyml_kws" \
|
||||
"$(dirname "$0")/../workloads/tinyml_kws.c" -lm
|
||||
|
||||
# Compile sensor_fusion
|
||||
echo "[build_workloads] Compiling sensor_fusion..."
|
||||
arm-linux-gnueabihf-gcc -O2 -static -o "$RUN/sensor_fusion" \
|
||||
"$(dirname "$0")/../workloads/sensor_fusion.c" -lm
|
||||
|
||||
# Compile aes_ccm
|
||||
echo "[build_workloads] Compiling aes_ccm..."
|
||||
arm-linux-gnueabihf-gcc -O2 -static -o "$RUN/aes_ccm" \
|
||||
"$(dirname "$0")/../workloads/aes_ccm.c"
|
||||
|
||||
# Compile attention_kernel
|
||||
echo "[build_workloads] Compiling attention_kernel..."
|
||||
arm-linux-gnueabihf-gcc -O2 -static -o "$RUN/attention_kernel" \
|
||||
"$(dirname "$0")/../workloads/attention_kernel.c" -lm
|
||||
|
||||
echo "[build_workloads] All workloads compiled successfully!"
|
||||
echo "[build_workloads] Binaries created in $RUN/"
|
||||
ls -la "$RUN/"
|
||||
@@ -6,22 +6,34 @@ TE="$LOG_DATA/TERMINAL_EXCERPTS.txt"
|
||||
SE="$LOG_DATA/STATS_EXCERPTS.txt"
|
||||
: > "$TE"; : > "$SE"
|
||||
|
||||
log_count=0
|
||||
for f in "$LOG_DATA"/*.stdout.log; do
|
||||
[ -f "$f" ] || continue
|
||||
log_count=$((log_count + 1))
|
||||
echo "===== $(basename "$f") =====" >> "$TE"
|
||||
(head -n 20 "$f"; echo "..."; tail -n 20 "$f") >> "$TE"
|
||||
echo >> "$TE"
|
||||
done
|
||||
|
||||
if [ $log_count -eq 0 ]; then
|
||||
echo "[bundle] WARNING: No stdout.log files found in $LOG_DATA"
|
||||
fi
|
||||
|
||||
stats_count=0
|
||||
for d in "$OUT_DATA"/*; do
|
||||
[ -d "$d" ] || continue
|
||||
S="$d/stats.txt"
|
||||
[ -f "$S" ] || continue
|
||||
stats_count=$((stats_count + 1))
|
||||
echo "===== $(basename "$d") =====" >> "$SE"
|
||||
awk '/^sim_seconds|^system\.cpu\.ipc|^system\.cpu0\.ipc|^system\.cpu\.numCycles|^system\.cpu0\.numCycles|^system\.cpu\.commit\.committedInsts|^system\.cpu0\.commit\.committedInsts|^system\.l2\.overall_miss_rate::total/' "$S" >> "$SE"
|
||||
echo >> "$SE"
|
||||
done
|
||||
|
||||
if [ $stats_count -eq 0 ]; then
|
||||
echo "[bundle] WARNING: No stats.txt files found in $OUT_DATA"
|
||||
fi
|
||||
|
||||
# mirror to repo
|
||||
cp "$TE" "$LOG_IOT/TERMINAL_EXCERPTS.txt"
|
||||
cp "$SE" "$LOG_IOT/STATS_EXCERPTS.txt"
|
||||
|
||||
@@ -16,6 +16,10 @@ E_MEM_PJ = 600.0
|
||||
DROWSY_SCALE = 0.85
|
||||
|
||||
rows = []
|
||||
if not os.path.exists(src):
|
||||
print(f"[energy] ERROR: Source file {src} does not exist")
|
||||
exit(1)
|
||||
|
||||
with open(src) as f:
|
||||
r = csv.DictReader(f)
|
||||
for row in r:
|
||||
@@ -43,6 +47,10 @@ with open(src) as f:
|
||||
)
|
||||
rows.append(row)
|
||||
|
||||
if not rows:
|
||||
print(f"[energy] ERROR: No data found in {src}")
|
||||
exit(1)
|
||||
|
||||
for path in (dst_data, dst_iot):
|
||||
with open(path, "w", newline="") as f:
|
||||
w = csv.DictWriter(f, fieldnames=list(rows[0].keys()))
|
||||
|
||||
@@ -12,7 +12,7 @@ for d in "$OUT_DATA"/*; do
|
||||
W=$(echo "$base" | cut -d'_' -f1)
|
||||
CORE=$(echo "$base" | cut -d'_' -f2)
|
||||
DVFS=$(echo "$base" | cut -d'_' -f3)
|
||||
L2=$(echo "$base" | sed -E 's/.*_l2([^_]+).*/\1/')
|
||||
L2=$(echo "$base" | sed -E 's/.*l2([^_]+).*/\1/')
|
||||
DROW=$(echo "$base" | sed -E 's/.*_d([01]).*/\1/')
|
||||
S="$d/stats.txt"
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ ap.add_argument("--mem", default="16GB")
|
||||
ap.add_argument("--l2", default="1MB")
|
||||
ap.add_argument("--dvfs", choices=["high","low"], default="high")
|
||||
ap.add_argument("--drowsy", type=int, choices=[0,1], default=0)
|
||||
ap.add_argument("--core", choices=["big","little","hybrid"], default="big")
|
||||
ap.add_argument("--outdir", default="m5out")
|
||||
args = ap.parse_args()
|
||||
|
||||
# -------------------------------
|
||||
@@ -30,12 +32,15 @@ system = System(
|
||||
)
|
||||
|
||||
# -------------------------------
|
||||
# CPU cluster: 1 big + 2 little
|
||||
# CPU cluster: Configure based on core type
|
||||
# -------------------------------
|
||||
big = O3CPU(cpu_id=0)
|
||||
little1 = TimingSimpleCPU(cpu_id=1)
|
||||
little2 = TimingSimpleCPU(cpu_id=2)
|
||||
system.cpu = [big, little1, little2]
|
||||
if args.core == "big":
|
||||
system.cpu = [O3CPU(cpu_id=0)]
|
||||
elif args.core == "little":
|
||||
system.cpu = [TimingSimpleCPU(cpu_id=0)]
|
||||
elif args.core == "hybrid":
|
||||
# 1 big + 1 little
|
||||
system.cpu = [O3CPU(cpu_id=0), TimingSimpleCPU(cpu_id=1)]
|
||||
|
||||
# -------------------------------
|
||||
# Cache hierarchy
|
||||
@@ -80,9 +85,20 @@ proc = Process()
|
||||
proc.executable = args.cmd
|
||||
proc.cmd = [args.cmd]
|
||||
proc.env = {'GLIBC_TUNABLES': 'glibc.pthread.rseq=0'}
|
||||
for c in system.cpu:
|
||||
c.workload = proc
|
||||
c.createThreads()
|
||||
|
||||
# Only assign workload to the first CPU (primary execution)
|
||||
system.cpu[0].workload = proc
|
||||
system.cpu[0].createThreads()
|
||||
|
||||
# Other CPUs remain idle
|
||||
for i in range(1, len(system.cpu)):
|
||||
system.cpu[i].workload = SEWorkload.init_compatible("hello")
|
||||
system.cpu[i].createThreads()
|
||||
|
||||
# -------------------------------
|
||||
# Stats configuration
|
||||
# -------------------------------
|
||||
m5.stats.addStatVisitor(m5.stats.TextStatsVisitor(args.outdir + "/stats.txt"))
|
||||
|
||||
# -------------------------------
|
||||
# Instantiate and simulate
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
cat > /home/carlos/projects/gem5/gem5-run/tinyml_kws << 'SH'
|
||||
#!/bin/bash
|
||||
# placeholder workload; swap later for your real binary
|
||||
for i in $(seq 1 2000000); do :; done
|
||||
echo "tinyml_kws: done"
|
||||
SH
|
||||
chmod +x /home/carlos/projects/gem5/gem5-run/tinyml_kws
|
||||
set -eu
|
||||
. "$(dirname "$0")/env.sh"
|
||||
|
||||
# Compile the actual tinyml_kws workload
|
||||
echo "[tinyml_kws] Compiling workload..."
|
||||
arm-linux-gnueabihf-gcc -O2 -static -o "$RUN/tinyml_kws" \
|
||||
"$(dirname "$0")/../workloads/tinyml_kws.c" -lm
|
||||
|
||||
echo "[tinyml_kws] Binary created at $RUN/tinyml_kws"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user