8000 SEGFAULT if `pyplot` is imported · Issue #5966 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
8000

SEGFAULT if pyplot is imported #5966

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

Closed
ivannz opened this issue Feb 4, 2016 · 11 comments
Closed

SEGFAULT if pyplot is imported #5966

ivannz opened this issue Feb 4, 2016 · 11 comments

Comments

@ivannz
Copy link
ivannz commented Feb 4, 2016

For my research I need to be able to perform dimensionality reduction in parallel and then plot
the results for analysis. In order to perform experiments more efficiently is use joblib for local
parallel computing. However, every time i try to perform SVD in a spawned process, that process
unexpectedly crashes inside a call to some routine in BLAS. The strangest thing is that the crashes
happen only when I specifically import matplotlib.pyplot.

I managed to produce a what seems to be the bare minimum script required to reproduce
the fault. I also prepared an archive with the crash report and a frozen list of pip packages.

I did some searching and found an issue similar to this one in scikit-image.

matplotlib_crash.zip

@ivannz
Copy link
Author
ivannz commented Feb 4, 2016

Here is another crash report that I got from a newer OSX: crash_report_ElCapitan.txt.

@jenshnielsen
Copy link
Member

From your crash report it looks like numpy is build against Accelerate? What does np.show_config() tell you. There are know issues with Accelerate and forking processes which may be relevant i.e. something like numpy/numpy#5752 but I don't know how joblib is implemented.

I would guess that the import of Matplotlib is purely coincidental and caused by matplotlib importing other parts of numpy but it's hard to know for sure. Matplotlib is not linked directly to blas in any way as far as I know.

@ivannz
Copy link
Author
ivannz commented Feb 4, 2016

Here are np.show_config() results for both OSX versions:

@ivannz
Copy link
Author
ivannz commented Feb 4, 2016

Yes, both are linked against Accelerate.

@ivannz
Copy link
Author
ivannz commented Feb 4, 2016

It seems these excerpts from the crash reports do testify in favour of there being
a problem inside Accelerate:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libdispatch.dylib               0x00007fff8329dad0 dispatch_group_async_f + 405
1   libLAPACK.dylib                 0x00007fff95b0014b DGETRF + 1171
2   _umath_linalg.so                0x0000000104592a21 DOUBLE_det + 433
3   umath.so                        0x0000000103f95202 PyUFunc_GenericFunction + 7314
4   umath.so                        0x0000000103f981f4 ufunc_generic_call + 116
...
Binary Images:
    0x7fff95afa000 -     0x7fff95efcfff  libLAPACK.dylib (1159) <BDADCDAE-1FD8-3190-B9DD-DB671495EEE2> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib

@jenshnielsen
Copy link
Member

So I can reproduce your crash but I can also reproduce it with the script below which calls BLAS from both the parent and the child but does not involve Matplotlib.

import numpy as np
from joblib import Parallel, delayed

# if matplotlib is commented out, everything works
# import matplotlib.pyplot as plt
X = np.ones((500, 500), dtype=np.float)
y = np.dot(X,X)


# same happens fo
8000
r svd
jobs_ = (delayed(np.linalg.det)(X) for i in range(2))
Parallel(n_jobs=-1, verbose=1)(jobs_)

@ivannz
Copy link
Author
ivannz commented Feb 4, 2016

Thank you! I am going to refer to your example when adding an issue for numpy.

@jenshnielsen
Copy link
Member

Can you reproduce my example? It might be worth asking joblib devs too

@ivannz
Copy link
Author
ivannz commented Feb 4, 2016

Yes, exactly the same crash.

@ivannz
Copy link
Author
ivannz commented Feb 4, 2016

Odd, but this example does not crash when the matrix is strictly smaller than 128x128.

@jenshnielsen
Copy link
Member

I don't know exactly why that is but I guess that either numpy or blas calls a different routine when the matix is smaller which does not exhibit this issue.

I am going to close this issue since it looks like it's not related to matplotlib. Please just post a notice to have it reopened if something new comes up that points to Matplotlib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0