aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / evidence / q36-batch-20261021 / time-batch.sh
| 1 | #!/bin/bash |
| 2 | # L354 timing: N conversations at once (N = 1 2 4 8 16 32, REPS each) against the batch door on <port>, every reply |
| 3 | # greedy and MAX tokens long (prompts.txt, each tagged with a unique "[run r n i]" so no row reuses another's prefix). |
| 4 | # Total tok/s = every reply's completion tokens / wall from the first request out to the last reply in. |
| 5 | # time-batch.sh <port> <label> [max_tokens 128] -> <label>/time.jsonl (one line per N and rep) |
| 6 | set -u |
| 7 | D=$(cd "$(dirname "$0")" && pwd); cd "$D"; PORT=${1:?port}; L=${2:?label}; MAX=${3:-128}; REPS=${REPS:-2} |
| 8 | mapfile -t P < prompts.txt |
| 9 | M=$(curl -s -m 10 http://127.0.0.1:$PORT/v1/models | jq -r '.data[0].id // empty'); [ -n "$M" ] || { echo "no server on $PORT"; exit 2; } |
| 10 | mkdir -p "$L"; : > "$L/time.jsonl" |
| 11 | one() { # <tag> <prompt index> <out> |
| 12 | jq -cn --arg m "$M" --argjson n $MAX --arg c "[$1] ${P[$2]}" '{model:$m, messages:[{role:"user",content:$c}], temperature:0, max_tokens:$n, chat_template_kwargs:{enable_thinking:false}}' \ |
| 13 | | curl -s -m 1800 http://127.0.0.1:$PORT/v1/chat/completions -H 'Content-Type: application/json' -d @- > "$3"; } |
| 14 | one warm 0 "$L/warm.json" |
| 15 | for N in 1 2 4 8 16 32; do for r in $(seq 1 $REPS); do |
| 16 | t0=$(date +%s.%N) |
| 17 | for ((i=0; i<N; i++)); do one "run $r $N $i" $((i % ${#P[@]})) "$L/n$N-r$r-$i.json" & done; wait |
| 18 | t1=$(date +%s.%N) |
| 19 | toks=$(cat "$L"/n$N-r$r-*.json | jq -s '[.[].usage.completion_tokens // 0] | add') |
| 20 | ok=$(cat "$L"/n$N-r$r-*.json | jq -s '[.[] | select(.usage.completion_tokens != null)] | length') |
| 21 | jq -cn --argjson n $N --argjson r $r --argjson toks $toks --argjson ok $ok --arg t0 $t0 --arg t1 $t1 \ |
| 22 | '{n:$n, rep:$r, replies_ok:$ok, completion_tokens:$toks, wall_s:(($t1|tonumber)-($t0|tonumber)), tok_s:($toks/(($t1|tonumber)-($t0|tonumber)))}' | tee -a "$L/time.jsonl" |
| 23 | done; done |