deepmodeling / abacus-develop

An electronic structure package based on either plane wave basis or numerical atomic orbitals.
http://abacus.ustc.edu.cn
GNU Lesser General Public License v3.0
173 stars 132 forks source link

memory leak from sanitizer diagnosis #3916

Closed dyzheng closed 7 months ago

dyzheng commented 7 months ago

Describe the bug

  1. https://github.com/deepmodeling/abacus-develop/tree/dashboard?tab=readme-ov-file#test-case-101_pw_upf201_uspp_nacl
 DONE(0.273436   SEC) : INIT PLANEWAVE
 MEMORY FOR PSI (MB)  : 0.261841
 DONE(0.289148   SEC) : LOCAL POTENTIAL
 DONE(0.45608    SEC) : NON-LOCAL POTENTIAL
 DONE(0.481874   SEC) : INIT BASIS
 -------------------------------------------
 SELF-CONSISTENT : 
 -------------------------------------------
 START CHARGE      : atomic
 DONE(0.62241    SEC) : INIT SCF
 ITER   ETOT(eV)       EDIFF(eV)      DRHO       TIME(s)    
AddressSanitizerAddressSanitizerAddressSanitizerAddressSanitizerAddressSanitizerAddressSanitizerAddressSanitizerAddressSanitizerAddressSanitizer:DEADLYSIGNAL
:DEADLYSIGNAL
:DEADLYSIGNAL
:DEADLYSIGNAL
=================================================================
:DEADLYSIGNAL
:DEADLYSIGNAL
:DEADLYSIGNAL
:DEADLYSIGNAL
==16845==ERROR: AddressSanitizer: SEGV on unknown address 0x6340001511a0 (pc 0x55e589b1d08d bp 0x7f464339fcd0 sp 0x7f464339fcb0 T7948)
==16845==The signal is caused by a READ memory access.
:DEADLYSIGNAL
    #0 0x55e589b1d08d in std::complex<double>::real[abi:cxx11]() const /usr/include/c++/11/complex:1257
    #1 0x55e589b1d08d in double std::_Norm_helper<true>::_S_do_it<double>(std::complex<double> const&) /usr/include/c++/11/complex:685
    #2 0x55e589b1d08d in double std::norm<double>(std::complex<double> const&) /usr/include/c++/11/complex:696
    #3 0x55e589b1d08d in elecstate::elecstate_pw_op<double, psi::DEVICE_CPU>::operator()(psi::DEVICE_CPU const*, int const&, int const&, double const&, double**, std::complex<double> const*) [clone ._omp_fn.0] /abacus-develop/source/module_elecstate/kernels/elecstate_op.cpp:24
    #4 0x7f46f6c60b9d  (/lib/x86_64-linux-gnu/libgomp.so.1+0x1db9d)
    #5 0x7f46f432bb42  (/lib/x86_64-linux-gnu/libc.so.6+0x94b42)
    #6 0x7f46f43bcbb3 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x125bb3)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /usr/include/c++/11/complex:1257 in std::complex<double>::real[abi:cxx11]() const
Thread T7948 created by T0 here:
    #0 0x7f46f7a2f685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216
    #1 0x7f46f6c611ef  (/lib/x86_64-linux-gnu/libgomp.so.1+0x1e1ef)
    #2 0x7f46f6c57a10 in GOMP_parallel (/lib/x86_64-linux-gnu/libgomp.so.1+0x14a10)
    #3 0x7ffc07d60a7f  ([stack]+0x1aa7f)

==16845==ABORTING

Expected behavior

No response

To Reproduce

No response

Environment

No response

Additional Context

No response

Task list for Issue attackers (only for developers)

dyzheng commented 7 months ago

@YuLiu98 This error occurred with uspp calculation, can you solve this Issue?