[Numpy-discussion] Bus error for Debian / SPARC on current trunk

Travis Oliphant travis@continuum...
Mon Mar 5 21:24:59 CST 2012


I'm not sure if it's been re-hashed again or not, but this is the sort of error that showed up all the time while debugging NumPy on Sparc hard-ware.   The problem is that memory has to be aligned before calculations take place.    With this kind of dtype, field 'f2' will be aligned on a 2-byte boundary but likely must be aligned on a 4-byte boundary before any kind of comparison operation is done. 

Multiple times, this bug was fixed by just looking hard at the code again and making sure that memory copies were performed prior to calculation if the data is not aligned.    

Thanks for the error reports and for all the hard work in tracking this down and squashing it.  

-Travis


 
On Mar 5, 2012, at 1:11 PM, Matthew Brett wrote:

> Hi,
> 
> On Sun, Mar 4, 2012 at 11:53 PM, Mark Wiebe <mwwiebe@gmail.com> wrote:
>> On Sun, Mar 4, 2012 at 10:34 PM, Matthew Brett <matthew.brett@gmail.com>
>> wrote:
>>> 
>>> <snip>
>>>> $ export NPY_SEPARATE_COMPILATION=1
>>> 
>>> Thanks, that did it:
>>> 
>>> 9194b3af704df71aa9b1ff2f53f169848d0f9dc7 is the first bad commit
>>> 
>>> Let me know if I can debug further,
>> 
>> 
>> That commit was a rewrite of np.concatenate, and I've traced the test
>> function you got the crash in. The only call to concatenate is as follows:
>> 
>>>>> a = np.array([True], dtype=object)
>>>>> np.concatenate((a,)*3)
>> array([True, True, True], dtype=object)
>>>>> 
>> 
>> Can you try this and see if it crashes?
> 
> No, that doesn't crash.
> 
> Further investigation revealed the crash to be:
> 
> (bare-env)[matthew@vagus ~]$ nosetests
> ~/dev_trees/numpy/numpy/lib/tests/test_io.py:TestFromTxt.test_with_masked_column_various
> nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
> Test masked column ... Bus error
> 
> Accordingly:
> 
> In [1]: import numpy as np
> 
> In [2]: from StringIO import StringIO
> 
> In [3]: data = StringIO('True 2 3\nFalse 5 6\n')
> 
> In [4]: test = np.genfromtxt(data, dtype=None, missing_values='2,5',
> usemask=True)
> 
> In [6]: from numpy import ma
> 
> In [7]: control = ma.array([(1, 2, 3), (0, 5, 6)], mask=[(0, 1, 0),
> (0, 1, 0)], dtype=[('f0', bool), ('f1', bool), ('f2', int)])
> 
> In [8]: test == control
> Bus error
> 
>> Another thing you can do is compile with debug information enabled, then run
>> the crashing case in gdb. This will look something like this:
>> 
>> $ export CFLAGS=-g
>> $ rm -rf build # make sure it's a fresh build from scratch
>> $ python setup.py install --prefix=<dir> # or however you do it
>> [... build printout]
>> $ gdb python <script/options>
>> [... gdb info]
>> (gdb) run
>>  [... script runs]
>> Program received signal SIGSEGV, Segmentation fault,
>> [crash address]
>> (gdb) backtrace
>> [full backtrace printout]
>> 
>> Such a backtrace would be immensely helpful in tracking down why it's
>> crashing.
> 
> I'll get back to you with this.
> 
> See you,
> 
> Matthew
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion



More information about the NumPy-Discussion mailing list