From cf66253eff2f0035f95c6e1d433aa08a36d83d83 Mon Sep 17 00:00:00 2001 From: haozhihan Date: Thu, 11 Jan 2024 15:20:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?add=20=E2=80=9Ccg-lcao=E2=80=9D=20ks-solver?= =?UTF-8?q?=20method=20for=20lcao=20basis=20cg-lcao=20method=20currently?= =?UTF-8?q?=20only=20supports=20serial=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/module_base/global_function.h | 2 +- source/module_basis/module_ao/ORB_control.cpp | 6 +- source/module_elecstate/elecstate_lcao.cpp | 8 +- source/module_elecstate/elecstate_print.cpp | 4 + .../module_elecstate/module_dm/cal_dm_psi.cpp | 15 +- .../hamilt_lcaodft/local_orbital_wfc.cpp | 2 +- .../module_deltaspin/cal_mw_from_lambda.cpp | 2 +- source/module_hsolver/diago_cg.cpp | 3 +- source/module_hsolver/diago_iter_assist.h | 10 + source/module_hsolver/hsolver_lcao.cpp | 224 ++++++++++++++++-- source/module_hsolver/hsolver_lcao.h | 23 +- source/module_io/input.cpp | 9 +- 12 files changed, 267 insertions(+), 41 deletions(-) diff --git a/source/module_base/global_function.h b/source/module_base/global_function.h index e31434085d3..143ca350573 100644 --- a/source/module_base/global_function.h +++ b/source/module_base/global_function.h @@ -350,7 +350,7 @@ T ddot_real( //========================================================== static inline bool IS_COLUMN_MAJOR_KS_SOLVER() { - return GlobalV::KS_SOLVER=="genelpa" || GlobalV::KS_SOLVER=="scalapack_gvx" || GlobalV::KS_SOLVER=="cusolver"; + return GlobalV::KS_SOLVER=="genelpa" || GlobalV::KS_SOLVER=="scalapack_gvx" || GlobalV::KS_SOLVER=="cusolver" || GlobalV::KS_SOLVER=="cg_in_lcao"; } }//namespace GlobalFunc diff --git a/source/module_basis/module_ao/ORB_control.cpp b/source/module_basis/module_ao/ORB_control.cpp index 02b0c001fa2..1435bf8e93e 100644 --- a/source/module_basis/module_ao/ORB_control.cpp +++ b/source/module_basis/module_ao/ORB_control.cpp @@ -184,7 +184,7 @@ void ORB_control::setup_2d_division(std::ofstream& ofs_running, ofs_running << "\n SETUP THE DIVISION OF H/S MATRIX" << std::endl; // (1) calculate nrow, ncol, nloc. - if (ks_solver == "genelpa" || ks_solver == "scalapack_gvx" || ks_solver == "cusolver") + if (ks_solver == "genelpa" || ks_solver == "scalapack_gvx" || ks_solver == "cusolver" || ks_solver == "cg_in_lcao") { ofs_running << " divide the H&S matrix using 2D block algorithms." << std::endl; #ifdef __MPI @@ -205,7 +205,7 @@ void ORB_control::setup_2d_division(std::ofstream& ofs_running, bool div_2d; if (ks_solver == "lapack" || ks_solver == "cg" || ks_solver == "dav") div_2d = false; #ifdef __MPI - else if (ks_solver == "genelpa" || ks_solver == "scalapack_gvx" || ks_solver == "cusolver") div_2d = true; + else if (ks_solver == "genelpa" || ks_solver == "scalapack_gvx" || ks_solver == "cusolver" || ks_solver == "cg_in_lcao") div_2d = true; #endif else { @@ -382,7 +382,7 @@ assert(nb2d > 0); } // init blacs context for genelpa - if (ks_solver == "genelpa" || ks_solver == "scalapack_gvx" || ks_solver == "cusolver") + if (ks_solver == "genelpa" || ks_solver == "scalapack_gvx" || ks_solver == "cusolver" || ks_solver == "cg_in_lcao") { pv->set_desc(nlocal, nlocal, pv->nrow); pv->set_desc_wfc_Eij(nlocal, nbands, pv->nrow); diff --git a/source/module_elecstate/elecstate_lcao.cpp b/source/module_elecstate/elecstate_lcao.cpp index 09927617bdd..ea2a6479ecd 100644 --- a/source/module_elecstate/elecstate_lcao.cpp +++ b/source/module_elecstate/elecstate_lcao.cpp @@ -103,7 +103,7 @@ void ElecStateLCAO>::psiToRho(const psi::Psi> dm_k_2d(); if (GlobalV::KS_SOLVER == "genelpa" || GlobalV::KS_SOLVER == "scalapack_gvx" || GlobalV::KS_SOLVER == "lapack" - || GlobalV::KS_SOLVER == "cusolver") // Peize Lin test 2019-05-15 + || GlobalV::KS_SOLVER == "cusolver" || GlobalV::KS_SOLVER == "cg_in_lcao") // Peize Lin test 2019-05-15 { //cal_dm(this->loc->ParaV, this->wg, psi, this->loc->dm_k); elecstate::cal_dm_psi(this->DM->get_paraV_pointer(), this->wg, psi, *(this->DM)); @@ -124,7 +124,7 @@ void ElecStateLCAO>::psiToRho(const psi::Psi::psiToRho(const psi::Psi& psi) this->calEBand(); if (GlobalV::KS_SOLVER == "genelpa" || GlobalV::KS_SOLVER == "scalapack_gvx" || GlobalV::KS_SOLVER == "lapack" - || GlobalV::KS_SOLVER == "cusolver") + || GlobalV::KS_SOLVER == "cusolver" || GlobalV::KS_SOLVER == "cg_in_lcao") { ModuleBase::timer::tick("ElecStateLCAO", "cal_dm_2d"); // get DMK in 2d-block format @@ -196,7 +196,7 @@ void ElecStateLCAO::psiToRho(const psi::Psi& psi) { // for gamma_only case, no convertion occured, just for print. if (GlobalV::KS_SOLVER == "genelpa" || GlobalV::KS_SOLVER == "scalapack_gvx" - || GlobalV::KS_SOLVER == "cusolver") + || GlobalV::KS_SOLVER == "cusolver" || GlobalV::KS_SOLVER == "cg_in_lcao") { psi.fix_k(ik); this->print_psi(psi); diff --git a/source/module_elecstate/elecstate_print.cpp b/source/module_elecstate/elecstate_print.cpp index 1cc402ede56..9a50ac6d782 100644 --- a/source/module_elecstate/elecstate_print.cpp +++ b/source/module_elecstate/elecstate_print.cpp @@ -271,6 +271,10 @@ void ElecState::print_etot(const bool converged, { label = "CG"; } + else if (ks_solver_type == "cg_in_lcao") + { + label = "CGAO"; + } else if (ks_solver_type == "lapack") { label = "LA"; diff --git a/source/module_elecstate/module_dm/cal_dm_psi.cpp b/source/module_elecstate/module_dm/cal_dm_psi.cpp index 2e95513c410..4164294b759 100644 --- a/source/module_elecstate/module_dm/cal_dm_psi.cpp +++ b/source/module_elecstate/module_dm/cal_dm_psi.cpp @@ -116,7 +116,14 @@ void cal_dm_psi(const Parallel_Orbitals* ParaV, // C++: dm(iw1,iw2) = wfc(ib,iw1).T * wg_wfc(ib,iw2) #ifdef __MPI - psiMulPsiMpi(wg_wfc, wfc, dmk_pointer, ParaV->desc_wfc, ParaV->desc); + + if (GlobalV::KS_SOLVER == "cg_in_lcao") + { + psiMulPsi(wg_wfc, wfc, dmk_pointer); + } else + { + psiMulPsiMpi(wg_wfc, wfc, dmk_pointer, ParaV->desc_wfc, ParaV->desc); + } #else psiMulPsi(wg_wfc, wfc, dmk_pointer); #endif @@ -126,7 +133,7 @@ void cal_dm_psi(const Parallel_Orbitals* ParaV, return; } -#ifdef __MPI +// #ifdef __MPI void psiMulPsiMpi(const psi::Psi& psi1, const psi::Psi& psi2, double* dm_out, @@ -195,7 +202,7 @@ void psiMulPsiMpi(const psi::Psi>& psi1, ModuleBase::timer::tick("psiMulPsiMpi", "pdgemm"); } -#else +// #else void psiMulPsi(const psi::Psi& psi1, const psi::Psi& psi2, double* dm_out) { const double one_float = 1.0, zero_float = 0.0; @@ -241,6 +248,6 @@ void psiMulPsi(const psi::Psi>& psi1, dm_out, &nlocal); } -#endif +// #endif } // namespace elecstate diff --git a/source/module_hamilt_lcao/hamilt_lcaodft/local_orbital_wfc.cpp b/source/module_hamilt_lcao/hamilt_lcaodft/local_orbital_wfc.cpp index d78adb5fc29..8e7627611a6 100644 --- a/source/module_hamilt_lcao/hamilt_lcaodft/local_orbital_wfc.cpp +++ b/source/module_hamilt_lcao/hamilt_lcaodft/local_orbital_wfc.cpp @@ -40,7 +40,7 @@ void Local_Orbital_wfc::gamma_file(psi::Psi* psid, elecstate::ElecState* //allocate psi int ncol = this->ParaV->ncol_bands; - if (GlobalV::KS_SOLVER == "genelpa" || GlobalV::KS_SOLVER == "lapack_gvx" || GlobalV::KS_SOLVER == "scalapack_gvx" + if (GlobalV::KS_SOLVER == "genelpa" || GlobalV::KS_SOLVER == "lapack_gvx" || GlobalV::KS_SOLVER == "scalapack_gvx" || GlobalV::KS_SOLVER == "cg_in_lcao" #ifdef __CUSOLVER_LCAO || GlobalV::KS_SOLVER == "cusolver" #endif diff --git a/source/module_hamilt_lcao/module_deltaspin/cal_mw_from_lambda.cpp b/source/module_hamilt_lcao/module_deltaspin/cal_mw_from_lambda.cpp index e560281c5a2..04152b4c075 100644 --- a/source/module_hamilt_lcao/module_deltaspin/cal_mw_from_lambda.cpp +++ b/source/module_hamilt_lcao/module_deltaspin/cal_mw_from_lambda.cpp @@ -16,7 +16,7 @@ void SpinConstrain, psi::DEVICE_CPU>::cal_mw_from_lambda(in = dynamic_cast>*>(this->pelec); this->pelec->calculate_weights(); this->pelec->calEBand(); - if (this->KS_SOLVER == "genelpa" || this->KS_SOLVER == "scalapack_gvx" || this->KS_SOLVER == "lapack") + if (this->KS_SOLVER == "genelpa" || this->KS_SOLVER == "scalapack_gvx" || this->KS_SOLVER == "lapack" || this->KS_SOLVER == "cg_in_lcao") { elecstate::cal_dm_psi(this->ParaV, pelec_lcao->wg, *(this->psi), *(pelec_lcao->get_DM())); } diff --git a/source/module_hsolver/diago_cg.cpp b/source/module_hsolver/diago_cg.cpp index eda437c2503..cb341c05c2c 100644 --- a/source/module_hsolver/diago_cg.cpp +++ b/source/module_hsolver/diago_cg.cpp @@ -591,13 +591,14 @@ void DiagoCG::diag( namespace hsolver { template class DiagoCG, psi::DEVICE_CPU>; template class DiagoCG, psi::DEVICE_CPU>; +template class DiagoCG; #if ((defined __CUDA) || (defined __ROCM)) template class DiagoCG, psi::DEVICE_GPU>; template class DiagoCG, psi::DEVICE_GPU>; #endif #ifdef __LCAO -template class DiagoCG; +// template class DiagoCG; #if ((defined __CUDA) || (defined __ROCM)) template class DiagoCG; #endif diff --git a/source/module_hsolver/diago_iter_assist.h b/source/module_hsolver/diago_iter_assist.h index 091b73e546b..8fc707d0044 100644 --- a/source/module_hsolver/diago_iter_assist.h +++ b/source/module_hsolver/diago_iter_assist.h @@ -18,6 +18,10 @@ class DiagoIterAssist static Real PW_DIAG_THR; static int PW_DIAG_NMAX; + static Real LCAO_DIAG_THR; + static int LCAO_DIAG_NMAX; + + /// average steps of last cg diagonalization for each band. static Real avg_iter; static bool need_subspace; @@ -90,6 +94,12 @@ int DiagoIterAssist::PW_DIAG_NMAX = 30; template typename DiagoIterAssist::Real DiagoIterAssist::PW_DIAG_THR = 1.0e-2; +template +int DiagoIterAssist::LCAO_DIAG_NMAX = 50; + +template +typename DiagoIterAssist::Real DiagoIterAssist::LCAO_DIAG_THR = 1.0e-12; + template bool DiagoIterAssist::need_subspace = false; diff --git a/source/module_hsolver/hsolver_lcao.cpp b/source/module_hsolver/hsolver_lcao.cpp index 83a9fed4e19..5d37c935e4f 100644 --- a/source/module_hsolver/hsolver_lcao.cpp +++ b/source/module_hsolver/hsolver_lcao.cpp @@ -1,8 +1,14 @@ #include "hsolver_lcao.h" #include "diago_blas.h" +#include "diago_cg.h" +#include +#include +#include #include "module_base/timer.h" #include "module_io/write_HS.h" +#include "module_hsolver/diago_iter_assist.h" +#include "module_hsolver/kernels/math_kernel_op.h" #ifdef __ELPA #include "diago_elpa.h" @@ -10,11 +16,12 @@ #ifdef __CUSOLVER_LCAO #include "diago_cusolver.h" #endif + namespace hsolver { -template -void HSolverLCAO::solveTemplate(hamilt::Hamilt* pHamilt, +template +void HSolverLCAO::solveTemplate(hamilt::Hamilt* pHamilt, psi::Psi& psi, elecstate::ElecState* pes, const std::string method_in, @@ -24,6 +31,8 @@ void HSolverLCAO::solveTemplate(hamilt::Hamilt* pHamilt, ModuleBase::timer::tick("HSolverLCAO", "solve"); // select the method of diagonalization this->method = method_in; + + // init if (this->method == "scalapack_gvx") { if (this->pdiagh != nullptr) @@ -99,24 +108,67 @@ void HSolverLCAO::solveTemplate(hamilt::Hamilt* pHamilt, */ ModuleBase::WARNING_QUIT("HSolverLCAO::solve", "This method of DiagH is not supported!"); } + else if (this->method == "cg_in_lcao") + { + + if (this->pdiagh != nullptr) + { + if (this->pdiagh->method != this->method) + { + delete reinterpret_cast*>(this->pdiagh); + this->pdiagh = nullptr; + } + } + if (this->pdiagh == nullptr) + { + auto subspace_func = [](const ct::Tensor& psi_in, ct::Tensor& psi_out) { + // psi_in should be a 2D tensor: + // psi_in.shape() = [nbands, nbasis] + const auto ndim = psi_in.shape().ndim(); + REQUIRES_OK(ndim == 2, "dims of psi_in should be less than or equal to 2"); + }; + this->pdiagh = new DiagoCG( + GlobalV::BASIS_TYPE, + GlobalV::CALCULATION, + false, + subspace_func, + DiagoIterAssist::LCAO_DIAG_THR, + DiagoIterAssist::LCAO_DIAG_NMAX, + GlobalV::NPROC_IN_POOL + ); + this->pdiagh->method = this->method; + } + } else { ModuleBase::WARNING_QUIT("HSolverLCAO::solve", "This method of DiagH is not supported!"); } + + + if (this->method == "cg_in_lcao") + { + this->precondition_lcao.resize(psi.get_nbasis()); + + using Real = typename GetTypeReal::type; + // set precondition + for (size_t i = 0; i < precondition_lcao.size(); i++) + { + precondition_lcao[i] = 1.0; + } + } + + /// Loop over k points for solve Hamiltonian to charge density for (int ik = 0; ik < psi.get_nk(); ++ik) { /// update H(k) for each k point pHamilt->updateHk(ik); - hamilt::MatrixBlock h_mat, s_mat; - psi.fix_k(ik); - /// solve eigenvector and eigenvalue for H(k) - double* p_eigenvalues = &(pes->ekb(ik, 0)); - this->hamiltSolvePsiK(pHamilt, psi, p_eigenvalues); + // solve eigenvector and eigenvalue for H(k) + this->hamiltSolvePsiK(pHamilt, psi, &(pes->ekb(ik, 0))); if (skip_charge) { @@ -124,7 +176,14 @@ void HSolverLCAO::solveTemplate(hamilt::Hamilt* pHamilt, } } - if (this->method != "genelpa" && this->method != "scalapack_gvx" && this->method != "lapack") + if (this->method == "cg_in_lcao") + { + this->is_first_scf = false; + } + + + if (this->method != "genelpa" && this->method != "scalapack_gvx" && this->method != "lapack" + && this->method != "cusolver" && this->method != "cg_in_lcao") { delete this->pdiagh; this->pdiagh = nullptr; @@ -142,17 +201,18 @@ void HSolverLCAO::solveTemplate(hamilt::Hamilt* pHamilt, pes->psiToRho(psi); ModuleBase::timer::tick("HSolverLCAO", "solve"); } -template -int HSolverLCAO::out_mat_hs = 0; -template -int HSolverLCAO::out_mat_hsR = 0; -template -int HSolverLCAO::out_mat_t = 0; -template -int HSolverLCAO::out_mat_dh = 0; - -template -void HSolverLCAO::solve(hamilt::Hamilt* pHamilt, + +template +int HSolverLCAO::out_mat_hs = 0; +template +int HSolverLCAO::out_mat_hsR = 0; +template +int HSolverLCAO::out_mat_t = 0; +template +int HSolverLCAO::out_mat_dh = 0; + +template +void HSolverLCAO::solve(hamilt::Hamilt* pHamilt, psi::Psi& psi, elecstate::ElecState* pes, const std::string method_in, @@ -161,12 +221,132 @@ void HSolverLCAO::solve(hamilt::Hamilt* pHamilt, this->solveTemplate(pHamilt, psi, pes, this->method, skip_charge); } -template -void HSolverLCAO::hamiltSolvePsiK(hamilt::Hamilt* hm, psi::Psi& psi, double* eigenvalue) +template +void HSolverLCAO::hamiltSolvePsiK(hamilt::Hamilt* hm, psi::Psi& psi, double* eigenvalue) { ModuleBase::TITLE("HSolverLCAO", "hamiltSolvePsiK"); ModuleBase::timer::tick("HSolverLCAO", "hamiltSolvePsiK"); - this->pdiagh->diag(hm, psi, eigenvalue); + + if (this->method != "cg_in_lcao") + { + this->pdiagh->diag(hm, psi, eigenvalue); + } + else + { + + using ct_Device = typename ct::PsiToContainer::type; + auto cg = reinterpret_cast*>(this->pdiagh); + + hamilt::MatrixBlock h_mat, s_mat; + hm->matrix(h_mat, s_mat); + + // set h_mat & s_mat + for (int i = 0; i < h_mat.row; i++) + { + for (int j = i; j < h_mat.col; j++) + { + h_mat.p[h_mat.row * j + i] = hsolver::my_conj(h_mat.p[h_mat.row * i + j]); + s_mat.p[s_mat.row * j + i] = hsolver::my_conj(s_mat.p[s_mat.row * i + j]); + } + } + + const T * one_ = nullptr, * zero_ = nullptr; + one_ = new T(static_cast(1.0)); + zero_ = new T(static_cast(0.0)); + + auto hpsi_func = [h_mat, one_, zero_](const ct::Tensor& psi_in, ct::Tensor& hpsi_out) { + ModuleBase::timer::tick("DiagoCG_New", "hpsi_func"); + // psi_in should be a 2D tensor: + // psi_in.shape() = [nbands, nbasis] + const auto ndim = psi_in.shape().ndim(); + REQUIRES_OK(ndim <= 2, "dims of psi_in should be less than or equal to 2"); + + Device * ctx = {}; + + gemv_op()( + ctx, + 'N', + h_mat.row, + h_mat.col, + one_, + h_mat.p, + h_mat.row, + psi_in.data(), + 1, + zero_, + hpsi_out.data(), + 1); + + ModuleBase::timer::tick("DiagoCG_New", "hpsi_func"); + }; + + auto spsi_func = [s_mat, one_, zero_](const ct::Tensor& psi_in, ct::Tensor& spsi_out) { + ModuleBase::timer::tick("DiagoCG_New", "spsi_func"); + // psi_in should be a 2D tensor: + // psi_in.shape() = [nbands, nbasis] + const auto ndim = psi_in.shape().ndim(); + REQUIRES_OK(ndim <= 2, "dims of psi_in should be less than or equal to 2"); + + Device * ctx = {}; + + gemv_op()( + ctx, + 'N', + s_mat.row, + s_mat.col, + one_, + s_mat.p, + s_mat.row, + psi_in.data(), + 1, + zero_, + spsi_out.data(), + 1); + + ModuleBase::timer::tick("DiagoCG_New", "spsi_func"); + }; + + if (this->is_first_scf) + { + for (size_t i = 0; i < psi.get_nbands(); i++) + { + for (size_t j = 0; j < psi.get_nbasis(); j++) + { + psi(i, j) = *zero_; + } + psi(i, i) = *one_; + } + } + + auto psi_tensor = ct::TensorMap( + psi.get_pointer(), + ct::DataTypeToEnum::value, + ct::DeviceTypeToEnum::value, + ct::TensorShape({psi.get_nbands(), psi.get_nbasis()}) + ).slice({0, 0}, {psi.get_nbands(), psi.get_current_nbas()}); + + auto eigen_tensor = ct::TensorMap( + eigenvalue, + ct::DataTypeToEnum::value, + ct::DeviceTypeToEnum::value, + ct::TensorShape({psi.get_nbands()}) + ); + + auto prec_tensor = ct::TensorMap( + this->precondition_lcao.data(), + ct::DataTypeToEnum::value, + ct::DeviceTypeToEnum::value, + ct::TensorShape({static_cast(this->precondition_lcao.size())}) + ).slice({0}, {psi.get_current_nbas()}); + + + cg->diag(hpsi_func, spsi_func, psi_tensor, eigen_tensor, prec_tensor); + + // TODO: Double check tensormap's potential problem + ct::TensorMap(psi.get_pointer(), psi_tensor, {psi.get_nbands(), psi.get_nbasis()}).sync(psi_tensor); + } + + ModuleBase::timer::tick("HSolverLCAO", "hamiltSolvePsiK"); } diff --git a/source/module_hsolver/hsolver_lcao.h b/source/module_hsolver/hsolver_lcao.h index 5a702590016..09a3bc631d7 100644 --- a/source/module_hsolver/hsolver_lcao.h +++ b/source/module_hsolver/hsolver_lcao.h @@ -7,8 +7,8 @@ namespace hsolver { - template - class HSolverLCAO : public HSolver +template +class HSolverLCAO : public HSolver { public: HSolverLCAO(const Parallel_Orbitals* ParaV_in) @@ -40,8 +40,27 @@ namespace hsolver elecstate::ElecState* pes );*/ const Parallel_Orbitals* ParaV; + + + bool is_first_scf = true; + + using Real = typename GetTypeReal::type; + std::vector precondition_lcao; }; + +template +inline T my_conj(T value) +{ + return value; +} + +template <> +inline std::complex my_conj(std::complex value) +{ + return std::conj(value); +} + } // namespace hsolver #endif \ No newline at end of file diff --git a/source/module_io/input.cpp b/source/module_io/input.cpp index a4750c05348..ac253d6364f 100644 --- a/source/module_io/input.cpp +++ b/source/module_io/input.cpp @@ -3828,9 +3828,14 @@ void Input::Check(void) } else if (basis_type == "lcao") { - if (ks_solver == "cg") + if (ks_solver == "cg_in_lcao") { - ModuleBase::WARNING_QUIT("Input", "not ready for cg method in lcao ."); // xiaohui add 2013-09-04 + // ModuleBase::WARNING_QUIT("Input", "not ready for cg method in lcao ."); // xiaohui add 2013-09-04 +#ifdef __MPI + GlobalV::ofs_warning << "cg_in_lcao is under testing" << std::endl; +#else + ModuleBase::WARNING_QUIT("Input", "cg_in_lcao can not be used for series version."); +#endif } else if (ks_solver == "genelpa") { From 25bd18ce2fe22b3861e34d391780a4674a857b19 Mon Sep 17 00:00:00 2001 From: haozhihan Date: Sat, 13 Jan 2024 16:34:38 +0800 Subject: [PATCH 2/3] fix build bug in github --- source/module_hsolver/diago_cg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/module_hsolver/diago_cg.cpp b/source/module_hsolver/diago_cg.cpp index cb341c05c2c..f91052caaa7 100644 --- a/source/module_hsolver/diago_cg.cpp +++ b/source/module_hsolver/diago_cg.cpp @@ -591,14 +591,14 @@ void DiagoCG::diag( namespace hsolver { template class DiagoCG, psi::DEVICE_CPU>; template class DiagoCG, psi::DEVICE_CPU>; -template class DiagoCG; +// template class DiagoCG; #if ((defined __CUDA) || (defined __ROCM)) template class DiagoCG, psi::DEVICE_GPU>; template class DiagoCG, psi::DEVICE_GPU>; #endif #ifdef __LCAO -// template class DiagoCG; +template class DiagoCG; #if ((defined __CUDA) || (defined __ROCM)) template class DiagoCG; #endif From f18e07e7a7f693de469e7af5e193754231ff2fc8 Mon Sep 17 00:00:00 2001 From: haozhihan Date: Mon, 15 Jan 2024 09:21:32 +0800 Subject: [PATCH 3/3] fix 247: io_input_test bug in integration test --- source/module_io/input.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/source/module_io/input.cpp b/source/module_io/input.cpp index 57439181de2..8af42b08528 100644 --- a/source/module_io/input.cpp +++ b/source/module_io/input.cpp @@ -3844,14 +3844,13 @@ void Input::Check(void) } else if (basis_type == "lcao") { - if (ks_solver == "cg_in_lcao") + if (ks_solver == "cg") + { + ModuleBase::WARNING_QUIT("Input", "not ready for cg method in lcao ."); // xiaohui add 2013-09-04 + } + else if (ks_solver == "cg_in_lcao") { - // ModuleBase::WARNING_QUIT("Input", "not ready for cg method in lcao ."); // xiaohui add 2013-09-04 -#ifdef __MPI GlobalV::ofs_warning << "cg_in_lcao is under testing" << std::endl; -#else - ModuleBase::WARNING_QUIT("Input", "cg_in_lcao can not be used for series version."); -#endif } else if (ks_solver == "genelpa") {