Skip to content

fix(gpu): guard qq synchronization without projectors - #7816

Merged
mohanchen merged 3 commits into
deepmodeling:developfrom
GenZeal-Lin:fix/7681-cuda-fft-grid
Aug 19, 2026
Merged

fix(gpu): guard qq synchronization without projectors#7816
mohanchen merged 3 commits into
deepmodeling:developfrom
GenZeal-Lin:fix/7681-cuda-fft-grid

Conversation

@GenZeal-Lin

Copy link
Copy Markdown

Linked Issue

Fixes #7681

What's changed?

For pseudopotentials without nonlocal projectors, nhm is zero and
the corresponding qq buffers are not allocated.

The previous GPU initialization path still attempted to synchronize
these qq buffers, which could pass an invalid destination pointer to
CUDA memory-copy operations and trigger cudaMemcpy invalid argument.

This change guards the synchronization of s_qq_nt, c_qq_so,
z_qq_so, and d_qq_nt with nhm > 0.

The existing path for pseudopotentials with nonlocal projectors
(nhm > 0) is unchanged.

Verification

  • CUDA build on NVIDIA RTX 4090: passed.
  • 001_PW_UPF100_Al (nhm > 0) and
    016_PW_BLPS019_PW_Coulomb (nhm == 0) passed the core
    default-precision regression tests.
  • Single-precision smoke tests for both nhm == 0 and nhm > 0
    completed successfully.
  • Extended cases 801–814 no longer show the CUDA invalid-argument crash.
  • Case 803 retains the previously investigated small stress deviation,
    which is related to MPI/reference configuration rather than this fix.

Scope

  • Modified:
    source/source_pw/module_pwdft/vnl_pw.cpp
  • No INPUT parameter changes.
  • No API changes.

@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes labels Aug 14, 2026

@mohanchen mohanchen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your contribution!

@mohanchen
mohanchen merged commit b3691d0 into deepmodeling:develop Aug 19, 2026
17 checks passed
@mohanchen mohanchen added the GPU & DCU & HPC GPU and DCU and HPC related any issues label Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugs Bugs that only solvable with sufficient knowledge of DFT GPU & DCU & HPC GPU and DCU and HPC related any issues Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GPU] PW FFT grid init fails with i1*i2*i3=0 for BLPS/LPS/Coulomb and all 801-814 PW_LT_* tests (18 cases)

2 participants