Skip to content

refactor: spell out local types in numerical kernels, solvers and I/O - #8397

Open
Stardust0831 wants to merge 34 commits into
deepmodeling:developfrom
Stardust0831:refactor/explicit-local-types
Open

Stardust0831 wants to merge 34 commits into
deepmodeling:developfrom
Stardust0831:refactor/explicit-local-types

Conversation

@Stardust0831

Copy link
Copy Markdown
Collaborator

Linked Issue

The developer guide asks contributors to prefer explicit local types. This refactor applies that rule without changing a user-facing feature.

What's changed?

Spell out 757 local declarations in 211 files across the numerical libraries, PW and LCAO solvers, I/O, existing unit tests, and three PyABACUS binding declarations. The changes make precision, pointee types, ownership, and copy versus reference semantics visible at the declaration. For example, the complex FFT scratch buffers use std::complex<FPTYPE>* and the real-space buffer uses FPTYPE*. The initializer expressions and numerical operations are preserved.

Unit Tests and/or Case Tests for my changes

  • Built 47 selected CTest targets on the final commit with GCC 13.3, MPI, OpenMP and FFTW, including six in a LibRI/Libxc-enabled build. For each target, ran cmake --build "$build" -j 6 --target "$target" and ctest --test-dir "$build" -V --no-tests=error -R "^${target}$" with OMP_NUM_THREADS=1 and OPENBLAS_NUM_THREADS=1. 45 suites passed in full (523 Google Tests). The parallel INPUT fixture selects genelpa and the parallel eigensolver suite calls ELPA. Both stop with ELPA disabled on the comparison build and the final commit. All four ScaLAPACK eigensolver cases passed separately on the final commit.
  • Checked the original deduced types with std::is_same<decltype(variable), Expected> and compiled the explicit declarations. Compared generated CPU objects in the tested configurations, including LibRI/Libxc, PyABACUS, and translation units instantiating the changed headers. Focused dispersion, radial, FFT and INPUT tests were also run on the corresponding earlier commits, including FFT on one and three MPI ranks and D4 on two.
  • For 108 declarations in 11 CUDA translation units, compiled both versions with NVCC 12.9 (-std=c++17 -arch=sm_75). The PTX and the combined host/device objects after objcopy --strip-debug matched byte for byte. GPU runtime and ROCm were untested. Full-application integration tests were outside the focused runs.

Governance Notes

No documentation update required. The changes are local declarations with the same types and initializers. Public interfaces, INPUT parsing and defaults, and build configuration are unchanged. <new> declares std::new_handler and <memory> declares std::unique_ptr. The four existing global reads flagged by the checker occur in the same initializers on both sides of the diff (net zero). No exception is requested.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant