-
Notifications
You must be signed in to change notification settings - Fork 155
chore: refactor Docker runner launch to be like SLURM #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f4c7925
d068894
0a90d87
79c49cf
de78e18
6a38bfb
f2e40ee
272c81d
4d27a9d
5f549dc
a3e7064
cabe362
3020926
142923b
39fdbce
6e10058
710793d
6b844a1
7ed5aa9
fac8864
7c8f5a5
9dd2b14
69991c6
bdb3d39
a2a3db8
f682f09
9eee9fd
a692940
6869b36
b8b6b46
df64d8f
def851c
ad97a0b
284c11f
5ca8d5b
6d300f4
b026d28
9e38f87
ee2105b
9dd3e1a
da39840
ce96ec7
b02b77e
01e8561
c2c6c3c
a56be97
32a0d23
2a085dc
18cf708
3809194
0c75238
6dad972
80b2cbb
227db82
97edfee
b6a80fb
fa1e2c0
a5ebc4a
9ff641e
6eb8285
da48d92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,214 @@ | ||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Shared benchmarking utilities for InferenceMAX | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Wait for server to be ready by polling the health endpoint | ||||||||||||||||||||||||||
| # All parameters are required | ||||||||||||||||||||||||||
| # Parameters: | ||||||||||||||||||||||||||
| # --port: Server port | ||||||||||||||||||||||||||
| # --server-log: Path to server log file | ||||||||||||||||||||||||||
| # --server-pid: Server process ID (required) | ||||||||||||||||||||||||||
| # --sleep-interval: Sleep interval between health checks (optional, default: 5) | ||||||||||||||||||||||||||
| wait_for_server_ready() { | ||||||||||||||||||||||||||
| set +x | ||||||||||||||||||||||||||
| local port="" | ||||||||||||||||||||||||||
| local server_log="" | ||||||||||||||||||||||||||
| local server_pid="" | ||||||||||||||||||||||||||
| local sleep_interval=5 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Parse arguments | ||||||||||||||||||||||||||
| while [[ $# -gt 0 ]]; do | ||||||||||||||||||||||||||
| case $1 in | ||||||||||||||||||||||||||
| --port) | ||||||||||||||||||||||||||
| port="$2" | ||||||||||||||||||||||||||
| shift 2 | ||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||
| --server-log) | ||||||||||||||||||||||||||
| server_log="$2" | ||||||||||||||||||||||||||
| shift 2 | ||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||
| --server-pid) | ||||||||||||||||||||||||||
| server_pid="$2" | ||||||||||||||||||||||||||
| shift 2 | ||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||
| --sleep-interval) | ||||||||||||||||||||||||||
| sleep_interval="$2" | ||||||||||||||||||||||||||
| shift 2 | ||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||
| *) | ||||||||||||||||||||||||||
| echo "Unknown parameter: $1" | ||||||||||||||||||||||||||
| return 1 | ||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||
| esac | ||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Validate required parameters | ||||||||||||||||||||||||||
| if [[ -z "$port" ]]; then | ||||||||||||||||||||||||||
| echo "Error: --port is required" | ||||||||||||||||||||||||||
| return 1 | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| if [[ -z "$server_log" ]]; then | ||||||||||||||||||||||||||
| echo "Error: --server-log is required" | ||||||||||||||||||||||||||
| return 1 | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| if [[ -z "$server_pid" ]]; then | ||||||||||||||||||||||||||
| echo "Error: --server-pid is required" | ||||||||||||||||||||||||||
| return 1 | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Show logs until server is ready | ||||||||||||||||||||||||||
| tail -f "$server_log" & | ||||||||||||||||||||||||||
| local TAIL_PID=$! | ||||||||||||||||||||||||||
| until curl --output /dev/null --silent --fail http://0.0.0.0:$port/health; do | ||||||||||||||||||||||||||
| if ! kill -0 "$server_pid" 2>/dev/null; then | ||||||||||||||||||||||||||
| echo "Server died before becoming healthy. Exiting." | ||||||||||||||||||||||||||
| kill $TAIL_PID | ||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||
|
cquil11 marked this conversation as resolved.
|
||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| sleep "$sleep_interval" | ||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||
| kill $TAIL_PID | ||||||||||||||||||||||||||
|
cquil11 marked this conversation as resolved.
cquil11 marked this conversation as resolved.
Comment on lines
+60
to
+70
|
||||||||||||||||||||||||||
| kill $TAIL_PID | |
| exit 1 | |
| fi | |
| sleep "$sleep_interval" | |
| done | |
| kill $TAIL_PID | |
| kill $TAIL_PID 2>/dev/null || true | |
| exit 1 | |
| fi | |
| sleep "$sleep_interval" | |
| done | |
| kill $TAIL_PID 2>/dev/null || true |
Copilot
AI
Nov 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wait_for_server_ready function disables set -x at line 13 but the run_benchmark_serving function also disables it at line 87. However, neither function re-enables set -x after completing, which could cause inconsistent debug output behavior for code that follows these function calls.
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,11 +1,25 @@ | ||||
| #!/usr/bin/env bash | ||||
|
|
||||
| # === Required Env Vars === | ||||
| # MODEL | ||||
| # PORT | ||||
| # TP | ||||
| # CONC | ||||
| # ISL | ||||
| # OSL | ||||
| # RANDOM_RANGE_RATIO | ||||
| # RESULT_FILENAME | ||||
| # EP_SIZE | ||||
| # NUM_PROMPTS | ||||
|
|
||||
| nvidia-smi | ||||
|
|
||||
| # To improve CI stability, we patch this helper function to prevent a race condition that | ||||
| # happens 1% of the time. ref: https://github.com/flashinfer-ai/flashinfer/pull/1779 | ||||
| sed -i '102,108d' /usr/local/lib/python3.12/dist-packages/flashinfer/jit/cubin_loader.py | ||||
|
|
||||
| SERVER_LOG=$(mktemp /tmp/server-XXXXXX.log) | ||||
|
|
||||
| # Default: recv every ~10 requests; if CONC ≥ 16, relax to ~30 requests between scheduler recv polls. | ||||
| if [[ $CONC -ge 16 ]]; then | ||||
| SCHEDULER_RECV_INTERVAL=30 | ||||
|
|
@@ -22,5 +36,27 @@ PYTHONNOUSERSITE=1 python3 -m sglang.launch_server --model-path $MODEL --host 0. | |||
| --cuda-graph-max-bs 256 --max-running-requests 256 --mem-fraction-static 0.85 --kv-cache-dtype fp8_e4m3 \ | ||||
| --chunked-prefill-size 16384 \ | ||||
| --ep-size $EP_SIZE --quantization modelopt_fp4 --enable-flashinfer-allreduce-fusion --scheduler-recv-interval $SCHEDULER_RECV_INTERVAL \ | ||||
| --enable-symm-mem --disable-radix-cache --attention-backend trtllm_mla --moe-runner-backend flashinfer_trtllm --stream-interval 10 | ||||
| --enable-symm-mem --disable-radix-cache --attention-backend trtllm_mla --moe-runner-backend flashinfer_trtllm --stream-interval 10 > $SERVER_LOG 2>&1 & | ||||
|
|
||||
| SERVER_PID=$! | ||||
|
|
||||
| # Source benchmark utilities | ||||
| source "$(dirname "$0")/benchmark_lib.sh" | ||||
|
|
||||
| # Wait for server to be ready | ||||
| wait_for_server_ready --port "$PORT" --server-log "$SERVER_LOG" --server-pid "$SERVER_PID" | ||||
|
|
||||
| pip install -q datasets pandas | ||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: maybe put the install command in |
||||
|
|
||||
| run_benchmark_serving \ | ||||
| --model "$MODEL" \ | ||||
| --port "$PORT" \ | ||||
| --backend vllm \ | ||||
| --input-len "$ISL" \ | ||||
| --output-len "$OSL" \ | ||||
| --random-range-ratio "$RANDOM_RANGE_RATIO" \ | ||||
| --num-prompts "$NUM_PROMPTS" \ | ||||
| --max-concurrency "$CONC" \ | ||||
| --result-filename "$RESULT_FILENAME" \ | ||||
| --result-dir /workspace/ | ||||
|
|
||||
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states "All parameters are required" but
--sleep-intervalis listed as "(optional, default: 5)" in the parameter list. This is inconsistent. The comment should either say "Parameters (all required unless marked optional):" or the first line should be updated to reflect that not all parameters are required.