Skip to content

Conversation

@zerollzeng
Copy link
Collaborator

@zerollzeng zerollzeng commented Sep 25, 2025

Summary by CodeRabbit

  • New Features
    • Added YAML-driven benchmark configuration for SLURM runs.
    • Introduced a Python-based submission tool to generate worker configs, compute resources, and submit jobs.
    • Standardized logging to a user-provided log directory for easier tracking.
  • Refactor
    • Reworked SLURM job script to be config-based with clearer hardware, worker, environment, and profiling sections.
    • Simplified startup and benchmarking workflow to use shared config paths and consistent arguments.
  • Chores
    • Removed the legacy shell submission script in favor of the new Python workflow.

Description

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.

Details

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

📝 Walkthrough

Walkthrough

Adds a YAML-driven benchmark configuration, refactors the SLURM script to consume config-based arguments and log directories, introduces a Python-based Slurm submission orchestrator that generates per-role worker configs and submits jobs, and removes the legacy shell-based submission script.

Changes

Cohort / File(s) Summary
Config-driven benchmark setup
examples/disaggregated/slurm/benchmark/config.yaml
Adds a comprehensive YAML config defining slurm, benchmark, hardware, sequence, environment, profiling, and nested worker_config (gen/ctx) with build/runtime and parallelism parameters.
SLURM script refactor to config inputs
examples/disaggregated/slurm/benchmark/disaggr_torch.slurm
Rewrites argument parsing to use config-derived parameters (e.g., gpus_per_node, numa_bind, ctx/gen config paths, log_dir). Updates node/task calculations, startup, logging, and benchmarking to reference log_dir and worker configs. Removes old full_logdir logic and generator scripts.
Python submission tool
examples/disaggregated/slurm/benchmark/submit.py
New orchestrator: parses YAML, computes nodes/tasks, creates per-run log dir, emits worker configs (ctx/gen), builds sbatch command with resources/args, and submits via subprocess. Adds functions parse_args, load_config, save_worker_config, calculate_nodes, submit_job, main.
Legacy shell submission removal
examples/disaggregated/slurm/benchmark/submit.sh
Deletes the previous shell-based submission script, including validations, node calculation, and example runs.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant SubmitPy as submit.py
  participant FS as Filesystem
  participant Slurm as Slurm (sbatch)
  participant SlurmJob as disaggr_torch.slurm

  User->>SubmitPy: Run with --config config.yaml
  SubmitPy->>FS: Load config.yaml
  SubmitPy->>FS: Create log_dir
  SubmitPy->>FS: Write ctx/gen worker_config YAMLs
  SubmitPy->>SubmitPy: Calculate nodes/tasks
  SubmitPy->>Slurm: sbatch with resources and args<br/>(log_dir, ctx_config_path, gen_config_path, env)
  Slurm-->>User: Submission response (job ID)
  Slurm->>SlurmJob: Launch job on allocated nodes
  SlurmJob->>FS: Read worker configs, write logs to log_dir
  note over SlurmJob,FS: Job stages use config-driven parameters
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ⚠️ Warning The PR description is largely empty and does not meet the requirements specified in the description template. The "Description" section (which should explain the issue and solution) is completely blank, containing only the HTML comment placeholder. The "Test Coverage" section is also empty with just a placeholder comment. While the author has checked the PR Checklist box at the bottom, the substantive sections required to understand the change rationale and test strategy are missing entirely. The description essentially consists only of template boilerplate without any actual implementation details or rationale filled in. Please fill in the Description section with a brief explanation of why this refactoring was done (moving the shell script to Python and adopting YAML configuration) and what benefits it provides. Additionally, add a Test Coverage section that documents which tests validate that the new submit.py script and YAML configuration work correctly, or explain if the existing SLURM benchmark workflow tests provide sufficient coverage. These sections are essential for reviewers to understand the motivation and validation approach for this change.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "[None][chore] Move submit.sh to python and use yaml configuration" directly and clearly reflects the main changes in the pull request. The raw summary shows that submit.sh has been replaced with a new Python-based submit.py script and a YAML configuration file (config.yaml) has been introduced to drive the configuration instead of hardcoded shell script arguments. The title follows the required format with a ticket identifier, type classification, and a specific, concise description of the primary change.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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: 5

🧹 Nitpick comments (7)
examples/disaggregated/slurm/benchmark/submit.py (4)

27-35: Use safe_dump and explicit YAML formatting

Switch to yaml.safe_dump and stable formatting for reproducibility.

Apply this diff:

-    with open(output_path, 'w') as f:
-        yaml.dump(worker_config, f, default_flow_style=False)
+    with open(output_path, 'w') as f:
+        yaml.safe_dump(worker_config, f, default_flow_style=False, sort_keys=True)

42-47: Resolve script path robustly

If script_file is relative, resolve it against work_dir (or the config file’s directory) to avoid “file not found.”

Apply this diff:

 def submit_job(config):
     # Extract configurations
     slurm_config = config['slurm']
     hw_config = config['hardware']
     env_config = config['environment']
+    # Resolve script path relative to work_dir if needed
+    script_path = slurm_config['script_file']
+    if not os.path.isabs(script_path):
+        script_path = os.path.join(env_config['work_dir'], script_path)
+    if not os.path.exists(script_path):
+        raise FileNotFoundError(f"SLURM script not found: {script_path}")

91-103: Set working directory and use resolved script path

Ensure job starts in work_dir and passes the correct script. Also consider using --chdir for sbatch.

Apply this diff:

     cmd = [
         'sbatch',
         f'--partition={slurm_config["partition"]}',
         f'--gres=gpu:{hw_config["gpus_per_node"]}',
         f'--account={slurm_config["account"]}',
         f'--time={slurm_config["job_time"]}',
         f'--job-name={slurm_config["job_name"]}',
         f'--nodes={total_nodes}',
         f'--ntasks={total_tasks}',
         f'--ntasks-per-node={hw_config["gpus_per_node"]}',
-        f'--segment={total_nodes}',
-        slurm_config['script_file'],
+        f'--chdir={env_config["work_dir"]}',
+        script_path,

141-147: Pass cwd to subprocess.run and surface stderr/stdout on failure

Improves reliability and debugging of submission failures.

Apply this diff:

-    try:
-        subprocess.run(cmd, check=True)
+    try:
+        subprocess.run(cmd, check=True, cwd=env_config['work_dir'])
     except subprocess.CalledProcessError as e:
-        print(f"Error submitting job: {e}", file=sys.stderr)
+        print(f"Error submitting job: {e}", file=sys.stderr)
         sys.exit(1)
examples/disaggregated/slurm/benchmark/disaggr_torch.slurm (3)

81-86: Add traps for reliable cleanup

Ensure cleanup_on_failure runs on ERR/INT/TERM and that scancel is issued on failures automatically.

Apply this diff:

 cleanup_on_failure() {
     echo "Error: $1"
     scancel ${SLURM_JOB_ID}
     exit 1
 }
 
+trap 'cleanup_on_failure "Script interrupted (INT)"' INT
+trap 'cleanup_on_failure "Script terminated (TERM)"' TERM
+trap 'cleanup_on_failure "Script failed (ERR)"' ERR

156-166: Pin srun placement or node lists if contention arises

You compute gen_nodes/ctx_nodes but don’t use them. If you observe step contention, pass explicit node lists via -w "${gen_nodes_csv}" and -w "${ctx_nodes_csv}".


90-96: Container launch: run a real no-op command within bash -c

A bare echo is fine, but using bash -c avoids surprises with shell builtins across environments; keep logging as-is.

Apply this diff:

-if ! srun -l --container-image=${container_image} \
+if ! srun -l --container-image=${container_image} \
         --container-name=${container_name} \
         --container-mounts=${container_mount} \
         --mpi=pmix \
-        echo "Container up." &> ${log_dir}/container_launch.log; then
+        bash -lc 'echo "Container up."' &> ${log_dir}/container_launch.log; then
📜 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 2dc93c6 and 3fd6a7e.

📒 Files selected for processing (4)
  • examples/disaggregated/slurm/benchmark/config.yaml (1 hunks)
  • examples/disaggregated/slurm/benchmark/disaggr_torch.slurm (10 hunks)
  • examples/disaggregated/slurm/benchmark/submit.py (1 hunks)
  • examples/disaggregated/slurm/benchmark/submit.sh (0 hunks)
💤 Files with no reviewable changes (1)
  • examples/disaggregated/slurm/benchmark/submit.sh
🧰 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/submit.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/submit.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/submit.py
🪛 Ruff (0.13.1)
examples/disaggregated/slurm/benchmark/submit.py

1-1: Shebang is present but file is not executable

(EXE001)


143-143: subprocess call: check for execution of untrusted input

(S603)

⏰ 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 (4)
examples/disaggregated/slurm/benchmark/config.yaml (3)

3-3: Consider making script_file an absolute or work_dir-relative path

"disaggr_torch.slurm" will fail if submit.py isn’t executed from this directory. Prefer an absolute path or make submit.py resolve relative to work_dir/config location.


82-83: Verify moe_config.backend value

"WIDEEP" looks non-standard; confirm it matches the expected enum in your runtime. If not, update to a supported backend value to avoid runtime parse errors.


80-80: Confirm kv_cache_config dtype compatibility

fp8 requires specific kernels/hardware support. Ensure this matches your TRT-LLM build and model weights; otherwise, set to a supported dtype (e.g., fp16/bf16).

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

142-146: Subprocess safety note

Inputs originate from YAML; you’re using shell=False, which is good. Keep validating/normalizing types (ints, bools, paths) before constructing the cmd to prevent sbatch rejections.

@zerollzeng zerollzeng force-pushed the zeroz-python-migration branch 2 times, most recently from c49efff to 4abae99 Compare September 26, 2025 08:08
@zerollzeng zerollzeng force-pushed the zeroz-python-migration branch from 4abae99 to 304a3e5 Compare October 9, 2025 02:08
@zerollzeng zerollzeng force-pushed the zeroz-python-migration branch from a572409 to 7369ce0 Compare October 16, 2025 06:23
Signed-off-by: Zero Zeng <[email protected]>

update

Signed-off-by: Zero Zeng <[email protected]>
@zerollzeng zerollzeng force-pushed the zeroz-python-migration branch from 7369ce0 to a6fb940 Compare October 16, 2025 06:32
@zerollzeng zerollzeng changed the title [None][chore] Draft: Move submit.sh to python and use yaml configuration [None][chore] Move submit.sh to python and use yaml configuration Oct 16, 2025
Signed-off-by: Zero Zeng <[email protected]>
@zerollzeng zerollzeng force-pushed the zeroz-python-migration branch from a6fb940 to 899940d Compare October 20, 2025 03:00
Signed-off-by: Zero Zeng <[email protected]>
Signed-off-by: Zero Zeng <[email protected]>
@kaiyux
Copy link
Member

kaiyux commented Oct 21, 2025

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

@kaiyux kaiyux enabled auto-merge (squash) October 21, 2025 02:01
@tensorrt-cicd
Copy link
Collaborator

PR_Github #21978 [ skip ] triggered by Bot. Commit: 0d9423f

@tensorrt-cicd
Copy link
Collaborator

PR_Github #21978 [ skip ] completed with state SUCCESS. Commit: 0d9423f
Skipping testing for commit 0d9423f

@kaiyux kaiyux merged commit 4545700 into NVIDIA:main Oct 21, 2025
5 checks passed
govind-ramnarayan pushed a commit to nv-auto-deploy/TensorRT-LLM that referenced this pull request Oct 21, 2025
yufeiwu-nv pushed a commit to yufeiwu-nv/TensorRT-LLM that referenced this pull request Oct 24, 2025
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Nov 1, 2025
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Nov 3, 2025
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Nov 3, 2025
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Nov 3, 2025
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.

5 participants