Skip to content

Commit 1dba84c

Browse files
committed
Fix: remove useless scc in davidson to boost algorithm
1 parent 53aa387 commit 1dba84c

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);
@@ -658,27 +658,27 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
658658
hcc + nbase, // notconv * (nbase + notconv)
659659
nbase_x);
660660
// scc[nbase] = basis[nbase]' * spsi
661-
gemm_op<T, Device>()(this->ctx,
662-
'C',
663-
'N',
664-
notconv,
665-
nbase + notconv,
666-
dim,
667-
this->one,
668-
basis + dim*nbase, // dim * notconv
669-
dim,
670-
spsi, // dim * (nbase + notconv)
671-
dim,
672-
this->zero,
673-
scc + nbase, // notconv * (nbase + notconv)
674-
nbase_x);
661+
// gemm_op<T, Device>()(this->ctx,
662+
// 'C',
663+
// 'N',
664+
// notconv,
665+
// nbase + notconv,
666+
// dim,
667+
// this->one,
668+
// basis + dim*nbase, // dim * notconv
669+
// dim,
670+
// spsi, // dim * (nbase + notconv)
671+
// dim,
672+
// this->zero,
673+
// scc + nbase, // notconv * (nbase + notconv)
674+
// nbase_x);
675675

676676

677677
#ifdef __MPI
678678
if (diag_comm.nproc > 1)
679679
{
680680
matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, hcc, hcc);
681-
matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
681+
// matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
682682

683683
auto* swap = new T[notconv * nbase_x];
684684
syncmem_complex_op()(this->ctx, this->ctx, swap, hcc + nbase * nbase_x, notconv * nbase_x);
@@ -694,12 +694,12 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
694694
else {
695695
MPI_Reduce(swap, hcc + nbase * nbase_x, notconv * nbase_x, MPI_DOUBLE_COMPLEX, MPI_SUM, 0, diag_comm.comm);
696696
}
697-
syncmem_complex_op()(this->ctx, this->ctx, swap, scc + nbase * nbase_x, notconv * nbase_x);
697+
// syncmem_complex_op()(this->ctx, this->ctx, swap, scc + nbase * nbase_x, notconv * nbase_x);
698698
if (base_device::get_current_precision(swap) == "single") {
699-
MPI_Reduce(swap, scc + nbase * nbase_x, notconv * nbase_x, MPI_COMPLEX, MPI_SUM, 0, diag_comm.comm);
699+
// MPI_Reduce(swap, scc + nbase * nbase_x, notconv * nbase_x, MPI_COMPLEX, MPI_SUM, 0, diag_comm.comm);
700700
}
701701
else {
702-
MPI_Reduce(swap, scc + nbase * nbase_x, notconv * nbase_x, MPI_DOUBLE_COMPLEX, MPI_SUM, 0, diag_comm.comm);
702+
// MPI_Reduce(swap, scc + nbase * nbase_x, notconv * nbase_x, MPI_DOUBLE_COMPLEX, MPI_SUM, 0, diag_comm.comm);
703703
}
704704
}
705705
delete[] swap;
@@ -708,7 +708,7 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
708708
// Parallel_Reduce::reduce_complex_double_pool( scc + nbase * nbase_x, notconv * nbase_x );
709709

710710
matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, hcc, hcc);
711-
matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
711+
// matrixTranspose_op<T, Device>()(this->ctx, nbase_x, nbase_x, scc, scc);
712712
}
713713
#endif
714714

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

879879
setmem_complex_op()(this->ctx, hcc, 0, nbase_x * nbase_x);
880880

881-
setmem_complex_op()(this->ctx, scc, 0, nbase_x * nbase_x);
881+
// setmem_complex_op()(this->ctx, scc, 0, nbase_x * nbase_x);
882882

883883
if (this->device == base_device::GpuDevice)
884884
{
885885
#if defined(__CUDA) || defined(__ROCM)
886886
T* hcc_cpu = nullptr;
887-
T* scc_cpu = nullptr;
887+
// T* scc_cpu = nullptr;
888888
T* vcc_cpu = nullptr;
889889
base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx,
890890
hcc_cpu,
891891
nbase_x * nbase_x,
892892
"DAV::hcc");
893-
base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx,
894-
scc_cpu,
895-
nbase_x * nbase_x,
896-
"DAV::scc");
893+
// base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx,
894+
// scc_cpu,
895+
// nbase_x * nbase_x,
896+
// "DAV::scc");
897897
base_device::memory::resize_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx,
898898
vcc_cpu,
899899
nbase_x * nbase_x,
900900
"DAV::vcc");
901901

902902
syncmem_d2h_op()(this->cpu_ctx, this->ctx, hcc_cpu, hcc, nbase_x * nbase_x);
903-
syncmem_d2h_op()(this->cpu_ctx, this->ctx, scc_cpu, scc, nbase_x * nbase_x);
903+
// syncmem_d2h_op()(this->cpu_ctx, this->ctx, scc_cpu, scc, nbase_x * nbase_x);
904904
syncmem_d2h_op()(this->cpu_ctx, this->ctx, vcc_cpu, vcc, nbase_x * nbase_x);
905905

906906
for (int i = 0; i < nbase; i++)
907907
{
908908
hcc_cpu[i * nbase_x + i] = eigenvalue_in[i];
909-
scc_cpu[i * nbase_x + i] = this->one[0];
909+
// scc_cpu[i * nbase_x + i] = this->one[0];
910910
vcc_cpu[i * nbase_x + i] = this->one[0];
911911
}
912912

913913
syncmem_h2d_op()(this->ctx, this->cpu_ctx, hcc, hcc_cpu, nbase_x * nbase_x);
914-
syncmem_h2d_op()(this->ctx, this->cpu_ctx, scc, scc_cpu, nbase_x * nbase_x);
914+
// syncmem_h2d_op()(this->ctx, this->cpu_ctx, scc, scc_cpu, nbase_x * nbase_x);
915915
syncmem_h2d_op()(this->ctx, this->cpu_ctx, vcc, vcc_cpu, nbase_x * nbase_x);
916916

917917
base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx, hcc_cpu);
918-
base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx, scc_cpu);
918+
// base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx, scc_cpu);
919919
base_device::memory::delete_memory_op<T, base_device::DEVICE_CPU>()(this->cpu_ctx, vcc_cpu);
920920
#endif
921921
}
@@ -925,7 +925,7 @@ void DiagoDavid<T, Device>::refresh(const int& dim,
925925
{
926926
hcc[i * nbase_x + i] = eigenvalue_in[i];
927927
// sc(i, i) = this->one;
928-
scc[i * nbase_x + i] = this->one[0];
928+
// scc[i * nbase_x + i] = this->one[0];
929929
// vc(i, i) = this->one;
930930
vcc[i * nbase_x + i] = this->one[0];
931931
}

0 commit comments

Comments
 (0)