Bug 207647 - math/py-matplotlib: function pylab causes segmentation fault
Summary: math/py-matplotlib: function pylab causes segmentation fault
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords: crash, needs-qa
Depends on:
Blocks:
 
Reported: 2016-03-02 16:44 UTC by Trago
Modified: 2016-03-04 18:09 UTC (History)
2 users (show)

See Also:
koobs: maintainer-feedback? (mainland)
koobs: merge-quarterly?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trago 2016-03-02 16:44:46 UTC
Using the plot function pylab it raises a segmentation fault on freebsd 12.2-release

This is the example:

>>> from matplotlib import pylab as pl
>>> import numpy as np
>>> x = np.arange(-10,10,0.1)
>>> y = np.sin(0.2*x)
>>> pl.plot(x,y)
Segmentation fault


I tested this in freebsd and pcbsd and the same error is obtained
Comment 1 Trago 2016-03-02 16:54:51 UTC
Sorry I mean freebsd 10.2-release
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2016-03-02 17:06:16 UTC
@Trago, if you could include a backtrace of the .core file using gdb (bt), that might prove helpful.
Comment 3 c.brinkhaus 2016-03-02 18:15:37 UTC
Here using FreeBSD 10.3-BETA3 #7 r296154 the curve is plotted as excpected. The numpy options are as below:

# Options for py27-numpy-1.9.2,1
_OPTIONS_READ=py27-numpy-1.9.2,1
_FILE_COMPLETE_OPTIONS_LIST=DOCS SUITESPARSE TESTS ATLAS NETLIB OPENBLAS
OPTIONS_FILE_UNSET+=DOCS
OPTIONS_FILE_SET+=SUITESPARSE
OPTIONS_FILE_UNSET+=TESTS
OPTIONS_FILE_UNSET+=ATLAS
OPTIONS_FILE_SET+=NETLIB
OPTIONS_FILE_UNSET+=OPENBLAS

Others should be as default.
I hope it helps to narrow down the problem.

Kind regards,
Christoph
Comment 4 Trago 2016-03-02 18:40:23 UTC
(In reply to Kubilay Kocak from comment #2)

>>> x = np.arange(-10,10,0.1)
>>> y = np.sin(0.2*x)
>>> pl.plot(x,y)

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 801c06400 (LWP 100748/python2.7)]
0x0000000806bd8690 in dgemm_beta () from /usr/local/lib/libopenblasp.so
(gdb) bt
#0  0x0000000806bd8690 in dgemm_beta () from /usr/local/lib/libopenblasp.so
#1  0x00000008069bcb2e in dgemm_nn () from /usr/local/lib/libopenblasp.so
#2  0x0000000000000000 in ?? ()


This is what I obtain using backtrace in gdb. I seems it has some thing with the openblas library
Comment 5 c.brinkhaus 2016-03-02 19:23:01 UTC
(In reply to Trago from comment #4)
Please see for also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203638.
It might be related to the problem discussed here.
Comment 6 Trago 2016-03-02 19:32:24 UTC
(In reply to c.brinkhaus from comment #5)

Yes, thank you but I don't think so. The problem in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203638 is a link problem, the symbol cblas_sgemm is not found so the library can't be loaded.

Here, the library is loaded correctly, no link problem exists. The problem here is a segmentation fault in the loaded library.
Comment 7 Trago 2016-03-02 19:47:37 UTC
Hi guys,

I don't know what exactly is the problem but it seems that some of the openblas port options is causing the segmentation fault of the example given here. I compiled openblas from ports with the following options

[ ] AVX
[X] AVX2
[X] DYNAMIC_ARCH
[X] INTERFACE64
[X] OPENMP


Using this compiled library it raises the segmentation fault shown.


But now, I deinstalled the port and installed the binary package using

% pkg install openblas

With the pkg binary, the example given here works without any problem. Therefore, one of the compilation options I gave above is giving problems. Which one? I don't know.

Regards
Comment 8 Geoffrey Mainland 2016-03-02 19:59:25 UTC
Does your CPU support AVX2?
Comment 9 Trago 2016-03-02 20:23:43 UTC
(In reply to mainland from comment #8)

That is a very good question. I really don't know. How can I check that?
Comment 10 Trago 2016-03-02 20:30:16 UTC
(In reply to mainland from comment #8)

Just in case, I recompiled openblas with the following options

[ ] AVX
[ ] AVX2
[ ] DYNAMIC_ARCH
[X] INTERFACE64
[ ] OPENMP


Still the same segmentation fault problem
Comment 11 Geoffrey Mainland 2016-03-02 20:44:12 UTC
Then turn off INTERFACE64...

The only default option is DYNAMIC_ARCH.

This appears to be a problem with the openblas and/or numpy port, not matplotlib.
Comment 12 c.brinkhaus 2016-03-02 20:48:33 UTC
Please excuse my curiosity, but has py27-numpy worked with openblas in a period between November 2015 and now?
Comment 13 Trago 2016-03-02 20:53:36 UTC
(In reply to mainland from comment #11)

Yes, that option is the problem. I recompiled with the following options and works perfectly

[ ] AVX
[X] AVX2
[ ] DYNAMIC_ARCH
[ ] INTERFACE64
[ ] OPENMP


And yes, I agree with you. It seems is a problem with the openblas and numpy when using the option INTERFACE64.

Thanks
Comment 14 Geoffrey Mainland 2016-03-02 20:57:10 UTC
c.brinkhaus, yes it has. But apparently not when the INTERFACE64 option is enabled.