You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor: inject nlocal/nbands into the LCAO dense diagonalizers
Group D of the source_hsolver PARAM removal, and the largest single cluster:
the six dense LCAO diagonalizers all sized their eigenvalue buffers from
PARAM.globalv.nlocal and copied out PARAM.inp.nbands eigenvalues.
Each of DiagoLapack, DiagoScalapack, DiagoElpa, DiagoElpaNative, DiagoCusolver
and DiagoCusolverMP now takes (nlocal, nbands) through its constructor and
stores them as members. DiagoElpaNative additionally takes use_gpu, replacing
its PARAM.inp.device == "gpu" test.
HSolverLCAO gains nbands and use_gpu (it already received nlocal in deepmodeling#7711) and
supplies all eleven construction sites across hamiltSolvePsiK, parakSolve and
parakSolve_cusolver. The three call contexts agree on both values: parakSolve
distributes the same nlocal x nlocal matrix over a smaller pool grid, and
parakSolve_cusolver gathers it per k-point, so a single pair covers all of them.
nbands is injected rather than read from ParaV->get_nbands(). The two are equal
for the LCAO path (LCAO_init_basis.cpp seeds ParaV from PARAM.inp.nbands), but
module_lr sets paraMat_.nbands to nocc + nvirt, so sourcing it from ParaV would
plant a trap for any future caller. The existing ParaV->get_nbands() reads
inside parakSolve are left alone; they are not PARAM reads and are out of scope.
In diago_scalapack.cpp, four call sites pass the address of the value to the
Fortran routines. PARAM.globalv returns a const reference, so &PARAM.globalv.nlocal
was already a const int*, matching pdsygvx_/pzhegvx_'s const int* n; &this->nlocal
has the same type.
Also resolves the two error-message strings in diago_lapack.cpp and
diago_scalapack.cpp that embedded "PARAM.inp.nbands = ". These were deferred
from deepmodeling#7706 because removing them needed exactly the nbands member added here.
Two dead commented-out ELPA_Solver calls in diago_elpa.cpp are removed rather
than updated; each duplicated the live statement two lines below it.
The three LCAO diagonalizer tests supply their own nlocal/nbands, which they
already read from the H/S input files, so their PARAM.sys.nlocal /
PARAM.input.nbands writes and the now-dead `#define private public` include
blocks are dropped.
PARAM occurrences in source_hsolver production code: 60 -> 5. What remains is
DiagoIterAssist's basis_type/calculation switches (group E) and one comment in
simple_pexsi.cpp.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0 commit comments