Skip to content

Conversation

zerollzeng
Copy link
Contributor

@zerollzeng zerollzeng commented Sep 19, 2025

Summary by CodeRabbit

  • New Features

    • Added optional NVIDIA SA benchmarking pathway with streaming support and richer metrics (TTFT, TPOT, ITL, E2EL).
    • Introduced configurable CUDA graph settings and postprocess worker count for generation.
    • Enhanced profiling toggle (NSYS) and safer process cleanup.
  • Refactor

    • Reworked SLURM benchmarking workflow to be argument-driven with improved logging, validation, and error handling.
    • Unified worker/server orchestration and parallelism-aware configuration.
  • Documentation

    • Expanded benchmark and submission guides with configuration sections, dual benchmarking modes, workflow steps, and usage examples.

Description

This PR does following things:

  1. Update latest benchmark script we use.
  2. Integrate NV SA benchmark scripts, this can be enable by set USE_NV_SA_BENCHMARK=true in submit.sh. This PR didn't integrate the SA scripts to the code base, instead we fetch the latest script and use it.
  3. Refactor and optimize many place, like move configuration to submit.sh. and add various check to exit quickly when error occurs.
  4. Log improvement.
  5. Other enhancement I see during refactor.

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@zerollzeng
Copy link
Contributor Author

/bot run

@zerollzeng zerollzeng force-pushed the update-benchmark-script branch from b11c881 to 39976c4 Compare September 19, 2025 06:38
@zerollzeng zerollzeng changed the title [None] Update benchmark script [None][Chore] Update benchmark script Sep 19, 2025
@zerollzeng zerollzeng changed the title [None][Chore] Update benchmark script [None][chore] Update benchmark script Sep 19, 2025
@zerollzeng zerollzeng force-pushed the update-benchmark-script branch 2 times, most recently from d696c96 to 4cbdad9 Compare September 19, 2025 08:06
@zerollzeng
Copy link
Contributor Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19326 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19326 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #14512 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

Copy link
Member

@kaiyux kaiyux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zerollzeng Can we make sure that @qiaoxj07 's numbers can be reproduced by using the scripts before the merge? Thanks

@zerollzeng zerollzeng force-pushed the update-benchmark-script branch from 4cbdad9 to 3f4a87f Compare September 22, 2025 08:20
@zerollzeng
Copy link
Contributor Author

zerollzeng commented Sep 22, 2025

@kaiyux @qiaoxj07 FYI I did a perf verification and I can repro xianjie's perf number for both of 1k-1k and 8k1k cases.

@zerollzeng
Copy link
Contributor Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19660 [ run ] triggered by Bot

@kaiyux
Copy link
Member

kaiyux commented Sep 23, 2025

/bot kill

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19672 [ kill ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19660 [ run ] completed with state ABORTED
LLM/main/L0_MergeRequest_PR #14795 (Blue Ocean) completed with status: ABORTED

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19672 [ kill ] completed with state SUCCESS
Successfully killed previous jobs for commit 3f4a87f

Copy link
Contributor

coderabbitai bot commented Sep 23, 2025

📝 Walkthrough

Walkthrough

Refactors the disaggregated SLURM benchmarking workflow to an argument-driven, configurable system with enhanced error handling, dual benchmarking paths (default and NVIDIA SA), updated worker config generation, and revised submit scripts. Adds a new NVIDIA SA benchmark script and updates wide-EP submission scripts. README is expanded accordingly.

Changes

Cohort / File(s) Summary
Disaggregated SLURM benchmark workflow
examples/disaggregated/slurm/benchmark/disaggr_torch.slurm, examples/disaggregated/slurm/benchmark/run_benchmark.sh, examples/disaggregated/slurm/benchmark/run_benchmark_nv_sa.sh, examples/disaggregated/slurm/benchmark/start_worker.sh, examples/disaggregated/slurm/benchmark/submit.sh, examples/disaggregated/slurm/benchmark/gen_worker_config.py
Major control-flow rewrite to parameterized orchestration; added robust logging/cleanup; conditional container build/install; per-role worker/server config generation with seq offsets; start order clarified; supports default vs NVIDIA SA benchmarking; argument/interface renames; improved log parsing and result handling; NSYS flag handling updated; gen config adds cuda graph settings and postprocess workers; new NV SA benchmark script introduced.
Wide-EP submission scripts
examples/wide_ep/slurm_scripts/submit_e2e.sh, examples/wide_ep/slurm_scripts/submit_gen_only.sh
Replaced hard-coded loops with configurable submission via helper functions (calc_nodes, run_single), validations, centralized parameters, optional reservations, and clearer sbatch argument passing.
Documentation
examples/disaggregated/slurm/benchmark/README.md
Expanded docs to reflect dual server roles, tensor/pipeline parallelism, parameterized submit flow, profiling options, and dual benchmark paths including new run_benchmark_nv_sa.sh.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant submit.sh
  participant SLURM as SLURM Scheduler
  participant Job as disaggr_torch.slurm
  participant Ctr as Container
  participant Cfg as gen_worker_config.py
  participant Ctx as Context Workers
  participant Gen as Generation Workers
  participant Srv as Server
  participant BM as Benchmark (default/NV SA)

  User->>submit.sh: Configure params and run
  submit.sh->>SLURM: sbatch with computed args
  SLURM-->>Job: Launch job
  Job->>Ctr: Start container
  alt build/install TRT-LLM
    Job->>Ctr: Build and install (conditional)
  end
  Job->>Cfg: Generate per-role configs (seq_offset, gpu fracs)
  Job->>Ctx: Start context workers
  Job->>Gen: Start generation workers
  Job->>Srv: Start server
  alt use NV SA benchmark
    Job->>BM: run_benchmark_nv_sa.sh
  else default benchmark
    Job->>BM: run_benchmark.sh
  end
  BM-->>Job: Results and logs
  Job->>Job: Cleanup/teardown (on success/error)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • Tabrizian
  • chzblych
  • QiJune
  • kaiyux

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[None][chore] Update benchmark script" follows the repository template and concisely summarizes the primary change (benchmark script updates/refactor). It directly matches the changes in multiple benchmark-related scripts and README updates, so it is clear and on-topic for teammates scanning history.
Description Check ✅ Passed The PR description includes an @coderabbitai summary and a clear Description that explains the main changes (NV SA benchmark integration, refactor, logging and configuration moves) which align with the diffs, but the Test Coverage section is empty and there are no explicit reproduction/validation steps or details on how the external NV SA scripts are fetched and validated. Overall the description is mostly complete and on-topic, so it meets the repository's expectations aside from missing test/repro details.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
examples/disaggregated/slurm/benchmark/gen_worker_config.py (1)

1-1: Add NVIDIA Apache-2.0 header (2025) to comply with repo standards.

All source files (.py) must include the NVIDIA Apache-2.0 header.

Apply:

+# Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 import argparse
🧹 Nitpick comments (19)
examples/disaggregated/slurm/benchmark/gen_worker_config.py (1)

25-49: Fix docstring: argument names/descriptions don’t match the function signature.

Current docstring references non-existent params (e.g., config_path, model_path, num_ctx_servers).

Suggested replacement:

-    """
-    Generate configuration YAML file for disaggregated inference.
-
-    Args:
-        config_path: Path to save the config file
-        model_path: Path to the model
-        num_ctx_servers: Number of context servers
-        ctx_tp_size: Tensor parallel size for context servers
-        ctx_pp_size: Pipeline parallel size for context servers
-        ctx_batch_size: Batch size for context servers
-        ctx_max_num_tokens: Max number of tokens for context servers
-        ctx_max_seq_len: Max sequence length for context servers
-        ctx_free_gpu_memory_fraction: Free GPU memory fraction for context servers
-        ctx_enable_attention_dp: Enable attention DP for context servers
-        num_gen_servers: Number of generation servers
-        gen_tp_size: Tensor parallel size for generation servers
-        gen_pp_size: Pipeline parallel size for generation servers
-        gen_batch_size: Batch size for generation servers
-        gen_max_num_tokens: Max number of tokens for generation servers
-        gen_enable_attention_dp: Enable attention DP for generation servers
-        gen_gpu_memory_fraction: GPU memory fraction for generation servers
-        eplb_num_slots: Number of slots for eplb
-        worker_start_port: Start port for workers
-        server_port: Server port
-    """
+    """
+    Generate ctx/gen worker config YAMLs for disaggregated inference.
+
+    Args:
+        work_dir: Directory to write ctx_config.yaml and gen_config.yaml.
+        ctx_tp_size: Tensor parallel size for context workers.
+        ctx_pp_size: Pipeline parallel size for context workers.
+        ctx_batch_size: Max batch size for context workers.
+        ctx_max_num_tokens: Max tokens per request for context workers.
+        ctx_max_seq_len: Max sequence length for context workers.
+        ctx_free_gpu_memory_fraction: Fraction of GPU mem for KV cache (ctx).
+        ctx_enable_attention_dp: Whether to enable attention DP (ctx).
+        gen_tp_size: Tensor parallel size for generation workers.
+        gen_pp_size: Pipeline parallel size for generation workers.
+        gen_batch_size: Max batch size for generation workers.
+        gen_max_num_tokens: Max tokens per request for generation workers.
+        gen_max_seq_len: Max sequence length for generation workers.
+        gen_enable_attention_dp: Whether to enable attention DP (gen).
+        gen_gpu_memory_fraction: Fraction of GPU mem for KV cache (gen).
+        eplb_num_slots: MoE load balancer num slots (0 to disable).
+        mtp_size: MTP next-n predict layers (0 to disable).
+        cache_transceiver_max_num_tokens: Max tokens in cache transceiver buffer.
+    """
examples/wide_ep/slurm_scripts/submit_e2e.sh (1)

96-101: Avoid SC2155: declare and assign separately to preserve exit status under set -e.

Prevents masking command failures when using local with command substitution.

-    local gen_nodes=$(calc_nodes "$gen_tp_size" "$gen_num")
-    local ctx_nodes=$(calc_nodes "$ctx_tp_size" "$ctx_num")
-    local total_nodes=$((ctx_nodes + gen_nodes))
-    local total_tasks=$((total_nodes * gpus_per_node))
+    local gen_nodes
+    gen_nodes=$(calc_nodes "$gen_tp_size" "$gen_num")
+    local ctx_nodes
+    ctx_nodes=$(calc_nodes "$ctx_tp_size" "$ctx_num")
+    local total_nodes
+    total_nodes=$((ctx_nodes + gen_nodes))
+    local total_tasks
+    total_tasks=$((total_nodes * gpus_per_node))
examples/wide_ep/slurm_scripts/submit_gen_only.sh (1)

96-101: Avoid SC2155: declare and assign separately to preserve exit status under set -e.

Same pattern as submit_e2e.sh.

-    local gen_nodes=$(calc_nodes "$gen_tp_size" "$gen_num")
-    local ctx_nodes=$(calc_nodes "$ctx_tp_size" "$ctx_num")
-    local total_nodes=$((ctx_nodes + gen_nodes))
-    local total_tasks=$((total_nodes * gpus_per_node))
+    local gen_nodes
+    gen_nodes=$(calc_nodes "$gen_tp_size" "$gen_num")
+    local ctx_nodes
+    ctx_nodes=$(calc_nodes "$ctx_tp_size" "$ctx_num")
+    local total_nodes
+    total_nodes=$((ctx_nodes + gen_nodes))
+    local total_tasks
+    total_tasks=$((total_nodes * gpus_per_node))
examples/disaggregated/slurm/benchmark/start_worker.sh (1)

62-62: Quote $(hostname) to avoid word splitting.

Minor robustness improvement.

-    trtllm-llmapi-launch ${numa_bind_cmd} trtllm-serve ${model_path} --host $(hostname) --port ${port} --extra_llm_api_options ${config_file}
+    trtllm-llmapi-launch ${numa_bind_cmd} trtllm-serve ${model_path} --host "$(hostname)" --port ${port} --extra_llm_api_options ${config_file}
@@
-            --host $(hostname) --port ${port} \
+            --host "$(hostname)" --port ${port} \

Also applies to: 77-78

examples/disaggregated/slurm/benchmark/submit.sh (2)

95-101: Avoid SC2155: declare and assign separately to preserve exit status under set -e.

Same pattern as other submit scripts.

-    local gen_nodes=$(calc_nodes "$gen_tp_size" "$gen_num")
-    local ctx_nodes=$(calc_nodes "$ctx_tp_size" "$ctx_num")
-    local total_nodes=$((ctx_nodes + gen_nodes))
-    local total_tasks=$((total_nodes * gpus_per_node))
+    local gen_nodes
+    gen_nodes=$(calc_nodes "$gen_tp_size" "$gen_num")
+    local ctx_nodes
+    ctx_nodes=$(calc_nodes "$ctx_tp_size" "$ctx_num")
+    local total_nodes
+    total_nodes=$((ctx_nodes + gen_nodes))
+    local total_tasks
+    total_tasks=$((total_nodes * gpus_per_node))

60-64: Add validation for trtllm_repo path.

Consistent with other required path checks.

 [[ ! -d "${model_path}" ]] && { echo "Error: model_path not found: ${model_path}" >&2; exit 1; }
-[[ ! -d "${work_dir}" ]] && { echo "Error: work_dir '${work_dir}' not found" >&2; exit 1; }
+[[ ! -d "${work_dir}" ]] && { echo "Error: work_dir '${work_dir}' not found" >&2; exit 1; }
+[[ ! -d "${trtllm_repo}" ]] && { echo "Error: trtllm_repo '${trtllm_repo}' not found" >&2; exit 1; }
 [[ ! -f "${dataset_file}" ]] && { echo "Error: dataset_file '${dataset_file}' not found" >&2; exit 1; }
examples/disaggregated/slurm/benchmark/run_benchmark_nv_sa.sh (4)

51-60: Avoid SC2155: declare and assign separately for start_time/elapsed.

Ensures errors in command substitution propagate under set -e.

-    local start_time=$(date +%s)
+    local start_time
+    start_time=$(date +%s)
@@
-        local elapsed=$(($(date +%s) - start_time))
+        local elapsed
+        elapsed=$(($(date +%s) - start_time))

67-73: Health check does not validate HTTP 200; it only checks curl exit status.

May proceed on non-200 responses.

-    while ! curl -s -o /dev/null -w "%{http_code}" "http://${host}:${port}/health"; do
-        local elapsed=$(($(date +%s) - start_time))
+    while :; do
+        local code
+        code=$(curl -s -o /dev/null -w "%{http_code}" "http://${host}:${port}/health" || echo 000)
+        local elapsed
+        elapsed=$(($(date +%s) - start_time))
+        [[ "${code}" == "200" ]] && break
         [[ $elapsed -ge $TIMEOUT ]] && { echo "Error: Server not healthy after ${TIMEOUT} seconds"; exit 1; }
         [[ $((elapsed % STATUS_UPDATE_INTERVAL)) -eq 0 ]] && echo "Waiting for server... (${elapsed}s elapsed)"
         sleep $HEALTH_CHECK_INTERVAL
-    done
+    done

143-143: Avoid SC2046 in optional flag injection; prefer explicit conditional.

Safer to append the flag conditionally than rely on command substitution.

Example:

args=(
  --model "${model_name}"
  --host "${hostname}"
  --port "${port}"
  --dataset-name random
  --num-prompts "${num_prompts}"
  --max-concurrency "${concurrency}"
  --ignore-eos
  --random-input-len "${input_seq_len}"
  --random-output-len "${output_seq_len}"
  --random-range-ratio "${ratio}"
  --save-result
  --use-chat-template
  --result-dir "${output_dir}"
  --result-filename "result.json"
  --percentile-metrics "ttft,tpot,itl,e2el"
)
[ "${streaming}" = "false" ] && args+=( --non-streaming )
python "${BENCH_SCRIPT}" "${args[@]}"

83-89: Unused function do_get_logs; consider removing to reduce noise.

It’s defined but never called.

examples/disaggregated/slurm/benchmark/run_benchmark.sh (4)

23-27: Guard SLURM_PROCID under set -u to avoid unbound variable outside SLURM.

Safer default.

-if [[ ${SLURM_PROCID} != "0" ]]; then
+if [[ ${SLURM_PROCID:-0} != "0" ]]; then

59-71: Health check does not validate HTTP 200; it only checks curl exit status.

Mirror the fix as in NV SA script.

-while ! curl -s -o /dev/null -w "%{http_code}" http://${hostname}:${port}/health; do
+while :; do
+    code=$(curl -s -o /dev/null -w "%{http_code}" "http://${hostname}:${port}/health" || echo 000)
     current_time=$(date +%s)
     elapsed=$((current_time - start_time))
-    if [ $elapsed -ge $timeout ]; then
+    if [ "$code" = "200" ]; then
+        break
+    fi
+    if [ $elapsed -ge $timeout ]; then
         echo "Error: Server is not healthy after ${timeout} seconds"
         exit 1
     fi
     if [ $((elapsed % 30)) -eq 0 ]; then
         echo "Waiting for server to be healthy... (${elapsed}s elapsed)"
     fi
     sleep 10
 done

122-122: Avoid SC2046 in optional flag injection.

Prefer explicit conditional to append --non-streaming.

-        $(if [ "${streaming}" = "false" ]; then echo "--non-streaming"; fi)
+        $(if [ "${streaming}" = "false" ]; then echo "--non-streaming"; fi)

Follow-up: Replace the above with an args array approach as shown in the NV SA comment, or split into two python invocations guarded by an if.


132-135: Use pkill/pgrep instead of parsing ps output; also quote expansions.

Simplifies and avoids SC2046 issues.

-kill -9 $(ps aux | grep '[s]tart_server.sh' | awk '{print $2}') >/dev/null 2>&1 || true
-kill -9 $(ps aux | grep '[s]tart_worker.sh' | awk '{print $2}') >/dev/null 2>&1 || true
-kill -9 $(ps aux | grep '[t]rtllm-serve' | awk '{print $2}') >/dev/null 2>&1 || true
+pkill -9 -f 'start_server.sh' >/dev/null 2>&1 || true
+pkill -9 -f 'start_worker.sh' >/dev/null 2>&1 || true
+pkill -9 -f 'trtllm-serve'    >/dev/null 2>&1 || true
examples/disaggregated/slurm/benchmark/README.md (2)

44-51: Align variable names with scripts (mount_dir vs container_mount).

Docs use mount_dir; scripts use container_mount. Unify to avoid confusion.


70-105: disaggr_torch.slurm argument list seems outdated.

Scripts pass seq_offset, numa_bind, and benchmark_mode after nsys_on; these aren’t documented here.

Update the list to include:

  • seq_offset
  • numa_bind
  • benchmark_mode
    …in the correct order after nsys_on.
examples/disaggregated/slurm/benchmark/disaggr_torch.slurm (3)

110-118: Consider adding retry logic for container startup

Container startup can occasionally fail due to transient issues. Consider implementing retry logic with exponential backoff to improve reliability.

 # Start container
 echo "Starting container..."
-if ! srun -l --container-image=${container_image} \
-        --container-name=${container_name} \
-        --container-mounts=${container_mount} \
-        --mpi=pmix \
-        echo "Container up." &> ${full_logdir}/container_launch.log; then
-    cleanup_on_failure "Failed to start container. Check ${full_logdir}/container_launch.log"
-fi
+max_retries=3
+retry_count=0
+while [ $retry_count -lt $max_retries ]; do
+    if srun -l --container-image=${container_image} \
+            --container-name=${container_name} \
+            --container-mounts=${container_mount} \
+            --mpi=pmix \
+            echo "Container up." &> ${full_logdir}/container_launch.log; then
+        break
+    fi
+    retry_count=$((retry_count + 1))
+    if [ $retry_count -eq $max_retries ]; then
+        cleanup_on_failure "Failed to start container after $max_retries attempts. Check ${full_logdir}/container_launch.log"
+    fi
+    echo "Container startup failed. Retrying in 5 seconds... (attempt $((retry_count + 1))/$max_retries)"
+    sleep 5
+done

205-232: Consider adding worker health checks before proceeding

After starting workers, it would be prudent to verify they're ready before starting the benchmark to avoid race conditions.

Add a health check loop after starting all workers:

 done
 
+# Wait for workers to be ready
+echo "Waiting for workers to initialize..."
+max_wait=60
+elapsed=0
+while [ $elapsed -lt $max_wait ]; do
+    # Check if log files contain expected initialization messages
+    gen_ready=true
+    ctx_ready=true
+    
+    for i in $(seq 0 $((num_gen_servers - 1))); do
+        if ! grep -q "Worker ready" ${full_logdir}/output_gen_${i}.log 2>/dev/null; then
+            gen_ready=false
+            break
+        fi
+    done
+    
+    for i in $(seq 0 $((num_ctx_servers - 1))); do
+        if ! grep -q "Worker ready" ${full_logdir}/output_ctx_${i}.log 2>/dev/null; then
+            ctx_ready=false
+            break
+        fi
+    done
+    
+    if [ "$gen_ready" = true ] && [ "$ctx_ready" = true ]; then
+        echo "All workers ready"
+        break
+    fi
+    
+    sleep 2
+    elapsed=$((elapsed + 2))
+done
+
+if [ $elapsed -ge $max_wait ]; then
+    echo "Warning: Workers may not be fully initialized after ${max_wait} seconds"
+fi
+
 # start the server

269-270: Add graceful shutdown with timeout

The script ends with an immediate job cancellation. Consider adding a graceful shutdown mechanism.

-# try to kill the server and workers
-scancel ${SLURM_JOB_ID}
+# Graceful shutdown
+echo "Initiating graceful shutdown..."
+
+# Send SIGTERM to allow graceful shutdown
+pkill -TERM -f "start_worker.sh" || true
+pkill -TERM -f "start_server.sh" || true
+
+# Wait briefly for graceful shutdown
+sleep 5
+
+# Force kill if still running
+pkill -KILL -f "start_worker.sh" || true
+pkill -KILL -f "start_server.sh" || true
+
+# Cancel SLURM job
+scancel ${SLURM_JOB_ID}
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d330d00 and b5f9920.

📒 Files selected for processing (9)
  • examples/disaggregated/slurm/benchmark/README.md (4 hunks)
  • examples/disaggregated/slurm/benchmark/disaggr_torch.slurm (3 hunks)
  • examples/disaggregated/slurm/benchmark/gen_worker_config.py (2 hunks)
  • examples/disaggregated/slurm/benchmark/run_benchmark.sh (2 hunks)
  • examples/disaggregated/slurm/benchmark/run_benchmark_nv_sa.sh (1 hunks)
  • examples/disaggregated/slurm/benchmark/start_worker.sh (2 hunks)
  • examples/disaggregated/slurm/benchmark/submit.sh (1 hunks)
  • examples/wide_ep/slurm_scripts/submit_e2e.sh (1 hunks)
  • examples/wide_ep/slurm_scripts/submit_gen_only.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Use only spaces, no tabs; indent with 4 spaces.

Files:

  • examples/disaggregated/slurm/benchmark/gen_worker_config.py
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+.
Indent Python code with 4 spaces; do not use tabs.
Maintain module namespace when importing; prefer 'from package.subpackage import foo' then 'foo.SomeClass()' instead of importing the class directly.
Python filenames should be snake_case (e.g., some_file.py).
Python classes use PascalCase names.
Functions and methods use snake_case names.
Local variables use snake_case; prefix 'k' for variables that start with a number (e.g., k_99th_percentile).
Global variables use upper SNAKE_CASE prefixed with 'G' (e.g., G_MY_GLOBAL).
Constants use upper SNAKE_CASE (e.g., MY_CONSTANT).
Avoid shadowing variables from an outer scope.
Initialize all externally visible members of a class in the constructor.
Prefer docstrings for interfaces that may be used outside a file; comments for in-function or file-local interfaces.
Use Google-style docstrings for classes and functions (Sphinx-parsable).
Document attributes and variables inline so they render under the class/function docstring.
Avoid reflection when a simpler, explicit approach suffices (e.g., avoid dict(**locals()) patterns).
In try/except, catch the most specific exceptions possible.
For duck-typing try/except, keep the try body minimal and use else for the main logic.

Files:

  • examples/disaggregated/slurm/benchmark/gen_worker_config.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Prepend the NVIDIA Apache-2.0 copyright header with current year to the top of all source files (e.g., .cpp, .h, .cu, .py).

Files:

  • examples/disaggregated/slurm/benchmark/gen_worker_config.py
🪛 Shellcheck (0.11.0)
examples/disaggregated/slurm/benchmark/submit.sh

[warning] 95-95: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 96-96: Declare and assign separately to avoid masking return values.

(SC2155)

examples/wide_ep/slurm_scripts/submit_gen_only.sh

[warning] 97-97: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 98-98: Declare and assign separately to avoid masking return values.

(SC2155)

examples/disaggregated/slurm/benchmark/run_benchmark_nv_sa.sh

[warning] 52-52: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 65-65: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 143-143: Quote this to prevent word splitting.

(SC2046)

examples/disaggregated/slurm/benchmark/run_benchmark.sh

[warning] 122-122: Quote this to prevent word splitting.

(SC2046)


[warning] 132-132: Quote this to prevent word splitting.

(SC2046)


[warning] 133-133: Quote this to prevent word splitting.

(SC2046)


[warning] 134-134: Quote this to prevent word splitting.

(SC2046)

examples/wide_ep/slurm_scripts/submit_e2e.sh

[warning] 97-97: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 98-98: Declare and assign separately to avoid masking return values.

(SC2155)

examples/disaggregated/slurm/benchmark/start_worker.sh

[error] 15-15: Braces are required for positionals over 9, e.g. ${10}.

(SC1037)


[warning] 62-62: Quote this to prevent word splitting.

(SC2046)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (11)
examples/disaggregated/slurm/benchmark/gen_worker_config.py (1)

231-236: Default mismatch for cache_transceiver_max_num_tokens.

Function default is 4608; argparse default is 8448. Confirm intended value.

examples/wide_ep/slurm_scripts/submit_e2e.sh (1)

117-119: Validate use of non-standard sbatch option --segment.

--segment is not standard in upstream Slurm. Verify cluster supports it or drop it.

examples/wide_ep/slurm_scripts/submit_gen_only.sh (1)

117-119: Validate use of non-standard sbatch option --segment.

Confirm site supports it; otherwise remove.

examples/disaggregated/slurm/benchmark/submit.sh (1)

115-117: Validate use of non-standard sbatch option --segment.

Confirm it’s supported on the target cluster.

examples/disaggregated/slurm/benchmark/disaggr_torch.slurm (7)

2-2: Good addition of strict error handling

The addition of set -euo pipefail is excellent for script robustness - it ensures the script exits on errors, undefined variables, and pipe failures.


4-41: Well-structured argument parsing with clear naming

The expanded parameter list with descriptive variable names improves maintainability. The addition of new parameters like seq_offset, numa_bind, and benchmark_mode provides better configurability.


42-89: Comprehensive logging of configuration improves debuggability

The detailed configuration echo statements provide excellent visibility into the script execution parameters, making debugging significantly easier.


103-108: Robust error handling with cleanup function

The cleanup_on_failure function provides centralized error handling and ensures proper job cancellation on failures, preventing resource leaks.


243-265: Good separation of benchmark modes with proper error handling

The conditional logic for choosing between NV SA benchmark and default benchmark is well-structured with appropriate error handling for each path.


128-129: Verify CUDA architecture compatibility

The build command hardcodes --cuda_architectures='100-real' in examples/disaggregated/slurm/benchmark/disaggr_torch.slurm (lines 128–129). build_wheel.py accepts this flag and passes it to CMake (it even documents examples like 90-real;100-real) and will explicitly reject 70-real. Confirm your cluster GPUs actually require/support 100-real; if not, change to the appropriate semicolon-separated list or use the default all / detect GPUs at runtime.


153-154: seq_offset propagation to worker configs confirmed

disaggr_torch.slurm computes ctx_max_seq_len=$((isl+seq_offset)) and gen_max_seq_len=$((isl+osl+seq_offset)) and passes them to gen_worker_config.py; gen_worker_config.py then writes these values into the ctx/gen 'max_seq_len' fields in the generated YAML, so the seq_offset addition is propagated correctly.

Locations: examples/disaggregated/slurm/benchmark/disaggr_torch.slurm (lines 153–154) → examples/disaggregated/slurm/benchmark/gen_worker_config.py (assigns 'max_seq_len' into ctx/gen config; argparse at ~lines 181–213).

@zerollzeng zerollzeng force-pushed the update-benchmark-script branch from b5f9920 to f5e738a Compare September 23, 2025 09:12
zerollzeng and others added 3 commits September 23, 2025 17:35
Signed-off-by: Zero Zeng <[email protected]>

address review comments

Signed-off-by: Zero Zeng <[email protected]>
@kaiyux kaiyux force-pushed the update-benchmark-script branch from f3c452c to fee7eb3 Compare September 23, 2025 09:35
@kaiyux
Copy link
Member

kaiyux commented Sep 23, 2025

/bot skip --comment "slurm scripts are not protected by CI pipelines"

@kaiyux kaiyux enabled auto-merge (squash) September 23, 2025 09:35
@tensorrt-cicd
Copy link
Collaborator

PR_Github #19686 [ skip ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19686 [ skip ] completed with state SUCCESS
Skipping testing for commit fee7eb3

@kaiyux kaiyux merged commit 16bb76c into NVIDIA:main Sep 23, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants