flint / sglang /serve_node_8x.sh
lvmopt's picture
Initial release
2a247be
Raw History Blame Contribute Delete
1.08 kB
#!/usr/bin/env bash
# Eight Flint replicas on one 8-GPU node, one GPU each, on ports BASE_PORT..BASE_PORT+7.
# If one replica exits, all are stopped. Put a router in front of all replicas across nodes (on a
# port outside those ranges), e.g. for 2 nodes:
#
# python3 -m sglang_router.launch_router --host 0.0.0.0 --port 8000 --policy cache_aware \
# --worker-urls http://node0:30000 ... http://node0:30007 http://node1:30000 ... http://node1:30007
#
# MODEL=/path/to/flint BASE_PORT=30000 bash serve_node_8x.sh # Blackwell
# MODEL=/path/to/flint SERVE_SCRIPT=serve_h200.sh bash serve_node_8x.sh # H200
#
# Extra arguments are passed through to every replica's sglang.launch_server.
set -euo pipefail
BASE_PORT="${BASE_PORT:-30000}"
SERVE_SCRIPT="${SERVE_SCRIPT:-serve_b300.sh}"
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
pids=()
for gpu in 0 1 2 3 4 5 6 7; do
CUDA_VISIBLE_DEVICES="$gpu" PORT="$((BASE_PORT + gpu))" bash "$here/$SERVE_SCRIPT" "$@" &
pids+=("$!")
done
trap 'kill "${pids[@]}" 2>/dev/null; wait' EXIT INT TERM
wait -n "${pids[@]}"