Skip to content

[None][chore] Add aggregated benchmark in slurm.#13030

Open
dominicshanshan wants to merge 4 commits intoNVIDIA:mainfrom
dominicshanshan:user/shanshan/aggregated_slurm
Open

[None][chore] Add aggregated benchmark in slurm.#13030
dominicshanshan wants to merge 4 commits intoNVIDIA:mainfrom
dominicshanshan:user/shanshan/aggregated_slurm

Conversation

@dominicshanshan
Copy link
Copy Markdown
Collaborator

@dominicshanshan dominicshanshan commented Apr 14, 2026

Summary by CodeRabbit

  • New Features
    • Added SLURM benchmark examples with configuration templates for distributed performance testing.
    • New job submission capability for automated benchmark deployment on SLURM clusters.
    • Includes server startup and health monitoring utilities for coordinated benchmark execution.

Description

This PR adds an aggregated benchmark harness that automates end-to-end performance measurement of TensorRT-LLM aggregated serving on SLURM-managed GPU clusters (targeting GB200/GB300 NVL72). It mirrors the existing disaggregated benchmark and execute python submit.py -c config.yaml as entry point that handles topology computation, container orchestration, server lifecycle (via trtllm-serve), and benchmark execution (via benchmark_serving).

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

  • Update tava architecture diagram if there is a significant design change in PR.

  • 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

To see a list of available CI bot commands, please comment /bot help.

Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

📝 Walkthrough

Walkthrough

Introduces a new SLURM benchmark example with configuration files and helper scripts to submit and execute distributed TensorRT-LLM benchmark jobs on SLURM clusters, including server startup, health monitoring, and client execution workflows.

Changes

Cohort / File(s) Summary
Configuration Files
examples/aggregated/slurm/benchmark/config.yaml, examples/aggregated/slurm/benchmark/extra_llm_api_options.yaml
YAML configuration files defining SLURM job execution parameters (partition, time limits, node settings), benchmark settings (input/output lengths, prompts, concurrency, streaming), hardware specs (GPUs per node), server configuration (model paths, parallelism sizes, batching), environment variables, and additional LLM API options including CUDA graph padding, KV cache behavior, MoE settings, and attention DP.
Job Submission and Execution
examples/aggregated/slurm/benchmark/submit.py, examples/aggregated/slurm/benchmark/start_server.sh, examples/aggregated/slurm/benchmark/wait_server.sh
Python submission script that discovers configs, computes distributed sizing, generates timestamped log directories, creates helper shell scripts for server startup with optional NUMA binding, constructs and submits sbatch commands with container and TensorRT-LLM repository parameters. Bash scripts handle server launch with optional NUMA memory binding and periodic health polling via HTTP health endpoint with configurable timeout and intervals.

Sequence Diagram

sequenceDiagram
    participant User
    participant submit.py
    participant SLURM
    participant start_server.sh
    participant Server as TensorRT-LLM Server
    participant wait_server.sh
    participant client_cmds.sh

    User->>submit.py: Execute with config file(s)
    submit.py->>submit.py: Parse config, compute world_size & node count
    submit.py->>submit.py: Generate helper scripts in log dir
    submit.py->>SLURM: sbatch with container, env vars
    SLURM->>start_server.sh: srun across node(s)
    start_server.sh->>start_server.sh: Optional: numactl memory binding
    start_server.sh->>Server: trtllm-llmapi-launch server_cmd
    Server->>Server: Initialize TensorRT-LLM runtime
    wait_server.sh->>Server: Poll /health endpoint
    Server-->>wait_server.sh: HTTP 200 when ready
    wait_server.sh->>client_cmds.sh: Server healthy, proceed
    client_cmds.sh->>Server: Execute benchmark with prompt/concurrency
    Server-->>client_cmds.sh: Benchmark results
    client_cmds.sh->>client_cmds.sh: Log results to file
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive PR description lacks essential details; only template sections are visible without substantive content explaining the aggregated benchmark harness implementation, rationale, or design decisions. Provide a complete description with: (1) what the aggregated benchmark harness does, (2) why it was added, (3) how it differs from the disaggregated variant, (4) test coverage details, and (5) any known limitations or future work.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title '[None][chore] Add aggregated benchmark in slurm' clearly and specifically describes the main change: adding an aggregated benchmark configuration and scripts for SLURM execution.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown
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: 8

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/aggregated/slurm/benchmark/submit.py`:
- Around line 66-75: The current log directory generation builds dir_suffix from
tp_size, ep_size, pp_size and max_batch_size so different config files with
identical numeric params overwrite each other; update the dir_suffix
construction in the log_dir creation block (where log_dir and dir_suffix are
set) to append a stable identifier derived from the config path—either the
config stem (basename without extension) or a short deterministic hash of
config_path—so each config file yields a unique log_dir and prevents
shutil.rmtree from deleting previous runs.
- Around line 1-13: This new script
examples/aggregated/slurm/benchmark/submit.py is missing the required NVIDIA
copyright header; add the standard multi-line NVIDIA copyright banner at the
very top of the file (before the shebang or replace the existing shebang if
policy requires), using the current year and matching the project's canonical
header format used in other source files, and ensure the header includes the
correct copyright holder text and any SPDX or license lines required by the
repo.
- Around line 265-279: The loop over config_files is picking up auxiliary YAMLs
(like extra_llm_api_options.yaml) that lack the expected top-level "slurm"
section and causing submit_job(config, ...) to fail; update the logic that
collects or processes configs (the yaml_pattern/config_files loop) to either
restrict which filenames are accepted (e.g., only files named "config.yaml" or
matching a specific pattern) or, after loading via load_config(config_file),
validate that the returned config contains the required top-level "slurm" key
before calling submit_job; if the check fails, print a warning and continue
instead of calling submit_job so only real benchmark configs are submitted.
- Around line 165-193: The benchmark client command hard-codes
"--trust-remote-code" but should follow the server config; change the bench_cmd
construction to conditionally include the trust-remote-code flag based on
server_config.get("trust_remote_code", True) (or benchmark_config if that's the
intended source) instead of the hard-coded string; update the list building
around the "--trust-remote-code" entry in bench_cmd so you append
"--trust-remote-code" only when server_config['trust_remote_code'] is true and
omit it when false.
- Around line 43-46: The current code overwrites script_dir with
environment.work_dir, causing bundled assets (start_server.sh, wait_server.sh,
aggregated_torch.slurm) to be resolved from the user work_dir instead of the
package assets; instead, keep two directories: a template/assets dir resolved
from __file__ (e.g., template_dir = os.path.dirname(os.path.abspath(__file__)))
which you must use when joining filenames for start_server.sh, wait_server.sh,
and aggregated_torch.slurm, and a separate work_dir from env_config used only
for runtime outputs; update places that build paths for those three files (where
start_server.sh, wait_server.sh, aggregated_torch.slurm are referenced) to join
with template_dir (or __file__-derived dir) rather than
env_config["work_dir"]/script_dir so bundled files are always read from the
package assets while work_dir remains for outputs.
- Around line 208-210: The code calls sys.exit(1) inside per-config submission
(e.g., when slurm_script_file is missing) which aborts main() for all configs;
instead, replace those sys.exit(1) calls with non-fatal handling so the loop can
continue: log/print the error about slurm_script_file and use continue to skip
the current config; likewise, for the sbatch invocation(s) (the code
building/running sbatch_cmd or submit logic around the sbatch subprocess), do
not call sys.exit on failure—check subprocess returncode or catch errors, log
the failure with context and continue to the next config so main() can process
the remaining items.
- Around line 81-91: The code copies extra_llm_api_path into log_dir but later
still appends the original source path to the container command; update the
logic so that after verifying the source file exists and copying it (see
extra_llm_api_path and shutil.copy2 usage) you replace extra_llm_api_path with
the copied path in log_dir (os.path.join(log_dir,
os.path.basename(extra_llm_api_path))) before building container_mount_str / the
trtllm-serve flag, and if the original source cannot be resolved (not exists and
not absolute/mounted), raise an error instead of silently continuing.

In `@examples/aggregated/slurm/benchmark/wait_server.sh`:
- Line 13: The loop currently only checks reachability; change it to verify the
/health endpoint returns a healthy HTTP status (e.g., 200) before proceeding.
Capture the status with curl using -w "%{http_code}" (against
"http://${hostname}:${port}/health") and loop while that status is not 200,
sleeping/retrying between attempts; update the while condition in wait_server.sh
so it compares the returned status code rather than just curl success.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 57c890b8-a998-4922-a995-2e0360a17625

📥 Commits

Reviewing files that changed from the base of the PR and between f2f9051 and 2d972b9.

📒 Files selected for processing (5)
  • examples/aggregated/slurm/benchmark/config.yaml
  • examples/aggregated/slurm/benchmark/extra_llm_api_options.yaml
  • examples/aggregated/slurm/benchmark/start_server.sh
  • examples/aggregated/slurm/benchmark/submit.py
  • examples/aggregated/slurm/benchmark/wait_server.sh

Comment thread examples/aggregated/slurm/benchmark/submit.py
Comment thread examples/aggregated/slurm/benchmark/submit.py
Comment thread examples/aggregated/slurm/benchmark/submit.py
Comment thread examples/aggregated/slurm/benchmark/submit.py
Comment thread examples/aggregated/slurm/benchmark/submit.py
Comment thread examples/aggregated/slurm/benchmark/submit.py
Comment thread examples/aggregated/slurm/benchmark/submit.py
Comment thread examples/aggregated/slurm/benchmark/wait_server.sh
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
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.

1 participant