-
Notifications
You must be signed in to change notification settings - Fork 67
test_lambdify.py
unit test fails when using symengine compiled with tcmalloc
#475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Here is a backtrace after running above example:
|
Could I provide anything else to help debug this issue? |
Can you try symengine/symengine#2071 with tcmalloc? |
No, that patch doesn't seem to solve the issue for me. Some of the unit tests included in this repo also fail with tcmalloc. In particular, this one: symengine.py/symengine/tests/test_lambdify.py Line 572 in e21a4e9
Perhaps it is easier for you to debug than the original issue with qiskit. Or here is a self-contain script that produces a crash: import symengine as se
import sympy as sp
cb = sp.lambdify
Mtx = sp.Matrix
x, y = se.symbols('x, y')
args = Mtx(2, 1, [x, y])
v = Mtx(2, 1, [x**3 * y, (x+1)*(y+1)])
jac = v.jacobian(args)
exprs = [jac, x+y, v, (x+1)*(y+1)]
lmb = cb(args, exprs) # Crashes here |
qiskit
unit tests fail when using symengine with tcmalloc
test_lambdify.py
unit test fails when using symengine compiled with tcmalloc
Edited description (Jan 19, 2025)
Test
test_lambdify__sympy()
from test_lambdify.py fails when sympy is installed and symengine was compiled withWITH_TCMALLOC=ON
.Minimal example:
This crashes for me with:
Bug in Arch Linux package: https://gitlab.archlinux.org/archlinux/packaging/packages/python-symengine/-/issues/2
Original description (May 11, 2024)
Some tests from
qiskit
work fine when usingsymengine
from PyPI but failed when usingsymengine
andpython-symengine
from the Arch Linux repos. After using [the same PKGBUILD] to rebuild the packages but just disablingtcmalloc
the tests don't crash anymore.I've reported this in
qiskit
repo (Qiskit/qiskit#12359) but they think it's asymengine
bug.Here is a minimal example that can produce the crash affecting the unit tests:
This same example works fine when
symegine
is compiled withouttcmalloc
. Curiously, if one importssymengine
in the same script, it also works (even withsymengine
withtcmalloc
):Perhaps some extra 👀 from here can help understand this issue better :) Also, can you clarify if the recommended way to create packages for distros is to use
tcmalloc
or not? Arch usestcmalloc
but also-DWITH_SYMENGINE_THREAD_SAFE=ON
. I guess it's a mixture of the flags recommended for distros and the optimized build. Is this properly tested? I noticed that the official wheel packages for PyPI, for example, do not usetcmalloc
.The text was updated successfully, but these errors were encountered: