[None][chore] Add aggregated benchmark in slurm.#13030
Open
dominicshanshan wants to merge 4 commits intoNVIDIA:mainfrom
Open
[None][chore] Add aggregated benchmark in slurm.#13030dominicshanshan wants to merge 4 commits intoNVIDIA:mainfrom
dominicshanshan wants to merge 4 commits intoNVIDIA:mainfrom
Conversation
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
Contributor
📝 WalkthroughWalkthroughIntroduces 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Contributor
There was a problem hiding this comment.
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
📒 Files selected for processing (5)
examples/aggregated/slurm/benchmark/config.yamlexamples/aggregated/slurm/benchmark/extra_llm_api_options.yamlexamples/aggregated/slurm/benchmark/start_server.shexamples/aggregated/slurm/benchmark/submit.pyexamples/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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by CodeRabbit
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.yamlas 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.