@@ -76,10 +76,6 @@ DiagoDavid<T, Device>::DiagoDavid(const Real* precondition_in,
7676 resmem_complex_op ()(this ->hcc , nbase_x * nbase_x, " DAV::hcc" );
7777 setmem_complex_op ()(this ->hcc , 0 , nbase_x * nbase_x);
7878
79- // scc(nbase_x, nbase_x); // Overlap on the reduced basis
80- // resmem_complex_op()(this->ctx, this->scc, nbase_x * nbase_x, "DAV::scc");
81- // setmem_complex_op()(this->ctx, this->scc, 0, nbase_x * nbase_x);
82-
8379 // vcc(nbase_x, nbase_x); // Eigenvectors of hcc
8480 resmem_complex_op ()(this ->vcc , nbase_x * nbase_x, " DAV::vcc" );
8581 setmem_complex_op ()(this ->vcc , 0 , nbase_x * nbase_x);
@@ -106,7 +102,6 @@ DiagoDavid<T, Device>::~DiagoDavid()
106102 delmem_complex_op ()(this ->hpsi );
107103 delmem_complex_op ()(this ->spsi );
108104 delmem_complex_op ()(this ->hcc );
109- // delmem_complex_op()(this->ctx, this->scc);
110105 delmem_complex_op ()(this ->vcc );
111106 delmem_complex_op ()(this ->lagrange_matrix );
112107 base_device::memory::delete_memory_op<Real, base_device::DEVICE_CPU>()(this ->eigenvalue );
@@ -190,9 +185,9 @@ int DiagoDavid<T, Device>::diag_once(const HPsiFunc& hpsi_func,
190185 // slice index in this piece of code is in C manner. i.e. 0:id stands for [0,id)
191186 hpsi_func (basis, hpsi, dim, nband);
192187
193- this ->cal_elem (dim, nbase, nbase_x, this ->notconv , this ->hpsi , this ->spsi , this ->hcc , this -> scc );
188+ this ->cal_elem (dim, nbase, nbase_x, this ->notconv , this ->hpsi , this ->spsi , this ->hcc );
194189
195- this ->diag_zhegvx (nbase, nband, this ->hcc , this -> scc , nbase_x, this ->eigenvalue , this ->vcc );
190+ this ->diag_zhegvx (nbase, nband, this ->hcc , nbase_x, this ->eigenvalue , this ->vcc );
196191
197192 for (int m = 0 ; m < nband; m++)
198193 {
@@ -218,9 +213,9 @@ int DiagoDavid<T, Device>::diag_once(const HPsiFunc& hpsi_func,
218213 unconv.data (),
219214 this ->eigenvalue );
220215
221- this ->cal_elem (dim, nbase, nbase_x, this ->notconv , this ->hpsi , this ->spsi , this ->hcc , this -> scc );
216+ this ->cal_elem (dim, nbase, nbase_x, this ->notconv , this ->hpsi , this ->spsi , this ->hcc );
222217
223- this ->diag_zhegvx (nbase, nband, this ->hcc , this -> scc , nbase_x, this ->eigenvalue , this ->vcc );
218+ this ->diag_zhegvx (nbase, nband, this ->hcc , nbase_x, this ->eigenvalue , this ->vcc );
224219
225220 // check convergence and update eigenvalues
226221 ModuleBase::timer::tick (" DiagoDavid" , " check_update" );
@@ -282,7 +277,6 @@ int DiagoDavid<T, Device>::diag_once(const HPsiFunc& hpsi_func,
282277 this ->hpsi ,
283278 this ->spsi ,
284279 this ->hcc ,
285- this ->scc ,
286280 this ->vcc );
287281 ModuleBase::timer::tick (" DiagoDavid" , " last" );
288282 }
@@ -536,8 +530,7 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
536530 const int & notconv, // number of newly added basis vectors
537531 const T* hpsi,
538532 const T* spsi,
539- T* hcc,
540- T* scc)
533+ T* hcc)
541534{
542535 if (test_david == 1 ) {
543536 ModuleBase::TITLE (" DiagoDavid" , " cal_elem" );
@@ -562,28 +555,12 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
562555 this ->zero ,
563556 hcc + nbase, // notconv * (nbase + notconv)
564557 nbase_x);
565- // scc[nbase] = basis[nbase]' * spsi
566- // gemm_op<T, Device>()(this->ctx,
567- // 'C',
568- // 'N',
569- // notconv,
570- // nbase + notconv,
571- // dim,
572- // this->one,
573- // basis + dim*nbase, // dim * notconv
574- // dim,
575- // spsi, // dim * (nbase + notconv)
576- // dim,
577- // this->zero,
578- // scc + nbase, // notconv * (nbase + notconv)
579- // nbase_x);
580558
581559
582560#ifdef __MPI
583561 if (diag_comm.nproc > 1 )
584562 {
585563 ModuleBase::matrixTranspose_op<T, Device>()(nbase_x, nbase_x, hcc, hcc);
586- // matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
587564
588565 auto * swap = new T[notconv * nbase_x];
589566 syncmem_complex_op ()(swap, hcc + nbase * nbase_x, notconv * nbase_x);
@@ -599,21 +576,13 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
599576 else {
600577 MPI_Reduce (swap, hcc + nbase * nbase_x, notconv * nbase_x, MPI_DOUBLE_COMPLEX, MPI_SUM, 0 , diag_comm.comm );
601578 }
602- // syncmem_complex_op()(this->ctx, this->ctx, swap, scc + nbase * nbase_x, notconv * nbase_x);
603- if (base_device::get_current_precision (swap) == " single" ) {
604- // MPI_Reduce(swap, scc + nbase * nbase_x, notconv * nbase_x, MPI_COMPLEX, MPI_SUM, 0, diag_comm.comm);
605- }
606- else {
607- // MPI_Reduce(swap, scc + nbase * nbase_x, notconv * nbase_x, MPI_DOUBLE_COMPLEX, MPI_SUM, 0, diag_comm.comm);
608- }
579+
609580 }
610581 delete[] swap;
611582
612583 // Parallel_Reduce::reduce_complex_double_pool( hcc + nbase * nbase_x, notconv * nbase_x );
613- // Parallel_Reduce::reduce_complex_double_pool( scc + nbase * nbase_x, notconv * nbase_x );
614584
615585 ModuleBase::matrixTranspose_op<T, Device>()(nbase_x, nbase_x, hcc, hcc);
616- // matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
617586 }
618587#endif
619588
@@ -637,7 +606,6 @@ template <typename T, typename Device>
637606void DiagoDavid<T, Device>::diag_zhegvx(const int & nbase,
638607 const int & nband,
639608 const T* hcc,
640- const T* /* scc*/ ,
641609 const int & nbase_x,
642610 Real* eigenvalue, // in CPU
643611 T* vcc)
@@ -694,7 +662,6 @@ void DiagoDavid<T, Device>::refresh(const int& dim,
694662 T* hpsi,
695663 T* spsi,
696664 T* hcc,
697- T* scc,
698665 T* vcc)
699666{
700667 if (test_david == 1 ) {
@@ -763,42 +730,31 @@ void DiagoDavid<T, Device>::refresh(const int& dim,
763730
764731 setmem_complex_op ()(hcc, 0 , nbase_x * nbase_x);
765732
766- // setmem_complex_op()(this->ctx, scc, 0, nbase_x * nbase_x);
767-
768733 if (this ->device == base_device::GpuDevice)
769734 {
770735#if defined(__CUDA) || defined(__ROCM)
771736 T* hcc_cpu = nullptr ;
772- // T* scc_cpu = nullptr;
773737 T* vcc_cpu = nullptr ;
774738 base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(hcc_cpu,
775739 nbase_x * nbase_x,
776740 " DAV::hcc" );
777- // base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx,
778- // scc_cpu,
779- // nbase_x * nbase_x,
780- // "DAV::scc");
781741 base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(vcc_cpu,
782742 nbase_x * nbase_x,
783743 " DAV::vcc" );
784744
785745 syncmem_d2h_op ()(hcc_cpu, hcc, nbase_x * nbase_x);
786- // syncmem_d2h_op()(this->cpu_ctx, this->ctx, scc_cpu, scc, nbase_x * nbase_x);
787746 syncmem_d2h_op ()(vcc_cpu, vcc, nbase_x * nbase_x);
788747
789748 for (int i = 0 ; i < nbase; i++)
790749 {
791750 hcc_cpu[i * nbase_x + i] = eigenvalue_in[i];
792- // scc_cpu[i * nbase_x + i] = this->one[0];
793751 vcc_cpu[i * nbase_x + i] = this ->one [0 ];
794752 }
795753
796754 syncmem_h2d_op ()(hcc, hcc_cpu, nbase_x * nbase_x);
797- // syncmem_h2d_op()(this->ctx, this->cpu_ctx, scc, scc_cpu, nbase_x * nbase_x);
798755 syncmem_h2d_op ()(vcc, vcc_cpu, nbase_x * nbase_x);
799756
800757 base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(hcc_cpu);
801- // base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx, scc_cpu);
802758 base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(vcc_cpu);
803759#endif
804760 }
@@ -808,7 +764,6 @@ void DiagoDavid<T, Device>::refresh(const int& dim,
808764 {
809765 hcc[i * nbase_x + i] = eigenvalue_in[i];
810766 // sc(i, i) = this->one;
811- // scc[i * nbase_x + i] = this->one[0];
812767 // vc(i, i) = this->one;
813768 vcc[i * nbase_x + i] = this ->one [0 ];
814769 }
0 commit comments