@@ -76,10 +76,6 @@ DiagoDavid<T, Device>::DiagoDavid(const Real* precondition_in,
76
76
resmem_complex_op ()(this ->hcc , nbase_x * nbase_x, " DAV::hcc" );
77
77
setmem_complex_op ()(this ->hcc , 0 , nbase_x * nbase_x);
78
78
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
-
83
79
// vcc(nbase_x, nbase_x); // Eigenvectors of hcc
84
80
resmem_complex_op ()(this ->vcc , nbase_x * nbase_x, " DAV::vcc" );
85
81
setmem_complex_op ()(this ->vcc , 0 , nbase_x * nbase_x);
@@ -106,7 +102,6 @@ DiagoDavid<T, Device>::~DiagoDavid()
106
102
delmem_complex_op ()(this ->hpsi );
107
103
delmem_complex_op ()(this ->spsi );
108
104
delmem_complex_op ()(this ->hcc );
109
- // delmem_complex_op()(this->ctx, this->scc);
110
105
delmem_complex_op ()(this ->vcc );
111
106
delmem_complex_op ()(this ->lagrange_matrix );
112
107
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,
190
185
// slice index in this piece of code is in C manner. i.e. 0:id stands for [0,id)
191
186
hpsi_func (basis, hpsi, dim, nband);
192
187
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 );
194
189
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 );
196
191
197
192
for (int m = 0 ; m < nband; m++)
198
193
{
@@ -218,9 +213,9 @@ int DiagoDavid<T, Device>::diag_once(const HPsiFunc& hpsi_func,
218
213
unconv.data (),
219
214
this ->eigenvalue );
220
215
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 );
222
217
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 );
224
219
225
220
// check convergence and update eigenvalues
226
221
ModuleBase::timer::tick (" DiagoDavid" , " check_update" );
@@ -282,7 +277,6 @@ int DiagoDavid<T, Device>::diag_once(const HPsiFunc& hpsi_func,
282
277
this ->hpsi ,
283
278
this ->spsi ,
284
279
this ->hcc ,
285
- this ->scc ,
286
280
this ->vcc );
287
281
ModuleBase::timer::tick (" DiagoDavid" , " last" );
288
282
}
@@ -536,8 +530,7 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
536
530
const int & notconv, // number of newly added basis vectors
537
531
const T* hpsi,
538
532
const T* spsi,
539
- T* hcc,
540
- T* scc)
533
+ T* hcc)
541
534
{
542
535
if (test_david == 1 ) {
543
536
ModuleBase::TITLE (" DiagoDavid" , " cal_elem" );
@@ -562,28 +555,12 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
562
555
this ->zero ,
563
556
hcc + nbase, // notconv * (nbase + notconv)
564
557
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);
580
558
581
559
582
560
#ifdef __MPI
583
561
if (diag_comm.nproc > 1 )
584
562
{
585
563
ModuleBase::matrixTranspose_op<T, Device>()(nbase_x, nbase_x, hcc, hcc);
586
- // matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
587
564
588
565
auto * swap = new T[notconv * nbase_x];
589
566
syncmem_complex_op ()(swap, hcc + nbase * nbase_x, notconv * nbase_x);
@@ -599,21 +576,13 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
599
576
else {
600
577
MPI_Reduce (swap, hcc + nbase * nbase_x, notconv * nbase_x, MPI_DOUBLE_COMPLEX, MPI_SUM, 0 , diag_comm.comm );
601
578
}
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
+
609
580
}
610
581
delete[] swap;
611
582
612
583
// 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 );
614
584
615
585
ModuleBase::matrixTranspose_op<T, Device>()(nbase_x, nbase_x, hcc, hcc);
616
- // matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
617
586
}
618
587
#endif
619
588
@@ -637,7 +606,6 @@ template <typename T, typename Device>
637
606
void DiagoDavid<T, Device>::diag_zhegvx(const int & nbase,
638
607
const int & nband,
639
608
const T* hcc,
640
- const T* /* scc*/ ,
641
609
const int & nbase_x,
642
610
Real* eigenvalue, // in CPU
643
611
T* vcc)
@@ -694,7 +662,6 @@ void DiagoDavid<T, Device>::refresh(const int& dim,
694
662
T* hpsi,
695
663
T* spsi,
696
664
T* hcc,
697
- T* scc,
698
665
T* vcc)
699
666
{
700
667
if (test_david == 1 ) {
@@ -763,42 +730,31 @@ void DiagoDavid<T, Device>::refresh(const int& dim,
763
730
764
731
setmem_complex_op ()(hcc, 0 , nbase_x * nbase_x);
765
732
766
- // setmem_complex_op()(this->ctx, scc, 0, nbase_x * nbase_x);
767
-
768
733
if (this ->device == base_device::GpuDevice)
769
734
{
770
735
#if defined(__CUDA) || defined(__ROCM)
771
736
T* hcc_cpu = nullptr ;
772
- // T* scc_cpu = nullptr;
773
737
T* vcc_cpu = nullptr ;
774
738
base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(hcc_cpu,
775
739
nbase_x * nbase_x,
776
740
" 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");
781
741
base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(vcc_cpu,
782
742
nbase_x * nbase_x,
783
743
" DAV::vcc" );
784
744
785
745
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);
787
746
syncmem_d2h_op ()(vcc_cpu, vcc, nbase_x * nbase_x);
788
747
789
748
for (int i = 0 ; i < nbase; i++)
790
749
{
791
750
hcc_cpu[i * nbase_x + i] = eigenvalue_in[i];
792
- // scc_cpu[i * nbase_x + i] = this->one[0];
793
751
vcc_cpu[i * nbase_x + i] = this ->one [0 ];
794
752
}
795
753
796
754
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);
798
755
syncmem_h2d_op ()(vcc, vcc_cpu, nbase_x * nbase_x);
799
756
800
757
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);
802
758
base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(vcc_cpu);
803
759
#endif
804
760
}
@@ -808,7 +764,6 @@ void DiagoDavid<T, Device>::refresh(const int& dim,
808
764
{
809
765
hcc[i * nbase_x + i] = eigenvalue_in[i];
810
766
// sc(i, i) = this->one;
811
- // scc[i * nbase_x + i] = this->one[0];
812
767
// vc(i, i) = this->one;
813
768
vcc[i * nbase_x + i] = this ->one [0 ];
814
769
}
0 commit comments