Skip to content

Commit

Permalink
Fix: elpa memory leak (deepmodeling#3472)
Browse files Browse the repository at this point in the history
* Fix: elpa memory leak

* Fix assertion condition in `to_numerical_orbital_lm`

* Remove outdated assertion
  • Loading branch information
caic99 authored Jan 11, 2024
1 parent 71a023b commit 471243f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions source/module_basis/module_nao/numerical_radial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ void NumericalRadial::build(const int l,
void NumericalRadial::to_numerical_orbital_lm(Numerical_Orbital_Lm& orbital_lm, const int nk_legacy, const double lcao_dk) const
{
#ifdef __DEBUG
assert(rgrid_ && kgrid_);
assert(rgrid_[0] == 0.0 && kgrid_[0] == 0.0);
assert(is_uniform(nr_, rgrid_, 1e-14) && is_uniform(nk_, kgrid_, 1e-14));
assert(rgrid_);
assert(rgrid_[0] == 0.0);
assert(is_uniform(nr_, rgrid_, 1e-14));

// Numerical_Orbital_Lm does not support extra exponent in the real space value
assert(pr_ == 0);
Expand Down Expand Up @@ -329,7 +329,7 @@ void NumericalRadial::wipe(const bool r_space, const bool k_space)
pr_ = 0;
ircut_ = 0;
}

if (k_space)
{
delete[] kgrid_;
Expand Down
3 changes: 0 additions & 3 deletions source/module_hamilt_pw/hamilt_pwdft/hamilt_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,6 @@ void HamiltPW<T, Device>::sPsi(const T* psi_in, // psi
if(GlobalV::use_paw)
{
#ifdef USE_PAW
#ifdef __DEBUG
assert(psi.get_k_first());
#endif
for(int m = 0; m < nbands; m ++)
{
GlobalC::paw_cell.paw_nl_psi(1, reinterpret_cast<const std::complex<double>*> (&psi_in[m * npw]),
Expand Down
1 change: 1 addition & 0 deletions source/module_hsolver/genelpa/elpa_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ void ELPA_Solver::exit()
logfile.close();
int error;
elpa_deallocate(NEW_ELPA_HANDLE_POOL[handle_id], &error);
elpa_uninit(&error);
}

int ELPA_Solver::read_cpuflag()
Expand Down

0 comments on commit 471243f

Please sign in to comment.