feat(reproduce): legacy-test framework + fixed-inlet reproduce pipeline
- Track A (legacy_test): systematic validation scripts for all trained PPO models using LegacyCelerisLab. Each test script rebuilds the exact legacy CFD environment, runs deterministic inference, and compares against SR_analysis reference data using DTW-based comparison. Verified: Karman re100/re50/re200, Vortex lamb/taylor all pass (DTW > 0.95). - Track B (reproduce): Phase 2 open-loop CFD validation + Phase 3 DRL inference using the legacy-compatible config (regularized inlet with neq_damp=1.0, matching the legacy NBB formula). The inlet scheme fix improves new-CFD Karman DTW from 0.916 to 0.943. - Fixes: action_wrapper sign convention docstring, model inventory duplicate entries and missing models, stale config paths in legacy run_all_cases.py/run_illusion_vortex.py, illusion label formatting - Add READMEs and run-all shell scripts for both tracks - Add .gitignore entries for runtime output directories Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+78
@@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
# legacy_test/run_all_legacy_tests.sh
|
||||
#
|
||||
# Sequential launcher for all Track A (Legacy Test) scripts.
|
||||
# Each script uses LegacyCelerisLab which compiles CUDA kernels.
|
||||
# A 60-second delay between tests prevents compilation conflicts.
|
||||
#
|
||||
# Usage:
|
||||
# bash run_all_legacy_tests.sh [DEVICE_ID]
|
||||
# DEVICE_ID defaults to 0 if not provided.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
DEVICE_ID="${1:-0}"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR/../../.." # repo root
|
||||
|
||||
log() { echo "[$(date '+%H:%M:%S')] $*"; }
|
||||
|
||||
CONDA_ENV="pycuda_3_10"
|
||||
DELAY=60
|
||||
|
||||
log "=== Legacy Test: Run All ==="
|
||||
log "Device: $DEVICE_ID, Conda: $CONDA_ENV, Delay: ${DELAY}s"
|
||||
|
||||
# Array of (name, script_path)
|
||||
declare -a TESTS=(
|
||||
"Karman Re100:src/drl_pinball/legacy_test/test_karman_cloak_re100.py"
|
||||
"Steady Cloak:src/drl_pinball/legacy_test/test_steady_cloak.py"
|
||||
"Illusion 1L:src/drl_pinball/legacy_test/test_illusion_1L.py"
|
||||
"Vortex Lamb:src/drl_pinball/legacy_test/test_vortex_lamb.py"
|
||||
"Cross-Re Karman:src/drl_pinball/legacy_test/test_karman_cloak_crossre.py"
|
||||
"Illusion 0.75L/1.5L:src/drl_pinball/legacy_test/test_illusion_remaining.py"
|
||||
"Vortex Taylor:src/drl_pinball/legacy_test/test_vortex_taylor.py"
|
||||
"Erase (experimental):src/drl_pinball/legacy_test/test_erase.py"
|
||||
)
|
||||
|
||||
PASS_COUNT=0
|
||||
FAIL_COUNT=0
|
||||
declare -a FAILED_NAMES=()
|
||||
|
||||
for test_entry in "${TESTS[@]}"; do
|
||||
name="${test_entry%%:*}"
|
||||
script="${test_entry##*:}"
|
||||
|
||||
log ""
|
||||
log "--- $name ---"
|
||||
log "Running: conda run -n $CONDA_ENV python $script --device $DEVICE_ID"
|
||||
|
||||
if conda run -n "$CONDA_ENV" python "$script" --device "$DEVICE_ID"; then
|
||||
log "[PASS] $name"
|
||||
PASS_COUNT=$((PASS_COUNT + 1))
|
||||
else
|
||||
log "[FAIL] $name (exit code $?)"
|
||||
FAIL_COUNT=$((FAIL_COUNT + 1))
|
||||
FAILED_NAMES+=("$name")
|
||||
fi
|
||||
|
||||
# Avoid CUDA compilation conflicts: wait 60s between tests
|
||||
if [[ "$test_entry" != "${TESTS[-1]}" ]]; then
|
||||
log "Waiting ${DELAY}s for CUDA compilation lock to clear..."
|
||||
sleep "$DELAY"
|
||||
fi
|
||||
done
|
||||
|
||||
log ""
|
||||
log "=== Summary ==="
|
||||
log "Passed: $PASS_COUNT / $((PASS_COUNT + FAIL_COUNT))"
|
||||
|
||||
if [[ $FAIL_COUNT -gt 0 ]]; then
|
||||
log "Failed tests:"
|
||||
for fn in "${FAILED_NAMES[@]}"; do
|
||||
log " - $fn"
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "All tests passed."
|
||||
Reference in New Issue
Block a user