Skip to content

Refactor: use explicit C++ types and validate device_exx choices - #58

Closed
Stardust0831 wants to merge 6 commits into
base/explicit-types-20261125from
refactor/explicit-types
Closed

Stardust0831 wants to merge 6 commits into
base/explicit-types-20261125from
refactor/explicit-types

Conversation

@Stardust0831

@Stardust0831 Stardust0831 commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Superseded by two independent draft pull requests from the same base.

Applying both drafts in either order reproduces the tree at f4fb7bd43.

Reminder

  • Read AGENTS.md and the full governance guide.
  • Documented the scope, tests, behavior and limitations below.

Linked Issue

Follows the maintainer review of the EXX device selector.

What's changed?

The first five commits make 55 auto declarations explicit. They cover all five EXX review sites, 33 INPUT declarations, four Wannier spin-output declarations, 12 LCAO radial-table declarations and one CUDA buffer pointer. The types preserve the existing copies, references, iterator constness and shared ownership.

The sixth commit declares cpu and gpu as the allowed values for device_exx in its Input_Item registration. Invalid input now reports the supplied value and both choices. The regression for ddla reads an LCAO INPUT file. The existing EXX test helper checks the GPU restrictions on basis_type, device and ENABLE_LIBRI_GPU. The default remains cpu.

An audit of the original patches and surviving lines from 44 merged PRs targeting develop found 76 introductions. The remaining 21 are in source/source_lcao/test/test_center2orb_orb11.cpp (19) and source/source_io/module_parameter/test/test_input_domain.cpp (2). Editing either legacy test requires a move to unittests/ and a change to its build registration. The existing relax_method iterator was moved by an earlier PR and is excluded from the count.

Across tracked C/C++ and accelerator sources and headers, the inventory changes from 3,112 auto tokens in 573 files to 3,057 in 564 files. The 105 occurrences in comments and 30 in literals are counted separately. Examples of other uses include generic lambda parameters and structured bindings.

Unit Tests and/or Case Tests for my changes

  • On the combined head, fresh GCC C++11 host builds with __GPU_RI disabled and enabled each passed all 53 tests from OMP_NUM_THREADS=1 ./input-tests and the EXX test from OMP_NUM_THREADS=1 ./exx-input-test --gtest_filter=DeviceExxInput.SelectionAndValidation.
  • A small driver calling the production INPUT reader accepted default and explicit cpu. OMP_NUM_THREADS=1 ../cpu/read-device-exx INPUT.ddla exited with status 1 and printed Invalid INPUT parameter 'device_exx': supplied 'ddla'. Expected one String from {cpu, gpu}. Parameter help listed both choices. The EXX test exercised the incompatible basis and device, the missing GPU RI build capability and the supported selection path when __GPU_RI is enabled.
  • For the explicit-type commits, OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 ./radial-tests passed all four CPU radial-table tests on the base and the refactored code. Four Exx_LRI_Interface::set_gpu specializations passed a GCC C++14 syntax check with the LibRI v0.3.0.0 and DDLA v0.0.7 GPU API headers. The additional --gtest_death_test_style=threadsafe control lost captured stdout on the base and the refactored code with Google Test 1.11.
  • In the explicit-type comparison, cmp found byte-identical GCC objects for the eight CPU production translation units under test, including the three .spn writer instantiations. CUDA 12.9.86 compiled the Wang-Teter translation unit for sm_70. cmp matched its PTX and its host object after objcopy --strip-debug removed the compiler-generated temporary filename.
  • git diff --check passed. Full-program MPI, on-device GPU execution and HIP builds were outside these focused checks.

Governance Notes

No documentation update required because the built-in help and generated INPUT manual obtain the allowed values from the updated device_exx registration. No governance exception is requested.

@Stardust0831 Stardust0831 changed the title Refactor: use explicit types in EXX and INPUT code Refactor: use explicit types in INPUT, EXX and related numerical code Nov 25, 2026
@Stardust0831 Stardust0831 changed the title Refactor: use explicit types in INPUT, EXX and related numerical code Refactor: use explicit C++ types and validate device_exx choices Nov 25, 2026
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