Skip to content

Commit c120f6e

Browse files
committed
Remove scc calculation deprecated code of traditional Davidson algorithm.
1 parent 71a7b2d commit c120f6e

File tree

1 file changed

+1
-42
lines changed

1 file changed

+1
-42
lines changed

source/source_hsolver/diago_david.cpp

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -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);
@@ -562,28 +557,12 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
562557
this->zero,
563558
hcc + nbase, // notconv * (nbase + notconv)
564559
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);
580560

581561

582562
#ifdef __MPI
583563
if (diag_comm.nproc > 1)
584564
{
585565
ModuleBase::matrixTranspose_op<T, Device>()(nbase_x, nbase_x, hcc, hcc);
586-
// matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
587566

588567
auto* swap = new T[notconv * nbase_x];
589568
syncmem_complex_op()(swap, hcc + nbase * nbase_x, notconv * nbase_x);
@@ -599,21 +578,13 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
599578
else {
600579
MPI_Reduce(swap, hcc + nbase * nbase_x, notconv * nbase_x, MPI_DOUBLE_COMPLEX, MPI_SUM, 0, diag_comm.comm);
601580
}
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-
}
581+
609582
}
610583
delete[] swap;
611584

612585
// 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 );
614586

615587
ModuleBase::matrixTranspose_op<T, Device>()(nbase_x, nbase_x, hcc, hcc);
616-
// matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
617588
}
618589
#endif
619590

@@ -763,42 +734,31 @@ void DiagoDavid<T, Device>::refresh(const int& dim,
763734

764735
setmem_complex_op()(hcc, 0, nbase_x * nbase_x);
765736

766-
// setmem_complex_op()(this->ctx, scc, 0, nbase_x * nbase_x);
767-
768737
if (this->device == base_device::GpuDevice)
769738
{
770739
#if defined(__CUDA) || defined(__ROCM)
771740
T* hcc_cpu = nullptr;
772-
// T* scc_cpu = nullptr;
773741
T* vcc_cpu = nullptr;
774742
base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(hcc_cpu,
775743
nbase_x * nbase_x,
776744
"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");
781745
base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(vcc_cpu,
782746
nbase_x * nbase_x,
783747
"DAV::vcc");
784748

785749
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);
787750
syncmem_d2h_op()(vcc_cpu, vcc, nbase_x * nbase_x);
788751

789752
for (int i = 0; i < nbase; i++)
790753
{
791754
hcc_cpu[i * nbase_x + i] = eigenvalue_in[i];
792-
// scc_cpu[i * nbase_x + i] = this->one[0];
793755
vcc_cpu[i * nbase_x + i] = this->one[0];
794756
}
795757

796758
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);
798759
syncmem_h2d_op()(vcc, vcc_cpu, nbase_x * nbase_x);
799760

800761
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);
802762
base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(vcc_cpu);
803763
#endif
804764
}
@@ -808,7 +768,6 @@ void DiagoDavid<T, Device>::refresh(const int& dim,
808768
{
809769
hcc[i * nbase_x + i] = eigenvalue_in[i];
810770
// sc(i, i) = this->one;
811-
// scc[i * nbase_x + i] = this->one[0];
812771
// vc(i, i) = this->one;
813772
vcc[i * nbase_x + i] = this->one[0];
814773
}

0 commit comments

Comments
 (0)