Skip to content

[Athena] Fix accuracy CI: disable cancel-in-progress #557

[Athena] Fix accuracy CI: disable cancel-in-progress

[Athena] Fix accuracy CI: disable cancel-in-progress #557

name: Accuracy Report
on:
push:
branches: [main]
workflow_dispatch: # Allow manual triggering
concurrency:
group: accuracy-report-${{ github.ref }}
cancel-in-progress: false
jobs:
accuracy-report:
name: Generate Accuracy Report
runs-on: macos-14 # Apple Silicon runner
timeout-minutes: 120 # Extended timeout for PolyBench + EmBench simulations
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Python dependencies
run: |
pip install matplotlib numpy scipy
- name: Install Ginkgo
run: go install github.com/onsi/ginkgo/v2/ginkgo@latest
- name: Run Accuracy Report
run: |
cd benchmarks/native
echo "Starting accuracy report generation at $(date)"
START_TIME=$(date +%s)
# Run with timing and enhanced error reporting
if ! python3 accuracy_report.py; then
END_TIME=$(date +%s)
RUNTIME=$((END_TIME - START_TIME))
echo "❌ Accuracy report failed after ${RUNTIME}s"
echo "Recent system performance metrics:"
echo " - Available memory: $(vm_stat | grep 'free\|active\|inactive' | head -3)"
echo " - CPU load: $(uptime)"
echo "Checking for generated files:"
ls -la accuracy_* || echo "No accuracy files found"
exit 1
fi
END_TIME=$(date +%s)
RUNTIME=$((END_TIME - START_TIME))
echo "✅ Accuracy report completed successfully in ${RUNTIME}s"
- name: Upload Accuracy Report
uses: actions/upload-artifact@v4
with:
name: accuracy-report
path: |
benchmarks/native/accuracy_report.md
benchmarks/native/accuracy_figure.png
benchmarks/native/accuracy_results.json
benchmarks/native/accuracy_normalized.pdf
retention-days: 90
- name: Post Report Summary
if: always()
run: |
echo "## M2Sim Accuracy Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f benchmarks/native/accuracy_results.json ]; then
AVG_ERROR=$(python3 -c "import json; d=json.load(open('benchmarks/native/accuracy_results.json')); print(f\"{d['summary']['average_error']*100:.1f}%\")")
MAX_ERROR=$(python3 -c "import json; d=json.load(open('benchmarks/native/accuracy_results.json')); print(f\"{d['summary']['max_error']*100:.1f}%\")")
echo "- **Average Error:** $AVG_ERROR" >> $GITHUB_STEP_SUMMARY
echo "- **Max Error:** $MAX_ERROR" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "See the uploaded artifacts for the full report and figures." >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ Accuracy report generation failed." >> $GITHUB_STEP_SUMMARY
fi
- name: Commit updated reports to reports branch
if: github.ref == 'refs/heads/main'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Save generated report files to temp directory BEFORE switching branches
# This avoids "local changes would be overwritten" errors
TEMP_REPORTS=$(mktemp -d)
cp benchmarks/native/accuracy_report.md "$TEMP_REPORTS/" 2>/dev/null || true
cp benchmarks/native/accuracy_figure.png "$TEMP_REPORTS/" 2>/dev/null || true
cp benchmarks/native/accuracy_results.json "$TEMP_REPORTS/" 2>/dev/null || true
cp benchmarks/native/accuracy_normalized.pdf "$TEMP_REPORTS/" 2>/dev/null || true
DATE=$(date +%Y-%m-%d)
COMMIT_SHA=$(git rev-parse --short HEAD 2>/dev/null || echo "initial")
# Fetch the reports branch or create it
git fetch origin reports || true
# Stash any local changes before switching branches
git stash --include-untracked || true
if git show-ref --verify --quiet refs/remotes/origin/reports; then
git checkout reports --
git pull origin reports
else
git checkout --orphan reports
git rm -rf . || true
echo "# M2Sim Accuracy Reports" > README.md
echo "" >> README.md
echo "This branch contains historical accuracy reports." >> README.md
git add README.md
fi
# Create dated directory
REPORT_DIR="reports/${DATE}-${COMMIT_SHA}"
mkdir -p "$REPORT_DIR"
# Copy report files from temp directory
cp "$TEMP_REPORTS/accuracy_report.md" "$REPORT_DIR/" 2>/dev/null || true
cp "$TEMP_REPORTS/accuracy_figure.png" "$REPORT_DIR/" 2>/dev/null || true
cp "$TEMP_REPORTS/accuracy_results.json" "$REPORT_DIR/" 2>/dev/null || true
cp "$TEMP_REPORTS/accuracy_normalized.pdf" "$REPORT_DIR/" 2>/dev/null || true
# Clean up temp directory
rm -rf "$TEMP_REPORTS"
# Update index
echo "# M2Sim Accuracy Reports" > README.md
echo "" >> README.md
echo "| Date | Commit | Average Error | Max Error | Report |" >> README.md
echo "|------|--------|---------------|-----------|--------|" >> README.md
for dir in reports/*/; do
if [ -f "${dir}accuracy_results.json" ]; then
DIRNAME=$(basename "$dir")
AVG=$(python3 -c "import json; d=json.load(open('${dir}accuracy_results.json')); print(f\"{d['summary']['average_error']*100:.1f}%\")" 2>/dev/null || echo "N/A")
MAX=$(python3 -c "import json; d=json.load(open('${dir}accuracy_results.json')); print(f\"{d['summary']['max_error']*100:.1f}%\")" 2>/dev/null || echo "N/A")
echo "| ${DIRNAME%-*} | ${DIRNAME##*-} | $AVG | $MAX | [Report](reports/${DIRNAME}/accuracy_report.md) |" >> README.md
fi
done
git add -A
git commit -m "Update accuracy report for ${DATE}" || echo "No changes to commit"
git push origin reports || echo "Failed to push (may need permissions)"