Re: Segmentation fault in Matrix(QQ).rank()

110 views
Skip to first unread message

Volker Braun

unread,
Apr 11, 2013, 2:44:26 PM4/11/13
to sage-s...@googlegroups.com
You should post the output of sage_input(m) somewhere, then others could try it out.

Its almost guaranteed that your bug is due to atlas being compiled with the wrong settings for your cpu. Try installing from source.






On Thursday, April 11, 2013 6:42:36 PM UTC+1, Sure wrote:
Got sigsegv calculating rank of 80 x 79 dense matrix over Rational Field.

  File "matrix_rational_dense.pyx", line 2353, in sage.matrix.matrix_rational_dense.Matrix_rational_dense.rank (sage/matrix/matrix_rational_dense.c:22283)
  File "matrix_integer_dense.pyx", line 3216, in sage.matrix.matrix_integer_dense.Matrix_integer_dense.rank (sage/matrix/matrix_integer_dense.c:25776)
  File "matrix_integer_dense.pyx", line 3238, in sage.matrix.matrix_integer_dense.Matrix_integer_dense._rank_modp (sage/matrix/matrix_integer_dense.c:26097)
  File "matrix_modn_dense_template.pxi", line 2257, in sage.matrix.matrix_modn_dense_double.Matrix_modn_dense_template.rank (sage/matrix/matrix_modn_dense_double.cpp:12948)
  File "matrix_modn_dense_template.pxi", line 244, in sage.matrix.matrix_modn_dense_double.linbox_rank (sage/matrix/matrix_modn_dense_double.cpp:4446)
RuntimeError: Segmentation fault


System: debian x64 testing/unstable
CPU: 2.4 GHz Intel E6600 (2 cores), 2GB RAM, 64GB swap
Version: 'Sage Version 5.8, Release Date: 2013-03-15' from binary

Sorry, don't know how to put save file m.sobj here, cannot paste the whole matrix itself from m.str() here, so posting link to logfile:
  http://yadi.sk/d/1igWnkOr3zBiS

To reproduce bug, after creating matrix m, call m.rank()

Jeroen Demeyer

unread,
Apr 11, 2013, 4:00:07 PM4/11/13
to sage-s...@googlegroups.com
On 04/11/2013 08:44 PM, Volker Braun wrote:
> Its almost guaranteed that your bug is due to atlas being compiled with
> the wrong settings for your cpu.
I don't see how that could give a segmentation fault.

Sure

unread,
Apr 11, 2013, 4:29:34 PM4/11/13
to sage-s...@googlegroups.com
It can be loaded by m=load("mi.sobj")
Can not post sage_input(m) right now.
Probably I got how to post files just here.

About ATLAS: afaik it is a floating point library, but my matrix is rational, can it depend on ATLAS? Maybe people with correct settings would check, if the bug happens in their sage. 


mi.sobj

Volker Braun

unread,
Apr 11, 2013, 4:45:57 PM4/11/13
to sage-s...@googlegroups.com
Works for me:

sage: m.rank()
80

On Thursday, April 11, 2013 9:29:34 PM UTC+1, Sure wrote:
About ATLAS: afaik it is a floating point library, but my matrix is rational, can it depend on ATLAS? Maybe people with correct settings would check, if the bug happens in their sage. 

Suprisingly enough, the rank computation goes rational -> integer -> finite field -> floating point.

Jeroen Demeyer

unread,
Apr 11, 2013, 4:48:50 PM4/11/13
to sage-s...@googlegroups.com
On 04/11/2013 10:45 PM, Volker Braun wrote:
> Works for me:
>
> sage: m.rank()
> 80

A 80 x 79 matrix of rank 80?

Volker Braun

unread,
Apr 11, 2013, 4:52:03 PM4/11/13
to sage-s...@googlegroups.com
Good catch, but the example that Sure posted is 81x80:

sage: m
81 x 80 dense matrix over Rational Field (type 'print m.str()' to see all of the entries)

Sure

unread,
Apr 11, 2013, 7:06:15 PM4/11/13
to sage-s...@googlegroups.com
Sorry, it is really 81 by 80,  quite strange. But it still segfaults at m.rank().
md5: a9619508e02588d23290d63ae6f3ca44 mi.sobj

What is your sage version, OS (with bits) and computer?
In that file matrix_modn_dense_double.cpp some cython magic is being done, I am not sure how to debug it.

Volker Braun

unread,
Apr 12, 2013, 5:25:18 AM4/12/13
to sage-s...@googlegroups.com
Just compile Sage from source. Its a problem with your binaries, not with the Sage source code.

Georgi Guninski

unread,
Apr 12, 2013, 10:39:01 AM4/12/13
to sage-s...@googlegroups.com
i have SEGV with some matrices, so you are not the only one.

On Thu, Apr 11, 2013 at 10:42:36AM -0700, Sure wrote:
> Got sigsegv calculating rank of 80 x 79 dense matrix over Rational Field.
>
> File "matrix_rational_dense.pyx", line 2353, in sage.matrix.matrix_rational_dense.Matrix_rational_dense.rank (sage/matrix/matrix_rational_dense.c:22283)
> File "matrix_integer_dense.pyx", line 3216, in sage.matrix.matrix_integer_dense.Matrix_integer_dense.rank (sage/matrix/matrix_integer_dense.c:25776)
> File "matrix_integer_dense.pyx", line 3238, in sage.matrix.matrix_integer_dense.Matrix_integer_dense._rank_modp (sage/matrix/matrix_integer_dense.c:26097)
> File "matrix_modn_dense_template.pxi", line 2257, in sage.matrix.matrix_modn_dense_double.Matrix_modn_dense_template.rank (sage/matrix/matrix_modn_dense_double.cpp:12948)
> File "matrix_modn_dense_template.pxi", line 244, in sage.matrix.matrix_modn_dense_double.linbox_rank (sage/matrix/matrix_modn_dense_double.cpp:4446)
> RuntimeError: Segmentation fault
>
>
> System: debian x64 testing/unstable
> CPU: 2.4 GHz Intel E6600 (2 cores), 2GB RAM, 64GB swap
> Version: 'Sage Version 5.8, Release Date: 2013-03-15' from binary
>
> Sorry, don't know how to put save file m.sobj here, cannot paste the whole matrix itself from m.str() here, so posting link to logfile:
> http://yadi.sk/d/1igWnkOr3zBiS
>
> To reproduce bug, after creating matrix m, call m.rank()
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.

Volker Braun

unread,
Apr 12, 2013, 10:49:07 AM4/12/13
to sage-s...@googlegroups.com, guni...@guninski.com
After compiling from source?

Sure

unread,
Apr 17, 2013, 2:55:04 PM4/17/13
to sage-s...@googlegroups.com
Thanks! Built from source and now it works.
So there is a bug in sage binary distributions? I took sage-5.8-linux-64bit-ubuntu_10.04.4_lts-x86_64-Linux.tar.lzma,
and ubuntu is based on debian. It really may call ATLAS, but what its fault might cause such behaviour?

William Stein

unread,
Apr 17, 2013, 3:38:42 PM4/17/13
to sage-s...@googlegroups.com
On Wed, Apr 17, 2013 at 11:55 AM, Sure <a.a....@gmail.com> wrote:
> Thanks! Built from source and now it works.
> So there is a bug in sage binary distributions? I took
> sage-5.8-linux-64bit-ubuntu_10.04.4_lts-x86_64-Linux.tar.lzma,
> and ubuntu is based on debian. It really may call ATLAS, but what its fault
> might cause such behaviour?

When you first installed and started the Sage binary did it give some
terrifying warning message about missing CPU instructions, along with
a message about how to disable the warning? If you got no such
message, there is a bug -- the cpu checks should be more stringent --
what is the output of "cat /proc/cpuinfo" on your computer? If you
did get such a message, well, you were warned :-)

William

>
> On Friday, April 12, 2013 1:25:18 PM UTC+4, Volker Braun wrote:
>>
>> Just compile Sage from source. Its a problem with your binaries, not with
>> the Sage source code.
>>
>>
>> On Friday, April 12, 2013 12:06:15 AM UTC+1, Sure wrote:
>>>
>>> Sorry, it is really 81 by 80, quite strange. But it still segfaults at
>>> m.rank().
>>> md5: a9619508e02588d23290d63ae6f3ca44 mi.sobj
>>>>>
>>>>>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Sure

unread,
Apr 21, 2013, 12:54:45 PM4/21/13
to sage-s...@googlegroups.com
Nope, I didn't see warnings, and didn't try to dismiss them.
What the steps it might have suggested?
I put cpuinfo content into the attach. 
cpuinfo.txt

Jeroen Demeyer

unread,
Apr 21, 2013, 5:07:24 PM4/21/13
to sage-s...@googlegroups.com
On 04/17/2013 09:38 PM, William Stein wrote:
> On Wed, Apr 17, 2013 at 11:55 AM, Sure <a.a....@gmail.com> wrote:
>> Thanks! Built from source and now it works.
>> So there is a bug in sage binary distributions? I took
>> sage-5.8-linux-64bit-ubuntu_10.04.4_lts-x86_64-Linux.tar.lzma,
>> and ubuntu is based on debian. It really may call ATLAS, but what its fault
>> might cause such behaviour?
>
> When you first installed and started the Sage binary did it give some
> terrifying warning message about missing CPU instructions, along with
> a message about how to disable the warning? If you got no such
> message, there is a bug -- the cpu checks should be more stringent --
> what is the output of "cat /proc/cpuinfo" on your computer? If you
> did get such a message, well, you were warned :-)
In any case, I fail to see how missing CPU features could lead to a
Segmentation Fault. It's more likely a library incompatibility or something.

Sure

unread,
Apr 23, 2013, 4:09:27 PM4/23/13
to sage-s...@googlegroups.com
Yep, it might have switched to another internal library because of the matrix size, and that library might have appeared incompatible with debian (may be to new glibc version or like that) or just broken.
It could be interesting to try to reinstall from sources with system ATLAS.
I tried by ldd the installed sage binary libraries to find incompatibility, but found nothing.
Is it possible to rebuild them one by one?
Reply all
Reply to author
Forward
0 new messages