Background
Background
LCAO DeltaSpin calculations spend a large fraction of time in full Hamiltonian diagonalization inside the lambda loop. This issue adds an opt-in subspace acceleration path for LCAO spin-constrained DFT that works in a reduced subspace, with a mixed-precision GEMM implementation, controlled by the sc_strategy parameter (normal by default, i.e. no behavior change).
Feature work
- Subspace engine (
lcao_subspace.cpp, ~870 lines): build the constraint subspace, project H/S, solve the reduced problem, and rotate back; supports nspin=4 LCAO subspace with Pauli sign fixes.
- Diagonalization engine (
diagonalization_engine.{h,cpp}, ~1.1k lines): a reusable engine abstracting the (generalized) eigensolver calls used by the subspace path; C++11-compatible implementation.
- Mixed-precision GEMM: FP32 accumulation with FP64 storage for the LCAO subspace GEMMs, reducing cost while keeping accuracy.
- Correct subspace projector matrices: replace
cal_PI_sub with calculate_PI_sub_from_hr for computing P_I = D_I^dag * D_I; add cal_PI_sub() to DeltaSpin<OperatorLCAO>.
- ScaLAPACK correctness: use global
NLOCAL instead of local nrow in pzgemm calls for the subspace acceleration.
- Performance: eliminate gather redundancy in
lcao_PI_sub_save_ and reduce BFGS allocation jitter.
- RI_2D_Comm extensions: add
comm_map2 and set_value_add overloads needed by the DeltaSpin LCAO subspace path (also removes 114 duplicate template definitions in RI_2D_Comm.hpp that broke the GNU toolchain CI build).
- ElecStateLCAO support: add
init_DM()/get_DM() for the DeltaSpin LCAO subspace path.
Safeguards
- Subspace path is opt-in via
sc_strategy; default normal reproduces existing results bit-for-bit.
- Subspace is disabled for nspin=4 where it is not applicable; a final full diagonalization is performed after the subspace loop for nspin=4.
Scope
source/source_lcao/module_deltaspin/ (lcao_subspace.cpp, diagonalization_engine., lambda_loop.cpp, spin_constrain.)
source/source_estate/elecstate_lcao.h
source/source_lcao/module_ri/RI_2D_Comm.hpp
- Docs: subspace acceleration usage guide
- Unit tests for the subspace/diagonalization engine
Testing
- Compare
sc_strategy=normal vs fast on LCAO DeltaSpin cases: total energy and constrained moments must agree within tolerance.
- GNU toolchain CI build must pass (RI_2D_Comm redefinition fix).
- Unit tests:
DeltaHcc_GemmContribution (column-major GEMM indexing), subspace engine tests.
Dependencies
- Depends on Issue 3 (DeltaSpin lambda strategies and SpinConstrain refactor).
Related
Split out from PR #7693.
Describe the solution you'd like
Above.
Task list only for developers
Notice Possible Changes of Behavior (Reminder only for developers)
No response
Notice any changes of core modules (Reminder only for developers)
No response
Notice Possible Changes of Core Modules (Reminder only for developers)
No response
Additional Context
No response
Task list for Issue attackers (only for developers)
Background
Background
LCAO DeltaSpin calculations spend a large fraction of time in full Hamiltonian diagonalization inside the lambda loop. This issue adds an opt-in subspace acceleration path for LCAO spin-constrained DFT that works in a reduced subspace, with a mixed-precision GEMM implementation, controlled by the
sc_strategyparameter (normalby default, i.e. no behavior change).Feature work
lcao_subspace.cpp, ~870 lines): build the constraint subspace, project H/S, solve the reduced problem, and rotate back; supports nspin=4 LCAO subspace with Pauli sign fixes.diagonalization_engine.{h,cpp}, ~1.1k lines): a reusable engine abstracting the (generalized) eigensolver calls used by the subspace path; C++11-compatible implementation.cal_PI_subwithcalculate_PI_sub_from_hrfor computingP_I = D_I^dag * D_I; addcal_PI_sub()toDeltaSpin<OperatorLCAO>.NLOCALinstead of localnrowinpzgemmcalls for the subspace acceleration.lcao_PI_sub_save_and reduce BFGS allocation jitter.comm_map2andset_value_addoverloads needed by the DeltaSpin LCAO subspace path (also removes 114 duplicate template definitions inRI_2D_Comm.hppthat broke the GNU toolchain CI build).init_DM()/get_DM()for the DeltaSpin LCAO subspace path.Safeguards
sc_strategy; defaultnormalreproduces existing results bit-for-bit.Scope
source/source_lcao/module_deltaspin/(lcao_subspace.cpp, diagonalization_engine., lambda_loop.cpp, spin_constrain.)source/source_estate/elecstate_lcao.hsource/source_lcao/module_ri/RI_2D_Comm.hppTesting
sc_strategy=normalvsfaston LCAO DeltaSpin cases: total energy and constrained moments must agree within tolerance.DeltaHcc_GemmContribution(column-major GEMM indexing), subspace engine tests.Dependencies
Related
Split out from PR #7693.
Describe the solution you'd like
Above.
Task list only for developers
Notice Possible Changes of Behavior (Reminder only for developers)
No response
Notice any changes of core modules (Reminder only for developers)
No response
Notice Possible Changes of Core Modules (Reminder only for developers)
No response
Additional Context
No response
Task list for Issue attackers (only for developers)