Skip to content
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

Bundled executables segfault in MKL::dgetrs call #4335

Open
michael-a-hansen opened this issue Jul 25, 2019 · 1 comment
Open

Bundled executables segfault in MKL::dgetrs call #4335

michael-a-hansen opened this issue Jul 25, 2019 · 1 comment
Labels
state:verify This needs to be verified - would be great if someone could write a test-case for

Comments

@michael-a-hansen
Copy link

michael-a-hansen commented Jul 25, 2019

Hello,

I'm having trouble with Pyinstaller and calling dgetrs from MKL via either scipy or my own Cython wrapper of C code. A minimum working example is below. An interesting bit is that when n, the number of rows in the linear system, is 8 or less, the frozen executable works as expected. When n>8 as below, I observe a segfault on the dgetrs call (always, and in several different scripts as I trimmed down to the small script here). This occurs when I use scipy's LAPACK wrapper, numpy's linalg module (as below), or when I call dgetrs in C++ code wrapped by Cython. It only occurs with the frozen executable - running the original scripts through the python interpreter is fine.

I'm on Linux RHEL 7.6, with a fresh python3.6 conda environment built with conda install scipy that pulls in MKL during installation. I've verified this problem with pyinstaller from conda install -c conda-forge pyinstaller as well as the development version (checked out today, 4.0.dev0+ffb1ff369). Trying with --onedir --noupx --debug all script.py hasn't helped me figure this out.

Feels like some sort of issue bundling MKL (a seg fault inside dgetrs from both scipy and my own C++ code doesn't leave room for much else), but it looks like there has at least been extra effort to handle it in pyinstaller (for instance, when bundling it identifies and adds MKL libraries when it finds numpy).

Any help would be greatly appreciated.

Log output: https://gist.github.com/michael-a-hansen/9e73b378cdbdce7e8e58051ea8fb3a0b

Debut output: https://gist.github.com/michael-a-hansen/0719970083f099ea7dbd57cf406fe0e4

Warnings: https://gist.github.com/michael-a-hansen/7289035bd3e867fec2fd2141c5b9cf86

Minimum working example:

import numpy as np
import numpy.linalg as la

n = 9  # n > 8 = segfault, n <= 8 works fine
a = np.eye(n)
b = np.linspace(0, 1, n)

x = la.solve(a, b)

print('successfully completed')
@bwoodsend
Copy link
Member

Can you try again but use the development head?

pip install -U https://github.com/pyinstaller/pyinstaller/archive/develop.zip

#5213 followed by #5168 (which hasn't been released yet) should mop up the Conda/NumPy/MKL issues.

@bwoodsend bwoodsend added the state:verify This needs to be verified - would be great if someone could write a test-case for label Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:verify This needs to be verified - would be great if someone could write a test-case for
Projects
None yet
Development

No branches or pull requests

2 participants