From 4ea6e92b4232a259ab9c997d16936c2a39003ca5 Mon Sep 17 00:00:00 2001 From: yy-fighting Date: Fri, 10 Jul 2026 02:51:29 +0000 Subject: [PATCH] sglang tp_dp_matrix: fix timeout calling bash function (rc=127) timeout(1) cannot execute shell functions directly; it needs a standalone command. Export run_bench_serving via export -f and wrap both warmup and scenario runs in bash -c so the function is visible in the subshell. --- .../run_bench.sh | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/experiments/dsv4_h200_sglang_tp_dp_matrix/run_bench.sh b/experiments/dsv4_h200_sglang_tp_dp_matrix/run_bench.sh index 09a5e09..2291b8d 100755 --- a/experiments/dsv4_h200_sglang_tp_dp_matrix/run_bench.sh +++ b/experiments/dsv4_h200_sglang_tp_dp_matrix/run_bench.sh @@ -132,26 +132,29 @@ run_bench_serving() { "$PYTHON" -m sglang.bench_serving "$@" fi } +export -f run_bench_serving run_warmup() { local input_len="$1" local output_len="$2" log "warming up (input=${input_len}, output=${output_len}, num=1)" - run_bench_serving \ - --backend sglang \ - --host 127.0.0.1 \ - --port "$SGLANG_PORT" \ - --dataset-name random \ - --dataset-path "$DATASET_PATH" \ - --random-input-len "$input_len" \ - --random-output-len "$output_len" \ - --num-prompts 1 \ - --max-concurrency 1 \ - --request-rate 10000 \ - --output-file /dev/null \ - --output-details \ - >> "${log_dir_global}/warmup.log" 2>&1 + bash -c ' + run_bench_serving \ + --backend sglang \ + --host 127.0.0.1 \ + --port "'"$SGLANG_PORT"'" \ + --dataset-name random \ + --dataset-path "'"$DATASET_PATH"'" \ + --random-input-len "'"$input_len"'" \ + --random-output-len "'"$output_len"'" \ + --num-prompts 1 \ + --max-concurrency 1 \ + --request-rate 10000 \ + --output-file /dev/null \ + --output-details \ + >> "'"${log_dir_global}/warmup.log"'" 2>&1 + ' log "warmup completed" } @@ -415,21 +418,22 @@ run_parallel_config() { gpu_pid="$(start_gpu_monitor "$gpu_csv")" bench_rc=0 - timeout "$SCENARIO_TIMEOUT_S" \ + timeout "$SCENARIO_TIMEOUT_S" bash -c ' run_bench_serving \ --backend sglang \ --host 127.0.0.1 \ - --port "$SGLANG_PORT" \ + --port "'"$SGLANG_PORT"'" \ --dataset-name random \ - --dataset-path "$DATASET_PATH" \ - --random-input-len "$isl" \ - --random-output-len "$dsl" \ - --num-prompts "$num" \ - --max-concurrency "$conc" \ + --dataset-path "'"$DATASET_PATH"'" \ + --random-input-len "'"$isl"'" \ + --random-output-len "'"$dsl"'" \ + --num-prompts "'"$num"'" \ + --max-concurrency "'"$conc"'" \ --request-rate 10000 \ - --output-file "$output_file" \ + --output-file "'"$output_file"'" \ --output-details \ - > "$detail_log" 2>&1 || bench_rc=$? + > "'"$detail_log"'" 2>&1 + ' || bench_rc=$? stop_gpu_monitor "$gpu_pid"