Refactor: EXX PW now uses the new Parallel_device communication interface#7312
Merged
mohanchen merged 19 commits intodeepmodeling:developfrom May 7, 2026
Merged
Conversation
isend_dev has no NCCL path — keep guard as #ifndef __CUDA_MPI. reduce_dev / gatherv_dev have NCCL early-returns — exclude CPU staging when __NCCL_PARALLEL_DEVICE is defined (&& !defined).
Resolve conflict in parallel_device.cpp (upstream added memory_op.h and types.h includes). Move CHECK_NCCL macro from CUSOLVERMP #else branch to a shared condition block covering both __CUSOLVERMP and __NCCL_PARALLEL_DEVICE in device_check.h, removing the duplicate definition from parallel_device.cpp.
Add configurable root parameter to bcast_data/nccl_bcast_data/bcast_dev (default root=0 for backward compat). Replace manual MPI_Bcast with GPU/CPU branching in EXX PW operator with unified bcast_dev/reduce_dev.
- ELF GPU: use static_cast with Device-typed psi to bypass virtual dispatch mismatch where DEVICE_GPU cal_tau() did not override base class DEVICE_CPU cal_tau(). Meta-GGA path was unaffected because tau is computed in psiToRho during SCF. - ACE EXX: guard Parallel_Common::reduce_dev calls with __MPI since POOL_WORLD and reduce_dev are only declared when MPI is enabled.
There was a problem hiding this comment.
Pull request overview
This PR refactors EXX PW GPU collective communications to use the Parallel_device (NCCL-capable) communication wrappers, and extends broadcast support with an explicit root parameter to allow non-zero-root broadcasts.
Changes:
- Replace EXX PW
MPI_Bcast(and GPU host-staging fallbacks) withParallel_Common::bcast_devfor device-aware broadcasts. - Replace EXX PW ACE reductions using
Parallel_Reduce::reduce_poolwithParallel_Common::reduce_devto enable device-aware allreduce (including NCCL). - Extend
Parallel_Common::{bcast_data,nccl_bcast_data,bcast_dev}APIs to accept arootargument and propagate it to MPI/NCCL broadcast calls.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| source/source_pw/module_pwdft/op_pw_exx.cpp | Switch EXX k-parallel broadcast of real-space wavefunction buffers to bcast_dev. |
| source/source_pw/module_pwdft/op_pw_exx_ace.cpp | Use reduce_dev for ACE reductions and bcast_dev for wavefunction broadcasts. |
| source/source_hsolver/hsolver_pw_sdft.cpp | Update bcast_dev call sites to pass the new root parameter explicitly. |
| source/source_base/parallel_device.h | Add root parameter to broadcast APIs and adjust bcast_dev signature accordingly. |
| source/source_base/parallel_device.cpp | Propagate root through MPI/NCCL broadcast implementations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mohanchen
approved these changes
May 7, 2026
Collaborator
|
LGTM |
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.
This pull request allows GPU-based collective communications (broadcast, reduce, gather) in EXX PW to use the new
Parallel_devicecommunication interface, thus utilizing the NCCL communication library.Besides,
rootparameter is also added for broadcast operations.