Skip to content

Commit bab929f

Browse files
Fix: remove useless scc in davidson to boost algorithm (#4874)
Co-authored-by: Haozhi Han <[email protected]>
1 parent f0a0c18 commit bab929f

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

source/module_hsolver/diago_david.cpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ DiagoDavid<T, Device>::DiagoDavid(const Real* precondition_in,
9999
setmem_complex_op()(this->ctx, this->hcc, 0, nbase_x * nbase_x);
100100

101101
// scc(nbase_x, nbase_x); // Overlap on the reduced basis
102-
resmem_complex_op()(this->ctx, this->scc, nbase_x * nbase_x, "DAV::scc");
103-
setmem_complex_op()(this->ctx, this->scc, 0, nbase_x * nbase_x);
102+
// resmem_complex_op()(this->ctx, this->scc, nbase_x * nbase_x, "DAV::scc");
103+
// setmem_complex_op()(this->ctx, this->scc, 0, nbase_x * nbase_x);
104104

105105
// vcc(nbase_x, nbase_x); // Eigenvectors of hcc
106106
resmem_complex_op()(this->ctx, this->vcc, nbase_x * nbase_x, "DAV::vcc");
@@ -135,7 +135,7 @@ DiagoDavid<T, Device>::~DiagoDavid()
135135
delmem_complex_op()(this->ctx, this->hpsi);
136136
delmem_complex_op()(this->ctx, this->spsi);
137137
delmem_complex_op()(this->ctx, this->hcc);
138-
delmem_complex_op()(this->ctx, this->scc);
138+
// delmem_complex_op()(this->ctx, this->scc);
139139
delmem_complex_op()(this->ctx, this->vcc);
140140
delmem_complex_op()(this->ctx, this->lagrange_matrix);
141141
base_device::memory::delete_memory_op<Real, base_device::DEVICE_CPU>()(this->cpu_ctx, this->eigenvalue);
@@ -661,27 +661,27 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
661661
hcc + nbase, // notconv * (nbase + notconv)
662662
nbase_x);
663663
// scc[nbase] = basis[nbase]' * spsi
664-
gemm_op<T, Device>()(this->ctx,
665-
'C',
666-
'N',
667-
notconv,
668-
nbase + notconv,
669-
dim,
670-
this->one,
671-
basis + dim*nbase, // dim * notconv
672-
dim,
673-
spsi, // dim * (nbase + notconv)
674-
dim,
675-
this->zero,
676-
scc + nbase, // notconv * (nbase + notconv)
677-
nbase_x);
664+
// gemm_op<T, Device>()(this->ctx,
665+
// 'C',
666+
// 'N',
667+
// notconv,
668+
// nbase + notconv,
669+
// dim,
670+
// this->one,
671+
// basis + dim*nbase, // dim * notconv
672+
// dim,
673+
// spsi, // dim * (nbase + notconv)
674+
// dim,
675+
// this->zero,
676+
// scc + nbase, // notconv * (nbase + notconv)
677+
// nbase_x);
678678

679679

680680
#ifdef __MPI
681681
if (diag_comm.nproc > 1)
682682
{
683683
matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, hcc, hcc);
684-
matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
684+
// matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
685685

686686
auto* swap = new T[notconv * nbase_x];
687687
syncmem_complex_op()(this->ctx, this->ctx, swap, hcc + nbase * nbase_x, notconv * nbase_x);
@@ -697,12 +697,12 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
697697
else {
698698
MPI_Reduce(swap, hcc + nbase * nbase_x, notconv * nbase_x, MPI_DOUBLE_COMPLEX, MPI_SUM, 0, diag_comm.comm);
699699
}
700-
syncmem_complex_op()(this->ctx, this->ctx, swap, scc + nbase * nbase_x, notconv * nbase_x);
700+
// syncmem_complex_op()(this->ctx, this->ctx, swap, scc + nbase * nbase_x, notconv * nbase_x);
701701
if (base_device::get_current_precision(swap) == "single") {
702-
MPI_Reduce(swap, scc + nbase * nbase_x, notconv * nbase_x, MPI_COMPLEX, MPI_SUM, 0, diag_comm.comm);
702+
// MPI_Reduce(swap, scc + nbase * nbase_x, notconv * nbase_x, MPI_COMPLEX, MPI_SUM, 0, diag_comm.comm);
703703
}
704704
else {
705-
MPI_Reduce(swap, scc + nbase * nbase_x, notconv * nbase_x, MPI_DOUBLE_COMPLEX, MPI_SUM, 0, diag_comm.comm);
705+
// MPI_Reduce(swap, scc + nbase * nbase_x, notconv * nbase_x, MPI_DOUBLE_COMPLEX, MPI_SUM, 0, diag_comm.comm);
706706
}
707707
}
708708
delete[] swap;
@@ -711,7 +711,7 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
711711
// Parallel_Reduce::reduce_complex_double_pool( scc + nbase * nbase_x, notconv * nbase_x );
712712

713713
matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, hcc, hcc);
714-
matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
714+
// matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
715715
}
716716
#endif
717717

@@ -881,44 +881,44 @@ void DiagoDavid<T, Device>::refresh(const int& dim,
881881

882882
setmem_complex_op()(this->ctx, hcc, 0, nbase_x * nbase_x);
883883

884-
setmem_complex_op()(this->ctx, scc, 0, nbase_x * nbase_x);
884+
// setmem_complex_op()(this->ctx, scc, 0, nbase_x * nbase_x);
885885

886886
if (this->device == base_device::GpuDevice)
887887
{
888888
#if defined(__CUDA) || defined(__ROCM)
889889
T* hcc_cpu = nullptr;
890-
T* scc_cpu = nullptr;
890+
// T* scc_cpu = nullptr;
891891
T* vcc_cpu = nullptr;
892892
base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx,
893893
hcc_cpu,
894894
nbase_x * nbase_x,
895895
"DAV::hcc");
896-
base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx,
897-
scc_cpu,
898-
nbase_x * nbase_x,
899-
"DAV::scc");
896+
// base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx,
897+
// scc_cpu,
898+
// nbase_x * nbase_x,
899+
// "DAV::scc");
900900
base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx,
901901
vcc_cpu,
902902
nbase_x * nbase_x,
903903
"DAV::vcc");
904904

905905
syncmem_d2h_op()(this->cpu_ctx, this->ctx, hcc_cpu, hcc, nbase_x * nbase_x);
906-
syncmem_d2h_op()(this->cpu_ctx, this->ctx, scc_cpu, scc, nbase_x * nbase_x);
906+
// syncmem_d2h_op()(this->cpu_ctx, this->ctx, scc_cpu, scc, nbase_x * nbase_x);
907907
syncmem_d2h_op()(this->cpu_ctx, this->ctx, vcc_cpu, vcc, nbase_x * nbase_x);
908908

909909
for (int i = 0; i < nbase; i++)
910910
{
911911
hcc_cpu[i * nbase_x + i] = eigenvalue_in[i];
912-
scc_cpu[i * nbase_x + i] = this->one[0];
912+
// scc_cpu[i * nbase_x + i] = this->one[0];
913913
vcc_cpu[i * nbase_x + i] = this->one[0];
914914
}
915915

916916
syncmem_h2d_op()(this->ctx, this->cpu_ctx, hcc, hcc_cpu, nbase_x * nbase_x);
917-
syncmem_h2d_op()(this->ctx, this->cpu_ctx, scc, scc_cpu, nbase_x * nbase_x);
917+
// syncmem_h2d_op()(this->ctx, this->cpu_ctx, scc, scc_cpu, nbase_x * nbase_x);
918918
syncmem_h2d_op()(this->ctx, this->cpu_ctx, vcc, vcc_cpu, nbase_x * nbase_x);
919919

920920
base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx, hcc_cpu);
921-
base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx, scc_cpu);
921+
// base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx, scc_cpu);
922922
base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx, vcc_cpu);
923923
#endif
924924
}
@@ -928,7 +928,7 @@ void DiagoDavid<T, Device>::refresh(const int& dim,
928928
{
929929
hcc[i * nbase_x + i] = eigenvalue_in[i];
930930
// sc(i, i) = this->one;
931-
scc[i * nbase_x + i] = this->one[0];
931+
// scc[i * nbase_x + i] = this->one[0];
932932
// vc(i, i) = this->one;
933933
vcc[i * nbase_x + i] = this->one[0];
934934
}

0 commit comments

Comments
 (0)