qutip icon indicating copy to clipboard operation
qutip copied to clipboard

"malloc: Incorrect checksum" error in qutip.testing qt.run()

Open SachaRG opened this issue 5 years ago • 4 comments

After installing qutip via conda (conda install qutip) on Mac 10.15.1 High Sierra, I ran the testing script using:

import qutip.testing as qt qt.run()

I am getting the following error:

Qobj subtraction ... python(4259,0x119a26dc0) malloc: Incorrect checksum for freed object 0x7fdbb05c5910: probably modified after being freed. Corrupt value: 0x3ff0000000000000 python(4259,0x119a26dc0) malloc: *** set a breakpoint in malloc_error_break to debug Abort trap: 6

Does anyone know what is causing this, how to fix it, or what kinds of problems it might cause later? Thank you!

Sacha

SachaRG avatar Oct 31 '19 00:10 SachaRG

Can you post the output of qutip.about()

amcdawes avatar Nov 07 '19 22:11 amcdawes

I see this issue as well but with a different test (error came up with ptrace test). I think this is a larger py3.7 issue, some comments have come up in the mailing list too.

In a py3.7 env I see malloc errors occasionally with the es solver in correlation_2op_1t calls as used here: https://github.com/gsteele13/gary-exploring-qutip/blob/master/Correlations.ipynb

QuTiP Version: 4.4.1 Numpy Version: 1.17.2 Scipy Version: 1.3.1 Cython Version: 0.29.13 Matplotlib Version: 3.1.1 Python Version: 3.7.4 Number of CPUs: 2 BLAS Info: INTEL MKL OPENMP Installed: False INTEL MKL Ext: True Platform Info: Darwin (x86_64)

amcdawes avatar Nov 08 '19 17:11 amcdawes

This also appears to be inconsistent in terms of when the issue comes up. I tried a quick use of tracemalloc to begin poking around, and that seems to change the occurrence too (like a true quantum system, measuring it disturbs it :)

Screen Shot 2019-11-08 at 10 13 00 AM

Malloc.py listed below:

from qutip import *
import numpy as np

N = 5
w = 1 * 2 * np.pi              # 1 Hz oscillator frequency
Q = 40
kappa = w / Q

a = destroy(N)
n = num(N)
x = (a + a.dag())/np.sqrt(2)
p = -1j * (a - a.dag())/np.sqrt(2)
H = w * a.dag() * a

c_ops = []

psi0 = fock(N,0)
tlist = np.linspace(0, 10, 500)

corr = correlation_2op_1t(H, psi0, tlist, c_ops, x, x, solver='es')

print(len(corr))

amcdawes avatar Nov 08 '19 18:11 amcdawes

I am reasonably sure that this is the same cause as #1160, and I'll just put the info I have now over there to keep it in one place.

jakelishman avatar Apr 24 '21 16:04 jakelishman

This was a crazy numpy bug that is now resolved. See #1160 for links to the crazy debugging trail.

hodgestar avatar Dec 14 '23 23:12 hodgestar