-
Notifications
You must be signed in to change notification settings - Fork 80
Align the data element counts for Allreduce nvls kernel #697
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
seagater
wants to merge
11
commits into
main
Choose a base branch
from
qinghuazhou/allreduce_nvls_size_alignment
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
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6cef4a6
Align the counts for allreduce nvls kernel
c1d762e
Merge branch 'main' into qinghuazhou/allreduce_nvls_size_alignment
seagater eb162ca
Use getDataTypeSize instead of ncclTypeSize
seagater 677f014
Remove empty line
seagater 094ca80
Update pylint
seagater e866834
Add padding to make the total size divisible by (nRanksPerNode * alig…
seagater 1de1e89
Update clang-format
seagater 5352410
Merge branch 'main' into qinghuazhou/allreduce_nvls_size_alignment
seagater f1561c9
Add ut test to track input size alignment
seagater 9f2382b
Merge branch 'main' into qinghuazhou/allreduce_nvls_size_alignment
seagater 4489f95
Merge branch 'main' into qinghuazhou/allreduce_nvls_size_alignment
seagater 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| # .azure-pipelines/templates/ut-size-alignment.yaml | ||
| # ---------------------------------------- | ||
| # A step-template that runs unit tests to track the input size alignment using PyTorch and MSCCLPP. | ||
| # | ||
| # Parameters: | ||
| # subscription – Azure subscription to use for VMSS start/stop | ||
| # vmssName – Name of the VMSS to use | ||
| # sshKeySecureFile – the secureFile name for your SSH key | ||
| # pytorchImage – PyTorch Docker image to use for unit tests | ||
|
|
||
| parameters: | ||
| - name: subscription | ||
| type: string | ||
| - name: vmssName | ||
| type: string | ||
| - name: sshKeySecureFile | ||
| type: string | ||
| - name: pytorchImage | ||
| type: string | ||
| default: "mcr.microsoft.com/mirror/nvcr/nvidia/pytorch:25.03-py3" | ||
|
|
||
| steps: | ||
| - task: Bash@3 | ||
| name: Build | ||
| displayName: Build MSCCLPP | ||
| inputs: | ||
| targetType: inline | ||
| script: | | ||
| mkdir build && cd build | ||
| cmake -DCMAKE_BUILD_TYPE=Release -DMSCCLPP_BYPASS_GPU_CHECK=ON -DMSCCLPP_USE_CUDA=ON .. | ||
| make -j | ||
| workingDirectory: '$(System.DefaultWorkingDirectory)' | ||
|
|
||
| - task: Bash@3 | ||
| name: InstallPackages | ||
| displayName: Install Packages | ||
| inputs: | ||
| targetType: inline | ||
| script: | | ||
| sudo apt-get update -y | ||
| sudo apt-get install pssh -y | ||
| curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash | ||
|
|
||
| - task: DownloadSecureFile@1 | ||
| name: SshKeyFile | ||
| displayName: Download key file | ||
| inputs: | ||
| secureFile: ${{ parameters.sshKeySecureFile }} | ||
|
|
||
| - task: AzureCLI@2 | ||
| name: StartVMSS | ||
| displayName: Start VMSS | ||
| inputs: | ||
| azureSubscription: ${{ parameters.subscription }} | ||
| scriptType: bash | ||
| scriptLocation: inlineScript | ||
| inlineScript: | | ||
| az vmss start --name ${{ parameters.vmssName }} --resource-group mscclpp | ||
|
|
||
| - task: Bash@3 | ||
| name: DeployBenchmarkEnv | ||
| displayName: Deploy Benchmark Environment | ||
| inputs: | ||
| targetType: inline | ||
| script: | | ||
| set -e | ||
| HOSTFILE=$(System.DefaultWorkingDirectory)/test/deploy/hostfile_ci | ||
| ROOT_DIR=$(System.DefaultWorkingDirectory) | ||
| SSH_OPTION="StrictHostKeyChecking=no" | ||
| KeyFilePath=${SSHKEYFILE_SECUREFILEPATH} | ||
|
|
||
| # Get the host IP | ||
| HOST_IP=$(head -1 ${HOSTFILE} | awk '{print $1}') | ||
|
|
||
| # Pull the PyTorch image on the remote machine | ||
| ssh -i ${KeyFilePath} -o ${SSH_OPTION} ${HOST_IP} "sudo docker pull ${{ parameters.pytorchImage }}" | ||
|
|
||
| # Stop any existing container | ||
| ssh -i ${KeyFilePath} -o ${SSH_OPTION} ${HOST_IP} "sudo docker rm -f mscclpp-benchmark || true" | ||
|
|
||
| # Copy MSCCLPP build to the remote machine | ||
| scp -i ${KeyFilePath} -o ${SSH_OPTION} -r ${ROOT_DIR}/build ${HOST_IP}:/tmp/mscclpp-build | ||
| scp -i ${KeyFilePath} -o ${SSH_OPTION} -r ${ROOT_DIR}/test ${HOST_IP}:/tmp/mscclpp-test | ||
|
|
||
| # Start the PyTorch container with MSCCLPP mounted | ||
| ssh -i ${KeyFilePath} -o ${SSH_OPTION} ${HOST_IP} "sudo docker run -d --name mscclpp-benchmark \ | ||
| --gpus all \ | ||
| --ipc=host \ | ||
| --ulimit memlock=-1 \ | ||
| --ulimit stack=67108864 \ | ||
| -v /tmp/mscclpp-build:/root/mscclpp/build \ | ||
| -v /tmp/mscclpp-test:/root/mscclpp/test \ | ||
| ${{ parameters.pytorchImage }} \ | ||
| sleep infinity" | ||
| workingDirectory: '$(System.DefaultWorkingDirectory)' | ||
|
|
||
| - task: Bash@3 | ||
| name: AllReduceBenchmarkMultipleSizes | ||
| displayName: Run AllReduce Benchmark Test (Multiple Sizes to test the alignment) | ||
| inputs: | ||
| targetType: inline | ||
| script: | | ||
| set -e | ||
| HOSTFILE=$(System.DefaultWorkingDirectory)/test/deploy/hostfile_ci | ||
| SSH_OPTION="StrictHostKeyChecking=no" | ||
| KeyFilePath=${SSHKEYFILE_SECUREFILEPATH} | ||
| HOST_IP=$(head -1 ${HOSTFILE} | awk '{print $1}') | ||
|
|
||
| : > azureuser@${HOST_IP} | ||
| tail -f azureuser@${HOST_IP} & | ||
| CHILD_PID=$! | ||
|
|
||
| # Run with different element counts | ||
| for nelem in 10556576 10556587 10556592 10556608 1048576 9999999 12345678; do | ||
| echo "Running AllReduce benchmark with nelem=${nelem}" | ||
| ssh -i ${KeyFilePath} -o ${SSH_OPTION} ${HOST_IP} "sudo docker exec -t mscclpp-benchmark bash -c \" \ | ||
| set -e; \ | ||
| cd /root/mscclpp; \ | ||
| LD_PRELOAD=/root/mscclpp/build/apps/nccl/libmscclpp_nccl.so torchrun --nproc_per_node=8 test/torch/correctness_test.py --collective allreduce --nelem ${nelem} --dtype float\"" | ||
| done | ||
|
|
||
| kill $CHILD_PID || true | ||
| workingDirectory: '$(System.DefaultWorkingDirectory)' | ||
|
|
||
| - task: Bash@3 | ||
| name: Cleanup | ||
| displayName: Cleanup Benchmark Container | ||
| condition: always() | ||
| inputs: | ||
| targetType: inline | ||
| script: | | ||
| set -e | ||
| HOSTFILE=$(System.DefaultWorkingDirectory)/test/deploy/hostfile_ci | ||
| SSH_OPTION="StrictHostKeyChecking=no" | ||
| KeyFilePath=${SSHKEYFILE_SECUREFILEPATH} | ||
| HOST_IP=$(head -1 ${HOSTFILE} | awk '{print $1}') | ||
|
|
||
| ssh -i ${KeyFilePath} -o ${SSH_OPTION} ${HOST_IP} "sudo docker rm -f mscclpp-benchmark || true" | ||
| ssh -i ${KeyFilePath} -o ${SSH_OPTION} ${HOST_IP} "sudo rm -rf /tmp/mscclpp-build /tmp/mscclpp-test || true" | ||
| workingDirectory: '$(System.DefaultWorkingDirectory)' | ||
|
|
||
| - task: AzureCLI@2 | ||
| name: StopVMSS | ||
| displayName: Deallocate VMSS | ||
| condition: always() | ||
| inputs: | ||
| azureSubscription: ${{ parameters.subscription }} | ||
| scriptType: bash | ||
| scriptLocation: inlineScript | ||
| inlineScript: | | ||
| az vmss deallocate --name ${{ parameters.vmssName }} --resource-group mscclpp |
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,42 @@ | ||
| trigger: | ||
| branches: | ||
| include: | ||
| - main | ||
| - release/* | ||
| paths: | ||
| exclude: | ||
| - .devcontainer/** | ||
| - .github/** | ||
| - docker/** | ||
| - docs/** | ||
| - '**/*.md' | ||
|
|
||
| pr: | ||
| branches: | ||
| include: | ||
| - main | ||
| - release/* | ||
| drafts: false | ||
| paths: | ||
| exclude: | ||
| - .devcontainer/** | ||
| - .github/** | ||
| - docker/** | ||
| - docs/** | ||
| - '**/*.md' | ||
|
|
||
| jobs: | ||
| - job: BenchmarkTestH100 | ||
| displayName: Benchmark Test H100 | ||
| pool: | ||
| name: msccl-ci-h100 | ||
| container: | ||
| image: ghcr.io/microsoft/mscclpp/mscclpp:base-dev-cuda12.4 | ||
|
|
||
| steps: | ||
| - template: templates/ut-size-alignment.yaml | ||
| parameters: | ||
| subscription: mscclpp-ci-h100 | ||
| vmssName: mscclpp-h100-ci | ||
| sshKeySecureFile: mscclpp.pem | ||
| pytorchImage: mcr.microsoft.com/mirror/nvcr/nvidia/pytorch:25.03-py3 |
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
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.
Uh oh!
There was an error while loading. Please reload this page.