Datasets:
Download code/evaluation-code/v0.2-0c2690ae/tests/prover_gpu/gpu-check.sh from VEHwang/cocogni4d: direct link, hf CLI and curl.
- Browser
- Download file 6.57 kB
-
https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/tests/prover_gpu/gpu-check.sh
- Command line
-
hf download hf://datasets/VEHwang/cocogni4d/code/evaluation-code/v0.2-0c2690ae/tests/prover_gpu/gpu-check.sh
-
curl -L -o gpu-check.sh https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/tests/prover_gpu/gpu-check.sh
6.57 kB
| # 证明器改动在 GPU 上的检查:超 1 分钟的检查都在这里跑。 | |
| # 用法(作业目录里):bash new/tests/prover_gpu/gpu-check.sh <新代码目录> [<旧代码目录> [<版本,…>]] | |
| # 1 编译 plans.json;2 证明器测试;3 console 出题测试;4 make check;4b 全部版本报错扫描(short-90 和 SCAN_SEGS 里的剧本,每版卡 3 CPU s); | |
| # 5 正倒序比对:short-90 上全部单路版加三个多路版,正序、倒序各一进程,逐版比 packages 和 sampled; | |
| # 6 给了旧代码时,新旧逐版对照:short-90、long-360 × 上限档 CAPS(默认“def 40”:默认上限、族上限压到 40;inf:族和嵌套上限 100 万,等于不抽样,只给 short-90 用,比较题别放进来), | |
| # 全部版本(不给版本时),每份 1/4 版本一个进程;比 [候选, 可发布, 拒绝原因],有不等或新代码没跑完就算没过,旧代码没跑完的单列。 | |
| # 合计 CPU 时间比旧代码慢 20% 以上(再加 1 s)也算没过。 | |
| # 卡时间:每步防卡死墙钟 3600 s,对照每版防卡死 600 s;超时打印 CPU/墙钟,定位诊断。 | |
| # 最后一行是“GPU 检查:通过”或“GPU 检查:没过(哪几步)”。 | |
| set -u | |
| if [ "$#" -lt 1 ] || [ -z "${FIX:-}" ] || [ -z "${GEN_READBACK_CONFIG:-}" ] || [ -z "${PROVER_QUESTIONS_BATCH_ROOT:-}" ]; then | |
| echo "用法:FIX=<剧本根目录> GEN_READBACK_CONFIG=<生成读回配置.json> PROVER_QUESTIONS_BATCH_ROOT=<冻结六段根目录> bash $0 新 [旧 [版本,…]]" >&2 | |
| exit 2 | |
| fi | |
| chk=$(cd "$(dirname "$0")" && pwd) | |
| fix=$FIX | |
| new=$(cd "$1" && pwd); old=${2:+$(cd "$2" && pwd)}; vs=${3:-} | |
| out=${OUT:-$PWD/prover-gpu-out}; mkdir -p "$out"; fail=() # 输出写在作业目录,不写进代码树 | |
| step() { echo "== $*"; } | |
| for d in "$new" ${old:+"$old"}; do | |
| (cd "$d" && python3 -B -m embodied_pipeline.prover.compile >/dev/null) || fail+=("编译 $(basename "$d")") | |
| done | |
| cd "$new" | |
| step 证明器测试 | |
| PROVER_SURFACE_SCRIPT_DIR="$fix/short-90" PYTHONPATH=.:tests/pipeline python3 -B "$chk/../timing.py" --timeout 3600 python3 -B -m unittest discover -s tests/pipeline -p "test_prover_*.py" >"$out/prover.txt" 2>&1 | |
| tail -1 "$out/prover.txt"; tail -1 "$out/prover.txt" | grep -q "^OK" || { fail+=(证明器测试); grep -A12 "^FAIL:\|^ERROR:" "$out/prover.txt" | head -40; } | |
| step console 出题测试 | |
| PROVER_QUESTIONS_SAMPLE=$fix/short-90 PYTHONPATH=.:apps/console/tests python3 -B "$chk/../timing.py" --timeout 3600 python3 -B -m unittest test_prover_questions >"$out/console.txt" 2>&1 | |
| tail -1 "$out/console.txt"; tail -1 "$out/console.txt" | grep -q "^OK" || { fail+=(console); tail -20 "$out/console.txt"; } | |
| step make check | |
| python3 -B "$chk/../timing.py" --timeout 3600 make check >"$out/make.txt" 2>&1 && echo OK || { fail+=("make check"); tail -15 "$out/make.txt"; } | |
| step 生成读回 | |
| # 生成一段、写出、从文件读回安排 happened、观察者 split、facts 门洞表;要房子在盘上,只在这里跑,跳过算没过 | |
| PYTHONPATH=. python3 -B "$chk/../timing.py" --timeout 3600 \ | |
| python3 -B -m unittest tests.pipeline.test_gen_readback >"$out/readback.txt" 2>&1 | |
| tail -1 "$out/readback.txt"; tail -1 "$out/readback.txt" | grep -qx "OK" || { fail+=(生成读回); grep -A12 "^FAIL:\|^ERROR:\|skipped" "$out/readback.txt" | head -30; } | |
| step 正倒序比对 | |
| for o in fwd rev; do | |
| PYTHONPATH=. python3 -B "$chk/../timing.py" --timeout 3600 python3 -B "$chk/order2.py" "$fix/short-90" "$out/ord_$o.json" $o 2>"$out/ord_$o.err" & | |
| done; wait | |
| python3 "$chk/order2.py" --cmp "$out/ord_fwd.json" "$out/ord_rev.json" | tee "$out/ord.txt" | |
| grep -q "不同 0" "$out/ord.txt" || fail+=(正倒序) | |
| step 全部版本报错扫描 | |
| for seg in $fix/short-90 ${SCAN_SEGS:-}; do OUT=$out bash "$chk/err-scan.sh" "$new" "$seg"; done | tee "$out/scan.txt" | grep "^==\|报错" | |
| grep -q "报错" "$out/scan.txt" && fail+=(报错扫描) | |
| grep -q "/4 段跑完" "$out/scan.txt" && ! grep -q ":[0-3]/4 段跑完" "$out/scan.txt" || fail+=(报错扫描没跑完) | |
| if [ -n "$old" ]; then | |
| step 新旧逐版对照 | |
| segs="$fix/short-90 $fix/long-360 ${CMP_SEGS:-}" # short-90、long-360 的主体没有外观标签,按外观找人的取法在上面一行不出;CMP_SEGS 给带标签的语料剧本(10-21 18:28 补) | |
| [ -n "$vs" ] || vs=$(python3 -c "import json; print(','.join(v for v, x in json.load(open('embodied_pipeline/prover/plans.json'))['versions'].items() if not x.get('blocked')))") | |
| chunks=$(python3 -c "import sys; v = sys.argv[1].split(','); n = -(-len(v)//4); print(' '.join(','.join(v[i*n:(i+1)*n]) for i in range(4) if v[i*n:(i+1)*n]))" "$vs") | |
| for side in old new; do | |
| d=$old; [ $side = new ] && d=$new | |
| for p in $segs; do f=$(basename "$p") | |
| for cap in ${CAPS:-def 40}; do | |
| fm=$cap; nm=; [ $cap = def ] && fm=; [ $cap = inf ] && fm=1000000 nm=1000000 | |
| k=0; for c in $chunks; do # 每份 1/4 版本一个进程,每版防卡死 600 s、每进程防卡死 3600 s | |
| (cd "$d" && FAMMAX=$fm NESTMAX=$nm PYTHONPATH=. DUMP_TIMEOUT=600 python3 -B "$chk/../timing.py" --timeout 3600 python3 -B "$chk/dump_runs.py" "$p" "$out/${side}_${f}_${cap}_$k.json" "$c" >"$out/${side}_${f}_${cap}_$k.log" 2>&1) & | |
| k=$((k+1)) | |
| done | |
| done | |
| done | |
| done; wait | |
| for p in $segs; do f=$(basename "$p") | |
| for cap in ${CAPS:-def 40}; do | |
| for side in old new; do | |
| python3 -c "import glob, json, sys; o = {}; [o.update(json.load(open(x))) for x in sorted(glob.glob(sys.argv[1]+'_[0-9].json'))]; json.dump(o, open(sys.argv[1]+'.json', 'w'))" "$out/${side}_${f}_${cap}" | |
| done | |
| python3 "$chk/cmp_runs.py" "$out/old_${f}_$cap.json" "$out/new_${f}_$cap.json" "$f 上限$cap" | tee -a "$out/cmp.txt" | head -6 | |
| done | |
| done | |
| grep -v "不等 0 \[\].*新没跑完 0 " "$out/cmp.txt" | grep -q "^[a-z]" && fail+=(新旧对照) | |
| # CPU 时间不许退步:对照既比结果,也比合计时间。 | |
| # 任一(剧本、档)新合计超过旧合计 ×1.2+1 s 就算没过;拿主线头当旧代码跑,新取法的退步在合进主线前就能看到 | |
| awk '/^[a-z].*旧合计/ {o = $(NF-2); n = $NF; if (n > o*1.2+1) {print "时间退步:" $0; bad = 1}} END {exit !bad}' "$out/cmp.txt" && fail+=(时间退步) | |
| fi | |
| if [ ${#fail[@]} -eq 0 ]; then echo "GPU 检查:通过"; else echo "GPU 检查:没过(${fail[*]})"; fi | |
| [ ${#fail[@]} -eq 0 ] | |