Skip to content

Refactor DeltaSpin PW subspace cache with std::vector - #8110

Closed
hujieting wants to merge 1 commit into
deepmodeling:developfrom
hujieting:task1-deltaspin-vector
Closed

hujieting wants to merge 1 commit into
deepmodeling:developfrom
hujieting:task1-deltaspin-vector

Conversation

@hujieting

Copy link
Copy Markdown
Collaborator

Summary

This PR refactors the CPU memory management of SubspaceCache in source/source_lcao/module_deltaspin/deltaspin_pw_cache.h, replacing manually managed host buffers with std::vector<std::complex<double>> while preserving existing interfaces.

Changes

  • Replace three CPU raw-pointer buffers with std::vector<std::complex<double>>.
  • Use resize() for CPU allocation and empty-vector swap() for storage release.
  • Preserve raw-pointer and per-k-point accessors.
  • Separate GPU device pointers from CPU vector storage while retaining existing CUDA/ROCm allocation operators.
  • Leave the lambda snapshot unchanged.

Validation

  • git diff --check: passed.
  • MPI/LCAO incremental build: passed.
  • DeltaSpin unit tests: 6/6 passed.

Limitations

  • CUDA/ROCm build and runtime paths have not been tested.
  • Static review identified potential edge cases in allocation-state tracking, empty-cache access, and exceptional-path GPU cleanup. No confirmed failure was found in the reviewed normal execution paths.

@hujieting hujieting added the Refactor Refactor ABACUS codes label Oct 10, 2026
@mohanchen

Copy link
Copy Markdown
Collaborator

This is a bit complicated, I will close it for now.

@mohanchen mohanchen closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants