-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[None] [feat] Use numa to bind CPU #7304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughAdds an optional NUMA memory-binding flag and propagates it to worker launches; adjusts max sequence length constants and an NSYS profiling toggle. Worker start signature now accepts Changes
Sequence Diagram(s)sequenceDiagram
participant SLURM as disaggr_torch.slurm
participant WORKER as start_worker.sh
participant LAUNCH as trtllm-llmapi-launch / trtllm-serve
SLURM->>WORKER: start_worker.sh (..., numa_bind, work_dir, nsys_folder)
alt numa_bind == true
WORKER->>WORKER: numa_bind_cmd = "numactl -m 0,1"
else
WORKER->>WORKER: numa_bind_cmd = ""
end
alt nsys enabled
WORKER->>LAUNCH: ${numa_bind_cmd} ${nsys_prefix} ... (launch profiler + server)
else
WORKER->>LAUNCH: ${numa_bind_cmd} trtllm-serve ...
end
LAUNCH-->>WORKER: process started
WORKER-->>SLURM: worker started / logs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
1c66f7d to
8a71240
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
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/start_worker.sh (1)
55-69: Don’t pass complex command in a string; build arrays to fix SC2090 and ensure NSYS actually runs.
${nsys_prefix}contains spaces/quotes; as written it’s treated as a single arg after numactl, so NSYS likely won’t execute. Use arrays.Apply:
- nsys_prefix="" + nsys_args=() @@ - nsys_prefix="nsys profile -e \"NSYS_MPI_STORE_TEAMS_PER_RANK=1\" -o ${nsys_file} -f true -t cuda,nvtx,python-gil -c cudaProfilerApi --cuda-graph-trace node --capture-range-end=stop --gpu-metrics-devices=none" - echo "nsys_prefix: ${nsys_prefix}" + nsys_args=(nsys profile -e NSYS_MPI_STORE_TEAMS_PER_RANK=1 -o "${nsys_file}" -f true \ + -t cuda,nvtx,python-gil -c cudaProfilerApi --cuda-graph-trace node \ + --capture-range-end=stop --gpu-metrics-devices=none) + echo "nsys_args: ${nsys_args[*]}" @@ - trtllm-llmapi-launch numactl -m 0,1 ${nsys_prefix} \ - trtllm-serve ${model_path} \ - --host $(hostname) --port ${port} \ - --extra_llm_api_options ${config_file} + trtllm-llmapi-launch numactl -m "${NUMA_MEM_NODES:-0,1}" "${nsys_args[@]}" \ + trtllm-serve "${model_path}" \ + --host "$(hostname)" --port "${port}" \ + --extra_llm_api_options "${config_file}"
🧹 Nitpick comments (1)
examples/disaggregated/slurm/benchmark/start_worker.sh (1)
53-53: Title says “bind CPU” but code binds memory. Confirm intent.You’re using
numactl -m(memory policy). If CPU binding is desired, use-N <nodes>or-C <cpus>(and keep-mif you also want memory binding). Suggest making CPU/NUMA settings configurable via env (e.g., NUMA_CPU_NODES/NUMA_CPUS).Example:
# optional knobs (with safe defaults) : "${NUMA_MEM_NODES:=0,1}" : "${NUMA_CPU_NODES:=}" : "${NUMA_CPUS:=}" numa_prefix=(numactl -m "$NUMA_MEM_NODES") [ -n "$NUMA_CPU_NODES" ] && numa_prefix+=( -N "$NUMA_CPU_NODES" ) [ -n "$NUMA_CPUS" ] && numa_prefix+=( -C "$NUMA_CPUS" )Also applies to: 66-66
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
examples/disaggregated/slurm/benchmark/start_worker.sh(2 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
examples/disaggregated/slurm/benchmark/start_worker.sh
[warning] 53-53: Quote this to prevent word splitting.
(SC2046)
[warning] 66-66: Quotes/backslashes in this variable will not be respected.
(SC2090)
⏰ 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
Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
♻️ Duplicate comments (1)
examples/disaggregated/slurm/benchmark/start_worker.sh (1)
27-33: Make NUMA nodes configurable, handle missing numactl, and switch to array args.Avoid hardcoding 0,1; allow override via NUMA_MEM_NODES; use arrays so word-splitting and quoting are correct.
Apply:
-if [ "${numa_bind}" = "true" ]; then - numa_bind_cmd="numactl -m 0,1" - echo "numactl -m 0,1 - Only allocate memory from nodes on GB200" -else - numa_bind_cmd="" - echo "Not binding memory. If on GB200, use \"numactl -m 0,1\" to only allocate memory from nodes." -fi +if [ "${numa_bind}" = "true" ]; then + if command -v numactl >/dev/null 2>&1; then + NUMA_MEM_NODES="${NUMA_MEM_NODES:-0,1}" + numa_bind_args=(numactl -m "${NUMA_MEM_NODES}") + echo "Binding memory with numactl -m ${NUMA_MEM_NODES}" + else + echo "numactl not found; proceeding without NUMA binding." + numa_bind_args=() + fi +else + numa_bind_args=() + echo "Not binding memory. If on GB200, set NUMA_MEM_NODES (e.g., 0,1) and pass numa_bind=true." +fiFollow-ups are in lines 62 and 75 to consume the array.
🧹 Nitpick comments (1)
examples/disaggregated/slurm/benchmark/disaggr_torch.slurm (1)
86-90: Defaulting numa_bind=true is risky; prefer env-driven default and factor the +10 margin.On single-NUMA-node or mismatched systems, numactl may fail and abort the job (set -e). Make it opt-in and configurable.
-nsys_on="" -# nsys_on=${full_logdir} # Uncomment this line to enable Nsys profiling -numa_bind=true # Only allocate memory from nodes, this only works on GB200 -ctx_max_seq_len=$((isl + 10)) -gen_max_seq_len=$((isl + osl + 10)) +nsys_on="" +# nsys_on=${full_logdir} # Uncomment to enable Nsys profiling +numa_bind=${NUMA_BIND:-false} # Set NUMA_BIND=true to enable; works on GB200 +SEQ_MARGIN=${SEQ_MARGIN:-10} +ctx_max_seq_len=$((isl + SEQ_MARGIN)) +gen_max_seq_len=$((isl + osl + SEQ_MARGIN))
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
examples/disaggregated/slurm/benchmark/disaggr_torch.slurm(3 hunks)examples/disaggregated/slurm/benchmark/start_worker.sh(4 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
examples/disaggregated/slurm/benchmark/start_worker.sh
[warning] 62-62: Quote this to prevent word splitting.
(SC2046)
[warning] 75-75: Quotes/backslashes in this variable will not be respected.
(SC2090)
⏰ 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 (1)
examples/disaggregated/slurm/benchmark/start_worker.sh (1)
13-15: Signature change verified across all call sites. disaggr_torch.slurm now passes 10 arguments ($8=numa_bind, $9=work_dir, $10=nsys_folder) in both GEN and CTX invocations; no other start_worker.sh usages found.
|
/bot skip --comment "slurm scripts are not protected by CI pipeline yet" |
|
PR_Github #16843 [ skip ] triggered by Bot |
|
PR_Github #16843 [ skip ] completed with state |
Summary by CodeRabbit
New Features
Chores
Description
Test Coverage
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 thestage-listparameter 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.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip 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-pipelineReuse 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.