-
Notifications
You must be signed in to change notification settings - Fork 749
Expert Parallelism: common C API + NCCL EP backend #3127
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
Open
timmoon10
wants to merge
1
commit into
NVIDIA:main
Choose a base branch
from
timmoon10:phuong/ep-2-commwindow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # See LICENSE for license information. | ||
| # | ||
| # Run TE EP distributed unit tests via mpirun. Each MPI rank pins to one GPU | ||
| # (rank % device_count) and exchanges ncclUniqueId through MPI_Bcast. | ||
| # | ||
| # Usage: | ||
| # bash run_test_ep.sh [num_gpus] [build_dir] | ||
| # | ||
| # Defaults: | ||
| # num_gpus = number of GPUs visible to nvidia-smi | ||
| # build_dir = <script_dir>/build | ||
| # | ||
| # Environment variables: | ||
| # GTEST_FILTER - forwarded to all processes (e.g., "EPPipelineTest.*") | ||
| # GTEST_XML_PREFIX - if set, each rank writes JUnit XML to | ||
| # ${GTEST_XML_PREFIX}.rank<N>.xml | ||
| # MPIRUN - override the mpirun binary (default: mpirun) | ||
| # MPIRUN_EXTRA - extra flags forwarded to mpirun | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| BUILD_DIR="${2:-${SCRIPT_DIR}/build}" | ||
| NUM_GPUS="${1:-$(nvidia-smi -L 2>/dev/null | wc -l)}" | ||
| MPIRUN="${MPIRUN:-mpirun}" | ||
|
|
||
| # Skip cleanly on pre-Hopper: NCCL EP requires SM>=90. | ||
| MIN_SM=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader 2>/dev/null \ | ||
| | awk -F. 'NR==1 || ($1*10+$2)<min { min=$1*10+$2 } END { print min+0 }') | ||
| if (( MIN_SM > 0 && MIN_SM < 90 )); then | ||
| echo "NCCL EP requires SM>=90 (lowest visible GPU is SM${MIN_SM}); SKIPPING." | ||
| exit 0 | ||
| fi | ||
|
|
||
| TEST_BIN="${BUILD_DIR}/test_ep" | ||
| if [[ ! -x "${TEST_BIN}" ]]; then | ||
| echo "ERROR: binary not found: ${TEST_BIN}" | ||
| echo "Build: cd ${SCRIPT_DIR} && mkdir -p build && cd build && cmake .. && make" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if (( NUM_GPUS < 2 )); then | ||
| echo "EP Tests: requires at least 2 GPUs, found ${NUM_GPUS}. Skipping." | ||
| exit 0 | ||
| fi | ||
|
|
||
| GTEST_ARGS="${GTEST_FILTER:+--gtest_filter=${GTEST_FILTER}}" | ||
|
|
||
| echo "=== EP Tests ===" | ||
| echo " GPUs: ${NUM_GPUS} Binary: ${TEST_BIN}" | ||
| echo | ||
|
|
||
| if [[ -n "${GTEST_XML_PREFIX:-}" ]]; then | ||
| # bash -c so OMPI_COMM_WORLD_RANK expands per-rank, avoiding a write race | ||
| # on a single shared output path. | ||
| "${MPIRUN}" --allow-run-as-root --oversubscribe -n "${NUM_GPUS}" ${MPIRUN_EXTRA:-} bash -c \ | ||
| "exec '${TEST_BIN}' ${GTEST_ARGS} --gtest_output=xml:${GTEST_XML_PREFIX}.rank\${OMPI_COMM_WORLD_RANK}.xml" | ||
| else | ||
| "${MPIRUN}" --allow-run-as-root --oversubscribe -n "${NUM_GPUS}" ${MPIRUN_EXTRA:-} "${TEST_BIN}" ${GTEST_ARGS} | ||
| fi |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
prev_gencodeis checked, themakebuild is launched, and the stamp is written in three distinct steps with no locking between them. In a distributed training environment where each rank's setup script (or a pip install in a parallel job) invokesbuild_nccl_ep_submodule()simultaneously, two processes can both pass the stale-stamp check, both launchmake -j, and one can overwrite the stamp while the other is still building, leaving a mismatched stamp if the builds produce different outputs. A file lock (e.g.,fcntl.flockaround the whole check-build-stamp block) or a build-level lock would make this robust.