This commit is contained in:
Carlos Gutierrez
2025-10-04 23:48:44 -04:00
parent 74bb5d9dba
commit 23364fa1f1
5 changed files with 134 additions and 14 deletions

47
scripts/check_gem5.sh Normal file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
set -eu
. "$(dirname "$0")/env.sh"
echo "[check_gem5] Checking gem5 installation..."
# Check if gem5 binary exists
if [ ! -x "$GEM5_BIN" ]; then
echo "[check_gem5] ERROR: gem5 binary not found at $GEM5_BIN"
echo "[check_gem5] You need to install and build gem5 first."
echo ""
echo "To install gem5:"
echo "1. Clone gem5 repository:"
echo " git clone https://github.com/gem5/gem5.git $ROOT/gem5src/gem5"
echo ""
echo "2. Build gem5 for ARM:"
echo " cd $ROOT/gem5src/gem5"
echo " scons build/ARM/gem5.opt -j\$(nproc)"
echo ""
echo "3. Verify the binary exists:"
echo " ls -la $GEM5_BIN"
echo ""
echo "Alternative: Install gem5 via package manager:"
echo " sudo apt-get install gem5 # Ubuntu/Debian"
echo " brew install gem5 # macOS"
exit 1
fi
echo "[check_gem5] ✓ gem5 binary found at $GEM5_BIN"
# Check if gem5 runs
if ! "$GEM5_BIN" --version >/dev/null 2>&1; then
echo "[check_gem5] ERROR: gem5 binary exists but cannot run"
echo "[check_gem5] Try running: $GEM5_BIN --version"
exit 1
fi
echo "[check_gem5] ✓ gem5 binary is executable"
# Check if ARM cross-compiler exists
if ! command -v arm-linux-gnueabihf-gcc >/dev/null 2>&1; then
echo "[check_gem5] WARNING: ARM cross-compiler not found"
echo "[check_gem5] Install with: sudo apt-get install gcc-arm-linux-gnueabihf"
echo "[check_gem5] This is needed to compile workloads for ARM simulation"
fi
echo "[check_gem5] ✓ All checks passed!"

View File

@@ -3,7 +3,7 @@ import csv
import os
root = os.path.dirname(os.path.dirname(__file__))
src = os.path.join(root, "results", "phase3_summary_energy.csv")
src = os.path.join(root, "results", "summary_energy.csv")
dst = os.path.join(root, "results", "phase3_drowsy_deltas.csv")
# group by key without drowsy; compare d0 vs d1

View File

@@ -23,12 +23,20 @@ if not os.path.exists(src):
with open(src) as f:
r = csv.DictReader(f)
for row in r:
insts = float(row["insts"])
secs = float(row["sim_seconds"])
# Handle empty or invalid values
try:
insts = float(row["insts"]) if row["insts"] else 0.0
secs = float(row["sim_seconds"]) if row["sim_seconds"] else 0.0
mr = float(row["l2_miss_rate"]) if row["l2_miss_rate"] else 0.0
except (ValueError, TypeError):
print(f"[energy] WARNING: Invalid data in row: {row}")
insts = 0.0
secs = 0.0
mr = 0.0
core = row["core"]
drowsy = int(row["drowsy"])
drowsy = int(row["drowsy"]) if row["drowsy"] else 0
epi = EPI_PJ.get(core, EPI_PJ["little"])
mr = float(row["l2_miss_rate"]) if row["l2_miss_rate"] else 0.0
l2_misses = mr * insts
energy = (epi * 1e-12) * insts + (E_MEM_PJ * 1e-12) * l2_misses

View File

@@ -16,11 +16,17 @@ for d in "$OUT_DATA"/*; do
DROW=$(echo "$base" | sed -E 's/.*_d([01]).*/\1/')
S="$d/stats.txt"
SIMS=$(awk '/^sim_seconds/ {print $2}' "$S")
IPC=$(awk '/^system\.cpu\.ipc|^system\.cpu0\.ipc/ {print $2}' "$S" | head -n1)
CYC=$(awk '/^system\.cpu\.numCycles|^system\.cpu0\.numCycles/ {print $2}' "$S" | head -n1)
INST=$(awk '/^system\.cpu\.commit\.committedInsts|^system\.cpu0\.commit\.committedInsts/ {print $2}' "$S" | head -n1)
L2MR=$(awk '/^system\.l2\.overall_miss_rate::total/ {print $2}' "$S")
SIMS=$(awk '/^sim_seconds/ {print $2}' "$S" || echo "")
IPC=$(awk '/^system\.cpu\.ipc|^system\.cpu0\.ipc/ {print $2}' "$S" | head -n1 || echo "")
CYC=$(awk '/^system\.cpu\.numCycles|^system\.cpu0\.numCycles/ {print $2}' "$S" | head -n1 || echo "")
INST=$(awk '/^system\.cpu\.commit\.committedInsts|^system\.cpu0\.commit\.committedInsts/ {print $2}' "$S" | head -n1 || echo "")
L2MR=$(awk '/^system\.l2\.overall_miss_rate::total/ {print $2}' "$S" || echo "")
# Check if stats.txt is empty or has no data
if [ ! -s "$S" ] || [ -z "$SIMS" ]; then
echo "[extract] WARNING: Empty or invalid stats.txt in $d"
SIMS="0"; IPC="0"; CYC="0"; INST="0"; L2MR="0"
fi
echo "$W,$CORE,$DVFS,$L2,$DROW,$SIMS,$IPC,$CYC,$INST,$L2MR" >> "$CSV_DATA"
done