Issue with finding rank of a 255 x 121 dense matrix over GF(5)

34 views
Skip to first unread message

Jacob Schlather

unread,
Aug 6, 2011, 1:34:23 AM8/6/11
to sage-support
I'm having a bit of a strange issue, I'm working on something where I
need to find the rank of a somewhat large matrix over a finite field.
I recall testing sage's capabilities when I was looking at how I was
going to take the rank and remember sage taking the rank of matrices
much larger than the one that's giving me trouble. Anyway the matrix
I'm having an issue with is in the following file
https://docs.google.com/leaf?id=0B_KM7xCfSwolYmQ4YTEzYjItYTNiZC00MTAxLTkxZGUtN2I3YzQ5NjRkOThh&hl=en_US
.

The program works like a charm for matrices of smaller sizes, during
this run it will get up to around size 381*70 before crashing. If I'm
working over GF(7) then it's segfaulting for a matrix the size of 180
x 116. It's possible that the error is somehow hidden in my program,
in the off chance I've uploaded it here as well
https://docs.google.com/leaf?id=0B_KM7xCfSwolY2UxNDA4OGQtZTJhZS00ZDBlLTg4ZDAtNjNmMzkzMWQyNmVh&hl=en_US
. The offending inputs would be
Lambda(5,5,5,1) and Lambda(7,4,7,1), of course increase the majority
of those values will also give the same error.

The error message I'm getting is:

RuntimeError Traceback (most recent call
last)

/media/Media/Sage/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/
<ipython console> in <module>()

/media/Media/Sage/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/
<string> in Lambda(q, m, k, r)

/media/Media/Sage/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/
local/lib/python2.6/site-packages/sage/matrix/matrix_modn_dense.so in
sage.matrix.matrix_modn_dense.Matrix_modn_dense.rank (sage/matrix/
matrix_modn_dense.c:11595)()

RuntimeError: Segmentation fault

William Stein

unread,
Aug 6, 2011, 3:05:00 AM8/6/11
to sage-s...@googlegroups.com
On Fri, Aug 5, 2011 at 10:34 PM, Jacob Schlather
<jacob.s...@gmail.com> wrote:
> I'm having a bit of a strange issue, I'm working on something where I
> need to find the rank of a somewhat large matrix over a finite field.
> I recall testing sage's capabilities when I was looking at how I was
> going to take the rank and remember sage taking the rank of matrices
> much larger than the one that's giving me trouble. Anyway the matrix
> I'm having an issue with is in the following file
> https://docs.google.com/leaf?id=0B_KM7xCfSwolYmQ4YTEzYjItYTNiZC00MTAxLTkxZGUtN2I3YzQ5NjRkOThh&hl=en_US
> .

It is an interesting exercise just to load that matrix into Sage,
given the way you provided it.
It would have been much nicer to provide a link to a pickle, or
sage_input, or convert
the matrix to a list first or something. Anyway, after downloading
your matrix, I can make the
corresponding Sage matrix as follows, I think:

sage: a = open('Matrix.dat').readlines()[1:]
sage: a = ''.join(open('Matrix.dat').readlines()[1:]).replace('[','').replace(']\n',',').replace('
',',')
sage: m = matrix(GF(5), 255,121, eval('['+a+']'))

I then try to compute the rank, and it seems to give me the answer instantly:

sage: time m.rank()
121
Time: CPU 0.01 s, Wall: 0.01 s

The answer seems very reasonable, since it would be the answer for a
random matrix of that size.
But who knows, maybe I read your matrix in incorrectly.

> The program works like a charm for matrices of smaller sizes, during
> this run it will get up to around size 381*70 before crashing. If I'm
> working over GF(7) then it's segfaulting for a matrix the size of 180
> x 116. It's possible that the error is somehow hidden in my program,

sage: a = random_matrix(GF(7), 180, 116)
sage: time a.rank()
116
Time: CPU 0.00 s, Wall: 0.00 s

It sounds like your copy of Sage is incorrectly installed. It would
be helpful to provide tons of useful information about
your sage install.


> in the off chance I've uploaded it here as well
> https://docs.google.com/leaf?id=0B_KM7xCfSwolY2UxNDA4OGQtZTJhZS00ZDBlLTg4ZDAtNjNmMzkzMWQyNmVh&hl=en_US
> . The offending inputs would be
> Lambda(5,5,5,1)  and Lambda(7,4,7,1), of course increase the majority
> of those values will also give the same error.
>
> The error message I'm getting is:
>
> RuntimeError                              Traceback (most recent call
> last)
>
> /media/Media/Sage/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/
> <ipython console> in <module>()
>
> /media/Media/Sage/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/
> <string> in Lambda(q, m, k, r)
>
> /media/Media/Sage/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/
> local/lib/python2.6/site-packages/sage/matrix/matrix_modn_dense.so in
> sage.matrix.matrix_modn_dense.Matrix_modn_dense.rank (sage/matrix/
> matrix_modn_dense.c:11595)()
>
> RuntimeError: Segmentation fault
>

> --
> To post to this group, send email to sage-s...@googlegroups.com
> To unsubscribe from this group, send email to sage-support...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

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

Jacob Schlather

unread,
Aug 6, 2011, 3:49:28 AM8/6/11
to sage-support
>It sounds like your copy of Sage is incorrectly installed. It would
>be helpful to provide tons of useful information about
>your sage install.

This is entirely probable. I unzipped the sage-4.7-linux-64bit-
ubuntu_10.04.1_lts-x86_64-Linux,
into a folder and have been using the pre-compiled binary. I'm
currently running 64 bit Ubuntu 10.10 - Maverick. I am running python
2.6.6 though, which could possibly be an issue. Sorry about the
inconvenient form of the matrix, I had just grabbed the output. And
I'm also segfaulting if I just do a random matrix (such as your
example). So it's definitely an issue with my install or that I'm
still running python 2.6.6. Perhaps updating to 3.0 will fix it.

On Aug 6, 3:05 am, William Stein <wst...@gmail.com> wrote:
> On Fri, Aug 5, 2011 at 10:34 PM, Jacob Schlather
>
> <jacob.schlat...@gmail.com> wrote:
> > I'm having a bit of a strange issue, I'm working on something where I
> > need to find the rank of a somewhat large matrix over a finite field.
> > I recall testing sage's capabilities when I was looking at how I was
> > going to take the rank and remember sage taking the rank of matrices
> > much larger than the one that's giving me trouble. Anyway the matrix
> > I'm having an issue with is in the following file
> >https://docs.google.com/leaf?id=0B_KM7xCfSwolYmQ4YTEzYjItYTNiZC00MTAx...
> >https://docs.google.com/leaf?id=0B_KM7xCfSwolY2UxNDA4OGQtZTJhZS00ZDBl...
> > . The offending inputs would be
> > Lambda(5,5,5,1)  and Lambda(7,4,7,1), of course increase the majority
> > of those values will also give the same error.
>
> > The error message I'm getting is:
>
> > RuntimeError                              Traceback (most recent call
> > last)
>
> > /media/Media/Sage/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/
> > <ipython console> in <module>()
>
> > /media/Media/Sage/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/
> > <string> in Lambda(q, m, k, r)
>
> > /media/Media/Sage/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/
> > local/lib/python2.6/site-packages/sage/matrix/matrix_modn_dense.so in
> > sage.matrix.matrix_modn_dense.Matrix_modn_dense.rank (sage/matrix/
> > matrix_modn_dense.c:11595)()
>
> > RuntimeError: Segmentation fault
>
> > --
> > To post to this group, send email to sage-s...@googlegroups.com
> > To unsubscribe from this group, send email to sage-support...@googlegroups.com
> > For more options, visit this group athttp://groups.google.com/group/sage-support

William Stein

unread,
Aug 6, 2011, 4:29:21 AM8/6/11
to sage-s...@googlegroups.com


On Saturday, August 6, 2011, Jacob Schlather <jacob.s...@gmail.com> wrote:
>>It sounds like your copy of Sage is incorrectly installed.  It would
>>be helpful to provide tons of useful information about
>>your sage install.
>
> This is entirely probable.  I unzipped the sage-4.7-linux-64bit-
> ubuntu_10.04.1_lts-x86_64-Linux,
> into a folder and have been using the pre-compiled binary. I'm
> currently running 64 bit Ubuntu 10.10 - Maverick. I am running python
> 2.6.6 though, which could possibly be an issue. Sorry about the
> inconvenient form of the matrix, I had just grabbed the output. And
> I'm also segfaulting if I just do a random matrix (such as your
> example). So it's definitely an issue with my install or that I'm
> still running python 2.6.6. Perhaps updating to 3.0 will fix it.

Your systemwide python is irrelevant.    Try building sage from source.
> For more options, visit this group at http://groups.google.com/group/sage-support

Jacob Schlather

unread,
Aug 6, 2011, 12:15:20 PM8/6/11
to sage-support
Compiling the source seems to have fixed it. Thanks for the help.

On Aug 6, 4:29 am, William Stein <wst...@gmail.com> wrote:
> On Saturday, August 6, 2011, Jacob Schlather <jacob.schlat...@gmail.com>
> groups.google.com/group/sage-support>> > URL:http://www.sagemath.org

William Stein

unread,
Aug 6, 2011, 12:26:23 PM8/6/11
to sage-s...@googlegroups.com
On Sat, Aug 6, 2011 at 9:15 AM, Jacob Schlather
<jacob.s...@gmail.com> wrote:
> Compiling the source seems to have fixed it. Thanks for the help.

Excellent! My guess i that the binary had either linbox or MPIR
compiled with support for some
processor instructions that maybe your computer doesn't have.... or
that one of them relied on
some library or something that you didn't have. Sorry for the
trouble. By building from source,
not only did it fix the problem you had, the resulting Sage should be
significantly faster, since it
is optimized for your hardware.

William

Rob Beezer

unread,
Aug 7, 2011, 2:27:36 AM8/7/11
to sage-support
On Aug 6, 9:26 am, William Stein <wst...@gmail.com> wrote:
> On Sat, Aug 6, 2011 at 9:15 AM, Jacob Schlather
>
> <jacob.schlat...@gmail.com> wrote:
> > Compiling the source seems to have fixed it. Thanks for the help.
>
> Excellent!  My guess i that the binary had either linbox or MPIR
> compiled with support for some
> processor instructions that maybe your computer doesn't have.... or
> that one of them relied on
> some library or something that you didn't have.

A similar thing has happened with kernels of medium-sized matrices
over the rationals. Similar in that it was a 64-bit Ubuntu binary
giving a segfault (very predictably), and building from source solved
the problem. I wonder if the two reports are related?

http://trac.sagemath.org/sage_trac/ticket/11581

Rob

Volker Braun

unread,
Aug 7, 2011, 4:49:24 AM8/7/11
to sage-s...@googlegroups.com
On Sunday, August 7, 2011 7:27:36 AM UTC+1, Rob Beezer wrote:
http://trac.sagemath.org/sage_trac/ticket/11581

That crash was literally in atlas, so its almost certainly due to some isa extension that the computer doesn't have.

The new atlas-3.8.4 spkg tries to respect the SAGE_FAT_BINARY variable, so it would be interesting to see if a binary build with it works.


Jacob Schlather

unread,
Aug 7, 2011, 1:27:38 PM8/7/11
to sage-support
I haven't deleted my sage binary yet, so I went ahead and tested it to
see if I can also recreate that error and indeed it will also segfault
for M = random_matrix(QQ,600,600), trying to find the rank or kernel.

William Stein

unread,
Aug 7, 2011, 3:37:01 PM8/7/11
to sage-s...@googlegroups.com
For the record you might as well post the output of

 cat /proc/cpuinfo

Jacob Schlather

unread,
Aug 7, 2011, 4:41:59 PM8/7/11
to sage-support
Sure

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Genuine Intel(R) CPU U7300 @ 1.30GHz
stepping : 10
cpu MHz : 800.000
cache size : 3072 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64
monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm
dts tpr_shadow vnmi flexpriority
bogomips : 2678.24
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Genuine Intel(R) CPU U7300 @ 1.30GHz
stepping : 10
cpu MHz : 800.000
cache size : 3072 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64
monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm
dts tpr_shadow vnmi flexpriority
bogomips : 2678.01
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:


On Aug 7, 3:37 pm, William Stein <wst...@gmail.com> wrote:
> For the record you might as well post the output of
>
>  cat /proc/cpuinfo
>
> On Sunday, August 7, 2011, Jacob Schlather <jacob.schlat...@gmail.com>

Rob Beezer

unread,
Aug 8, 2011, 11:39:27 PM8/8/11
to sage-support
On Aug 7, 1:41 pm, Jacob Schlather <jacob.schlat...@gmail.com> wrote:
> Sure
>
> processor       : 0
> vendor_id       : GenuineIntel

Thanks, Jacob. I'll point the other bug report back here.

Rob
Reply all
Reply to author
Forward
0 new messages