Merged
Conversation
Contributor
|
@crcrpar Could you help review this PR? This reduces APEX build time a lot. |
crcrpar
reviewed
Feb 21, 2025
README.md
Outdated
| cd apex | ||
| # if pip >= 23.1 (ref: https://pip.pypa.io/en/stable/news/#v23-1) which supports multiple `--config-settings` with the same key... | ||
| pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./ | ||
| pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext --cuda_ext --parallel 4" ./ |
Collaborator
There was a problem hiding this comment.
Likewise --thread option, this would increase CPU mem usage, so could you separately add the example command with --thread and --parallel?
1ef7547 to
d9c3507
Compare
8e833de to
f1ee5b1
Compare
alpha0422
reviewed
Feb 24, 2025
README.md
Outdated
|
|
||
| To reduce the build time of APEX, parallel building can be enhanced via | ||
| ```bash | ||
| export NVCC_APPEND_FLAGS="--threads 4" |
Contributor
There was a problem hiding this comment.
I'd suggest not exporting this env, it affects nvcc globally.
Member
Author
There was a problem hiding this comment.
Moved it to Temporary Environment Scope
crcrpar
approved these changes
Feb 25, 2025
Collaborator
crcrpar
left a comment
There was a problem hiding this comment.
Thank you for implementing this nice option
oraluben
added a commit
to oraluben/SageAttention
that referenced
this pull request
Jul 7, 2025
XiaomingXu1995
added a commit
to thu-ml/SageAttention
that referenced
this pull request
Jul 13, 2025
Build extensions in parallel (NVIDIA/apex#1882)
forrestl111
pushed a commit
to forrestl111/SageAttention
that referenced
this pull request
Jul 23, 2025
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.
Previous Behaviour: extensions are built in series, despite the fact that multiple files in the same extension are compiled in parallel
This pull request adds support for parallel building of multiple extensions. Benchmark results show:
--parallel 4--parallel 16NVCC_APPEND_FLAGS="--threads 8"--parallel 4,NVCC_APPEND_FLAGS="--threads 8"--parallel 16,NVCC_APPEND_FLAGS="--threads 8"NVCC_APPEND_FLAGS="--threads 8"--parallel 16,NVCC_APPEND_FLAGS="--threads 8"Memory usage is shown below. The "mem used" values are obtained using the
freecommand, and background memory usage is included.--parallel 16NVCC_APPEND_FLAGS="--threads 8"--parallel 16,NVCC_APPEND_FLAGS="--threads 8"Image: nvcr.io/nvidia/pytorch:25.01-py3
(or other images with the same CUDA version and TORCH_CUDA_ARCH_LISTS)
cmdline:
time NVCC_APPEND_FLAGS="--threads 8" pip wheel -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext --distributed_adam --distributed_lamb --cuda_ext --permutation_search --bnp --xentropy --focal_loss --group_norm --index_mul_2d --deprecated_fused_adam --deprecated_fused_lamb --fast_layer_norm --fmha --fast_multihead_attn --transducer --cudnn_gbn --peer_memory --nccl_p2p --fast_bottleneck --fused_conv_bias_relu --nccl_allocator --gpu_direct_storage --parallel 16" ./