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 #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 #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>
* Refactor: pass basis_type/calculation into diag_subspace_init, drop dead test_exit_cond
Group E, the last PARAM cluster in source_hsolver. Both remaining reads were in
DiagoIterAssist, which is an all-static class.
diag_subspace_init used PARAM.inp.basis_type and PARAM.inp.calculation to pick
how the rotation matrix is applied to psi (skip the gemm entirely, apply it over
dmax rows, or over dmin rows). Both are now parameters. They are threaded rather
than added as static members: the class already carries mutable static config
(PW_DIAG_THR, SCF_ITER, ...), and coding rule 2 in AGENTS.md discourages adding
more workflow switches that can be set from several places. There are only two
call sites, so parameters are cheap here.
- HSolverLIP gains basis_type and calculation, mirroring HSolverPW which already
receives both.
- PSIPrepare already holds basis_type as a member; calculation is taken from
PARAM at that call site. source_psi is outside this refactor and already reads
PARAM in the same function, so this introduces no new dependency there -- it
just stops source_hsolver from reaching for the global itself.
test_exit_cond is deleted rather than converted. It has no caller anywhere in
the tree: DiagoCG and Diago_DavSubspace each define their own independent
test_exit_cond, and Diago_DavSubspace's already takes scf as an argument, which
is the shape this one would have needed. Its only apparent user is
test/test_diago_assist.cpp, which no CMakeLists references and which could not
compile if it were built (it includes a misspelled "diago_iter_assis.h", places
a bare statement in a class body, and calls EXPECT_EQ with one argument). That
file is left untouched -- it was already dead before this change, and removing
it is a separate call for the maintainers.
PARAM occurrences in source_hsolver production code: 5 -> 0. The only remaining
match in non-test code is a comment in simple_pexsi.cpp recording that a
hardcoded 2 should eventually become nspin.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* chore: drop accidentally committed CI notes from the branch
CI提速方案.md is a local working note that was swept into the previous commit
by a `git add -A`. It is unrelated to this PR's refactor and should not be part
of the tree; removing it here rather than rewriting history, since a merge of
develop has since landed on top of that commit.
The file is untracked, not deleted, so it stays in the local working copy.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
0 commit comments