#!/bin/bash # Runs the whole CTS query list (list-queries.sh) under dawn.node on lavapipe, # split round-robin across N shards (default: one per core) so a slow region # of the suite (texture sampling, say) spreads across shards instead of # landing in one. Each shard runs through run-shard.sh in its own background # process; one hung or crashed query only stalls its own shard. Results land # under results/dawn-node// (gitignored, never committed). # # Resumable as long as shard_count stays the same across runs: the round-robin # assignment is deterministic, so each query lands in the same shard # directory every time, and run-shard.sh skips what that shard already # finished. A different shard_count reassigns queries to new directories and # redoes them; it does not corrupt anything. # # Usage: run-dawn-node.sh [shard_count] set -u SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SHARDS="${1:-$(nproc)}" OUT_ROOT="$SELF_DIR/results/dawn-node" mkdir -p "$OUT_ROOT" "$SELF_DIR/list-queries.sh" > "$OUT_ROOT/queries.txt" total=$(wc -l < "$OUT_ROOT/queries.txt") # Round-robin, not contiguous ranges: query N goes to shard N mod SHARDS. for i in $(seq 0 $((SHARDS - 1))); do id=$(printf '%02d' "$i") mkdir -p "$OUT_ROOT/$id" awk -v n="$SHARDS" -v i="$i" 'NR % n == i' "$OUT_ROOT/queries.txt" > "$OUT_ROOT/$id/queries.txt" done if [ ! -f "$OUT_ROOT/run-manifest.txt" ]; then echo "start=$(date -Is)" > "$OUT_ROOT/run-manifest.txt" fi { echo "total_queries=$total" echo "shards=$SHARDS" } >> "$OUT_ROOT/run-manifest.txt" pids=() for i in $(seq 0 $((SHARDS - 1))); do id=$(printf '%02d' "$i") "$SELF_DIR/run-shard.sh" "$OUT_ROOT/$id" < "$OUT_ROOT/$id/queries.txt" & pids+=("$!") done for pid in "${pids[@]}"; do wait "$pid" done echo "end=$(date -Is)" >> "$OUT_ROOT/run-manifest.txt"