Skip to content

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

Open
GenZeal-Lin wants to merge 3 commits into
deepmodeling:developfrom
GenZeal-Lin:fix/7681-cuda-fft-grid
Open

fix(gpu): guard qq synchronization without projectors#7816
GenZeal-Lin wants to merge 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
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 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