diff --git a/source/src_io/write_wfc_realspace.cpp b/source/src_io/write_wfc_realspace.cpp index 20ea850801..2f8fe4b14b 100644 --- a/source/src_io/write_wfc_realspace.cpp +++ b/source/src_io/write_wfc_realspace.cpp @@ -60,9 +60,9 @@ namespace Write_Wfc_Realspace // t0 t1 t2 t3 t4 t5 t6 t7 // --------------------------------> // rank0 k0 k1 k2 k3 k4 k5 - // \ \ \ \ \ \ + // \ \ \ \ \ \ // rank1 k0 k1 k2 k3 k4 k5 - // \ \ \ \ \ \ + // \ \ \ \ \ \ // rank2 k0 k1 k2 k3 k4 k5 @@ -157,4 +157,4 @@ namespace Write_Wfc_Realspace } #endif } -}; \ No newline at end of file +}; diff --git a/source/src_pdiag/pdiag_double.cpp b/source/src_pdiag/pdiag_double.cpp index 84946e736b..57ac975208 100644 --- a/source/src_pdiag/pdiag_double.cpp +++ b/source/src_pdiag/pdiag_double.cpp @@ -664,22 +664,29 @@ void Pdiag_Double::diago_double_begin( MPI_Bcast(&maxnloc, 1, MPI_LONG, 0, comm_2D); wfc_2d.create(this->ncol,this->nrow); // Fortran order - int is_already_decomposed, elpa_error; static elpa_t handle; + static bool has_set_elpa_handle = false; + if(! has_set_elpa_handle) + { + set_elpahandle(handle, desc, nrow, ncol); + has_set_elpa_handle = true; + } + int is_already_decomposed; if(ifElpaHandle(GlobalC::CHR.get_new_e_iteration(), (GlobalV::CALCULATION=="nscf"))) { - ModuleBase::timer::tick("Diago_LCAO_Matrix","elpa_set"); + ModuleBase::timer::tick("Diago_LCAO_Matrix","decompose_S"); LapackConnector::copy(nloc, s_mat, inc, Stmp, inc); - set_elpahandle(handle, desc, nrow, ncol); is_already_decomposed=0; - ModuleBase::timer::tick("Diago_LCAO_Matrix","elpa_set"); + ModuleBase::timer::tick("Diago_LCAO_Matrix","decompose_S"); } else { is_already_decomposed=1; } + ModuleBase::timer::tick("Diago_LCAO_Matrix","elpa_solve"); + int elpa_error; elpa_generalized_eigenvectors_d(handle, h_mat, Stmp, eigen, wfc_2d.c, is_already_decomposed, &elpa_error); ModuleBase::timer::tick("Diago_LCAO_Matrix","elpa_solve"); @@ -1019,15 +1026,16 @@ void Pdiag_Double::diago_complex_begin( MPI_Bcast(&maxnloc, 1, MPI_LONG, 0, comm_2D); wfc_2d.create(this->ncol,this->nrow); // Fortran order - LapackConnector::copy(nloc, cs_mat, inc, Stmp, inc); - ModuleBase::timer::tick("Diago_LCAO_Matrix","elpa_set"); static elpa_t handle; - - if(ifElpaHandle(GlobalC::CHR.get_new_e_iteration(), (GlobalV::CALCULATION=="nscf"))) + static bool has_set_elpa_handle = false; + if(! has_set_elpa_handle) { set_elpahandle(handle, desc, nrow, ncol); + has_set_elpa_handle = true; } - ModuleBase::timer::tick("Diago_LCAO_Matrix","elpa_set"); + + LapackConnector::copy(nloc, cs_mat, inc, Stmp, inc); + ModuleBase::timer::tick("Diago_LCAO_Matrix","elpa_solve"); int elpa_derror; elpa_generalized_eigenvectors_dc(handle, reinterpret_cast(ch_mat),