#11674: np.dot of two numeric matrices segfaults sage.
------------------------------+---------------------------------------------
   Reporter:  mister.wardrop  |          Owner:  jason, jkantor             
       Type:  defect          |         Status:  new                        
   Priority:  blocker         |      Milestone:  sage-4.7.1                 
  Component:  numerical       |       Keywords:  ATLAS segfault matrix numpy
Work_issues:                  |       Upstream:  N/A                        
   Reviewer:                  |         Author:                             
     Merged:                  |   Dependencies:                             
------------------------------+---------------------------------------------
Changes (by leif):

 * cc: vbraun (added)


Comment:

 FWIW, I don't get the segfault when running the example with Valgrind
 (3.6.1; 3.5.0 raises a `SIGILL` because it doesn't know some instructions)
 and the binary distribution of Sage 4.7 (built on / for Ubuntu 10.04.1
 x86_64), apparently because Valgrind replaces `malloc()` and `free()`
 etc.:
 {{{
 ... lots of messages ...
 sage: import numpy as np
 sage: ms = np.load("/home/leif/Sage/tmp/matrices.npy")
 sage: time np.dot(ms[0],ms[1])
 ==25274== Invalid read of size 4
 ==25274==    at 0x4EB960E: PyObject_Realloc (obmalloc.c:1154)
 ==25274==    by 0x4EE1572: _PyUnicode_New (unicodeobject.c:262)
 ==25274==    by 0x4EE1ED8: PyUnicodeUCS4_FromUnicode (unicodeobject.c:461)
 ==25274==    by 0x4F1809E: PyEval_EvalFrameEx (ceval.c:4081)
 ==25274==    by 0x4F1926C: PyEval_EvalCodeEx (ceval.c:2968)
 ==25274==    by 0x4F1760C: PyEval_EvalFrameEx (ceval.c:3802)
 ==25274==    by 0x4F1926C: PyEval_EvalCodeEx (ceval.c:2968)
 ==25274==    by 0x4F1760C: PyEval_EvalFrameEx (ceval.c:3802)
 ==25274==    by 0x4F1926C: PyEval_EvalCodeEx (ceval.c:2968)
 ==25274==    by 0x4F1760C: PyEval_EvalFrameEx (ceval.c:3802)
 ==25274==    by 0x4F17E87: PyEval_EvalFrameEx (ceval.c:3792)
 ==25274==    by 0x4F17E87: PyEval_EvalFrameEx (ceval.c:3792)
 ==25274==  Address 0x174f8020 is not stack'd, malloc'd or (recently)
 free'd
 ==25274==
 array([[ 0.,  0.,  0., ...,  0., -0., -0.],
        [ 0.,  0.,  0., ...,  0., -0., -0.],
        [ 0.,  0.,  0., ...,  0., -0., -0.],
        ...,
        [ 0.,  0.,  0., ...,  0.,  0.,  0.],
        [ 0.,  0.,  0., ...,  0.,  0.,  0.],
 ==25274== Invalid read of size 4
 ==25274==    at 0x4EB9043: PyObject_Free (obmalloc.c:931)
 ==25274==    by 0x4F15CA4: PyEval_EvalFrameEx (ceval.c:1632)
 ==25274==    by 0x4F17E87: PyEval_EvalFrameEx (ceval.c:3792)
 ==25274==    by 0x4F1926C: PyEval_EvalCodeEx (ceval.c:2968)
 ==25274==    by 0x4E9F7CA: function_call (funcobject.c:524)
 ==25274==    by 0x4E73162: PyObject_Call (abstract.c:2492)
 ==25274==    by 0x4F15EC2: PyEval_EvalFrameEx (ceval.c:4019)
 ==25274==    by 0x4F1926C: PyEval_EvalCodeEx (ceval.c:2968)
 ==25274==    by 0x4E9F6CE: function_call (funcobject.c:524)
 ==25274==    by 0x4E73162: PyObject_Call (abstract.c:2492)
 ==25274==    by 0x4E8455E: instancemethod_call (classobject.c:2579)
 ==25274==    by 0x4E73162: PyObject_Call (abstract.c:2492)
 ==25274==  Address 0x363cc020 is 12,256 bytes inside a block of size
 12,832 free'd
 ==25274==    at 0x4C262A1: free (vg_replace_malloc.c:366)
 ==25274==    by 0x11FFDEA8: ATL_dmmJIK (in /tmp/sage-4.7-linux-64bit-
 ubuntu_10.04.1_lts-x86_64-Linux/local/lib/libatlas.so)
 ==25274==    by 0x11FF5365: ATL_dgemm (in /tmp/sage-4.7-linux-64bit-
 ubuntu_10.04.1_lts-x86_64-Linux/local/lib/libatlas.so)
 ==25274==    by 0x32173B57: dotblas_matrixproduct (_dotblas.c:766)
 ==25274==    by 0x4F17591: PyEval_EvalFrameEx (ceval.c:3706)
 ==25274==    by 0x4F1926C: PyEval_EvalCodeEx (ceval.c:2968)
 ==25274==    by 0x4F19341: PyEval_EvalCode (ceval.c:522)
 ==25274==    by 0x4F18618: PyEval_EvalFrameEx (ceval.c:4401)
 ==25274==    by 0x4F1926C: PyEval_EvalCodeEx (ceval.c:2968)
 ==25274==    by 0x4F1760C: PyEval_EvalFrameEx (ceval.c:3802)
 ==25274==    by 0x4F1926C: PyEval_EvalCodeEx (ceval.c:2968)
 ==25274==    by 0x4F1760C: PyEval_EvalFrameEx (ceval.c:3802)
 ==25274==
        [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
 Time: CPU 3.18 s, Wall: 5.07 s
 sage:
 }}}

 I now really wonder whether the segfault would occur on redhawk (the
 machine the binary distribution was built on) itself, and what GCC version
 it uses...

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11674#comment:19>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to