after upgrade to 9.3, SignalError: Illegal instruction

273 views
Skip to first unread message

share the sage

unread,
Jun 17, 2021, 9:31:17 PM6/17/21
to sage-s...@googlegroups.com
Hi there!

First, I want to share my appreciation and joy for this software Sage, that I really love. Thank you all the developers that continue growing SageMath everyday. Thank you.

Today, I've upgraded to 9.3. I've been using 9.0 until yesterday.

I've downloaded the binaries for my Linux Mint 18.3, that is, for Ubuntu 16.04.

Both versions of Sage, were downloaded via torrent, sage-9.0-Ubuntu_16.04-x86_64.tar.bz2 and  sage-9.3-Ubuntu_16.04-x86_64.tar.bz2

But this operation that worked on the notebook yesterday with Sage 9.0 gives me this error today with Sage 9.3:

In[1]:
print(version())
m=matrix(QQ,[0, 0, 2, 1])
print(m)
m_rs=m.row_space()
print(m_rs)
facet_z_plus_basis=m.right_kernel().basis()
facet_z_plus_basis

Out[1]:
SageMath version 9.3, Release Date: 2021-05-09
[0 0 2 1]
Vector space of degree 4 and dimension 1 over Rational Field
Basis matrix:
[ 0 0 1 1/2]
----------------------------------------------------------------
SignalError
...
-> 3882 sig_on() 
   3883 dim = nullspaceMP(self._nrows, self._ncols, m, &mp_N)
   3884 sig_off()

SignalError: Illegal instruction

I've attached a notebook and html export with the full traceback.

This code works fine on SageCell (permalink here)

So, I would like to know how to fix this issue and make it work again, without rolling back to  previous version of Sage.

Looking forward for your answers.
Thanks in advance,

Share_The_Sage!

PS: Some specs from my system (parsed from inxi -z and hostnamectl):

        SageMath: version 9.3, Release Date: 2021-05-09
Operating System: Linux Mint 18.3
          Kernel: Linux 4.4.0-190-generic
    Architecture: x86-64
             CPU: Dual core Intel Core i3-3217U (-HT-MCP-)
       Max speed: 1800 MHz
          Memory: 7875.4MB

SignalError_Illegal_instruction__while_matrix_kernel_basis.ipynb
SignalError_Illegal_instruction__while_matrix_kernel_basis.html

share the sage

unread,
Jul 1, 2021, 9:49:48 PM7/1/21
to sage-s...@googlegroups.com
Hi there!

I've upgraded to Linux Mint 20.1 Ulyssa (kernel 5.4.0-77-generic), and then I've build Sage 9.3 from source.

Now the issue is solved. Thanks for this amazing software!

I downloaded sources tarball for sage 9.3 via torrent. Then, before proceeding, I studied README.md and source.rst from the tarball ( sage-9.3/README.md and sage-9.3/src/doc/en/installation/source.rst)

I installed all the required and recommended packages for Linux Mint (Debian, Ubuntu) pointed at source.rst (link to debian.txt was broken at README.md) I took the advice to set export MAKE='make -j2' as I have two cores.
[dochtml] Done building the documentation!
make --no-print-directory 'SAGE_ROOT/local/etc/sage-started.txt'
"
SAGE_ROOT/build/bin/sage-starts"

Testing that Sage starts...
[2021-06-30 21:50:55] SageMath version 9.3, Release Date: 2021-05-09
Yes, Sage starts.
make[2]: Leaving directory '
SAGE_ROOT/build/make'

real    223m53,530s  == 3 hours 40 minutes!!
user    459m24,031s
sys    17m32,635s
Sage build/upgrade complete!

And then I ran parallel testing:
sage -t --long --random-seed=0 src/sage/tests/parigp.py
    [13 tests, 1166.50 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 12934.5 seconds  == 3 hours 35 minutes!!
    cpu time: 39406.1 seconds
    cumulative wall time: 47546.7 seconds

So, happy! ^_^

Thank you again!

Share_The_Sage!

slelievre

unread,
Jul 2, 2021, 3:28:59 PM7/2/21
to sage-support
2021-07-02 03:49:48 UTC+2, share the sage:

>
> Hi there!
>
> I've upgraded to Linux Mint 20.1 Ulyssa (kernel 5.4.0-77-generic),
> and then I've build Sage 9.3 from source.
>
> Now the issue is solved. Thanks for this amazing software!

Thanks for the news and your detailed report.

> I downloaded sources tarball for sage 9.3 via torrent. Then, before
> proceeding, I studied README.md and source.rst from the tarball
> (sage-9.3/README.md and sage-9.3/src/doc/en/installation/source.rst)

>
> I installed all the required and recommended packages for Linux Mint
> (Debian, Ubuntu) pointed at source.rst (link to debian.txt was broken
> at README.md) I took the advice to set export MAKE='make -j2'
> as I have two cores.

The broken link is fixed in Sage Trac ticket 31909
https://trac.sagemath.org/ticket/31909
which was merged in Sage 9.4.beta4.


> [dochtml] Done building the documentation!
> make --no-print-directory 'SAGE_ROOT/local/etc/sage-started.txt'
> "SAGE_ROOT/build/bin/sage-starts"
>
> Testing that Sage starts...
> [2021-06-30 21:50:55] SageMath version 9.3, Release Date: 2021-05-09
> Yes, Sage starts.
> make[2]: Leaving directory 'SAGE_ROOT/build/make'
>
> real    223m53,530s  == 3 hours 40 minutes!!
> user    459m24,031s
> sys    17m32,635s
> Sage build/upgrade complete!
>
> And then I ran parallel testing:
>
> sage -t --long --random-seed=0 src/sage/tests/parigp.py
>     [13 tests, 1166.50 s]
> ----------------------------------------------------------------------
> All tests passed!
> ----------------------------------------------------------------------
> Total time for all tests: 12934.5 seconds  == 3 hours 35 minutes!!
>     cpu time: 39406.1 seconds
>     cumulative wall time: 47546.7 seconds
>
> So, happy! ^_^
>
> Thank you again!
> Share_The_Sage!

Wonderful. happy Sage usage!   --Samuel

Marco Streng

unread,
Aug 23, 2021, 9:43:00 AM8/23/21
to sage-support
Hi everyone,

I'm having the same problem, on Ubuntu 18.04:

I unpack the binaries sage-9.3-Ubuntu_18.04-x86_64.tar.bz2 and run ./sage
Then I see a few lines that look like

/home/strengtc/software/sage-9.3/local/lib/python3.9/site-packages/traitlets/config/loader.py:795: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(key) is 1:

or

/home/strengtc/software/sage-9.3/local/lib/python3.9/site-packages/psutil/_pslinux.py:551: DeprecationWarning: invalid escape sequence \d

(with various python files and sometimes with \s instead of \d).

And then (in SageMath in the terminal) some things work without problem, but there are also various inputs that give the "Illegal instruction" error on a "sig_on()" line of a pyx file. For example, the same input of share-the-sage, but also the following example from the documentation, give the error:
K.<a> = NumberField(x^10 - 2)
L.<c,d> = K.relativize(a^4 + a^2 + 2); L
(full in- and output below)

Do you have any suggestions for fixing this without asking my system administrator to upgrade to Ubuntu 20.04 and/or rebuilding? How likely is it that upgrading to Ubuntu 20.04 will fix the problem for me too?

Thanks!
Marco


./sage

┌────────────────────────────────────────────────────────────────────┐

│ SageMath version 9.3, Release Date: 2021-05-09                     │

│ Using Python 3.9.2. Type "help()" for help.                        │

└────────────────────────────────────────────────────────────────────┘

sage: print(version()) 

....: m=matrix(QQ,[0, 0, 2, 1]) 

....: print(m) 

....: m_rs=m.row_space() 

....: print(m_rs) 

....: facet_z_plus_basis=m.right_kernel().basis() 

....:                                                                                                                                                                                                                                                   

SageMath version 9.3, Release Date: 2021-05-09

[0 0 2 1]

Vector space of degree 4 and dimension 1 over Rational Field

Basis matrix:

[  0   0   1 1/2]

---------------------------------------------------------------------------

SignalError                               Traceback (most recent call last)

<ipython-input-1-9e12efdb7684> in <module>

      4 m_rs=m.row_space()

      5 print(m_rs)

----> 6 facet_z_plus_basis=m.right_kernel().basis()


~/software/sage-9.3/local/lib/python3.9/site-packages/sage/matrix/matrix2.pyx in sage.matrix.matrix2.Matrix.right_kernel (build/cythonized/sage/matrix/matrix2.c:31059)()

   4717 

   4718         # Go get the kernel matrix, this is where it all happens

-> 4719         M = self.right_kernel_matrix(*args, **kwds)

   4720 

   4721         ambient = R**self.ncols()


~/software/sage-9.3/local/lib/python3.9/site-packages/sage/matrix/matrix2.pyx in sage.matrix.matrix2.Matrix.right_kernel_matrix (build/cythonized/sage/matrix/matrix2.c:29696)()

   4318         if M is None:

   4319             try:

-> 4320                 format, M = self._right_kernel_matrix(algorithm=algorithm, proof=proof)

   4321             except AttributeError:

   4322                 pass


~/software/sage-9.3/local/lib/python3.9/site-packages/sage/matrix/matrix_rational_dense.pyx in sage.matrix.matrix_rational_dense.Matrix_rational_dense._right_kernel_matrix (build/cythonized/sage/matrix/matrix_rational_dense.cpp:14103)()

   1424         else:

   1425             A, _ = self._clear_denom()

-> 1426             K = A._rational_kernel_iml().transpose().change_ring(QQ)

   1427         verbose("done computing right kernel matrix over the rationals for %sx%s matrix" % (self.nrows(), self.ncols()),level=1, t=tm)

   1428         return 'computed-iml-rational', K


~/software/sage-9.3/local/lib/python3.9/site-packages/sage/matrix/matrix_integer_dense.pyx in sage.matrix.matrix_integer_dense.Matrix_integer_dense._rational_kernel_iml (build/cythonized/sage/matrix/matrix_integer_dense.cpp:32352)()

   3880         time = verbose('computing null space of %s x %s matrix using IML'%(self._nrows, self._ncols))

   3881         cdef mpz_t * m = fmpz_mat_to_mpz_array(self._matrix)

-> 3882         sig_on()

   3883         dim = nullspaceMP(self._nrows, self._ncols, m, &mp_N)

   3884         sig_off()


SignalError: Illegal instruction

sage: 1+1                                                                                                                                                                                                                                               

2

sage: K.<a> = NumberField(x^10 - 2

....:                                                                                                                                                                                                                                                   

sage: L.<c,d> = K.relativize(a^4 + a^2 + 2); L 

....:                                                                                                                                                                                                                                                   

---------------------------------------------------------------------------

SignalError                               Traceback (most recent call last)

<ipython-input-4-c3c40cc6568a> in <module>

----> 1 L = K.relativize(a**Integer(4) + a**Integer(2) + Integer(2), names=('c', 'd',)); (c, d,) = L._first_ngens(2); L


~/software/sage-9.3/local/lib/python3.9/site-packages/sage/rings/number_field/number_field.py in relativize(self, alpha, names, structure)

   9351         basis.append(a**extdeg) # this one makes the basis no longer a basis

   9352         mat = matrix([ b.vector() for b in basis ])

-> 9353         soln_space = mat.left_kernel(mat.row_space()(0))

   9354         # the solution space is one dimensional and the last entry is non-zero

   9355         # because a satisfies no smaller linear relation


~/software/sage-9.3/local/lib/python3.9/site-packages/sage/matrix/matrix2.pyx in sage.matrix.matrix2.Matrix.left_kernel (build/cythonized/sage/matrix/matrix2.c:31591)()

   4879 

   4880         tm = verbose("computing left kernel for %sx%s matrix" % (self.nrows(), self.ncols()),level=1)

-> 4881         K = self.transpose().right_kernel(*args, **kwds)

   4882         self.cache('left_kernel', K)

   4883         verbose("done computing left kernel for %sx%s matrix" % (self.nrows(), self.ncols()),level=1,t=tm)


~/software/sage-9.3/local/lib/python3.9/site-packages/sage/matrix/matrix2.pyx in sage.matrix.matrix2.Matrix.right_kernel (build/cythonized/sage/matrix/matrix2.c:31059)()

   4717 

   4718         # Go get the kernel matrix, this is where it all happens

-> 4719         M = self.right_kernel_matrix(*args, **kwds)

   4720 

   4721         ambient = R**self.ncols()


~/software/sage-9.3/local/lib/python3.9/site-packages/sage/matrix/matrix2.pyx in sage.matrix.matrix2.Matrix.right_kernel_matrix (build/cythonized/sage/matrix/matrix2.c:29696)()

   4318         if M is None:

   4319             try:

-> 4320                 format, M = self._right_kernel_matrix(algorithm=algorithm, proof=proof)

   4321             except AttributeError:

   4322                 pass


~/software/sage-9.3/local/lib/python3.9/site-packages/sage/matrix/matrix_rational_dense.pyx in sage.matrix.matrix_rational_dense.Matrix_rational_dense._right_kernel_matrix (build/cythonized/sage/matrix/matrix_rational_dense.cpp:14103)()

   1424         else:

   1425             A, _ = self._clear_denom()

-> 1426             K = A._rational_kernel_iml().transpose().change_ring(QQ)

   1427         verbose("done computing right kernel matrix over the rationals for %sx%s matrix" % (self.nrows(), self.ncols()),level=1, t=tm)

   1428         return 'computed-iml-rational', K


~/software/sage-9.3/local/lib/python3.9/site-packages/sage/matrix/matrix_integer_dense.pyx in sage.matrix.matrix_integer_dense.Matrix_integer_dense._rational_kernel_iml (build/cythonized/sage/matrix/matrix_integer_dense.cpp:32352)()

   3880         time = verbose('computing null space of %s x %s matrix using IML'%(self._nrows, self._ncols))

   3881         cdef mpz_t * m = fmpz_mat_to_mpz_array(self._matrix)

-> 3882         sig_on()

   3883         dim = nullspaceMP(self._nrows, self._ncols, m, &mp_N)

   3884         sig_off()


SignalError: Illegal instruction


Op vrijdag 2 juli 2021 om 21:28:59 UTC+2 schreef slelievre:

share the sage

unread,
Aug 23, 2021, 4:33:18 PM8/23/21
to sage-s...@googlegroups.com
Hi Marco, How are you?

In my case, upgrading to Ubuntu 20.04 base, didn't solve the issue. Building did.

I had the same SignalError on Linux Mint 20.1 (based on Ubuntu 20.04) with the corresponding Sage prebuild binaries as in Linux Mint 18.3 (based on Ubuntu 16.04).

So, I took courage and face the build process myself.

In your case, if I understand correctly, your system administrator might be doing the Sage build, right?

Buenaventura,

Share_The_Sage!
--
You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/KZFZBoI6xJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/bf6cec27-03f4-4383-bad4-e4feaa2d8a16n%40googlegroups.com.


-- 
Share_The_Sage!

Dima Pasechnik

unread,
Aug 24, 2021, 1:48:00 AM8/24/21
to sage-support
These "illegal instruction" errors are an indication that the binary was built for a more advanced CPU than yours - which does not support certain CPU commands. It's a bug in "fat binary" build process we see for some time.

Build Sage yourself, or use Conda.


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 view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/ba282f55-f07b-2781-8ba8-cb148803370b%40gmail.com.

Marco Streng

unread,
Aug 24, 2021, 10:08:11 AM8/24/21
to sage-support
Thanks, I'll do that.

Op dinsdag 24 augustus 2021 om 07:48:00 UTC+2 schreef dim...@gmail.com:

Samuel Lelièvre

unread,
Aug 24, 2021, 12:03:01 PM8/24/21
to Sage-support
2021-08-24 05:48 UTC, Dima Pasechnik:
>
> These "illegal instruction" errors are an indication
> that the binary was built for a more advanced CPU
> than yours - which does not support certain CPU
> commands. It's a bug in "fat binary" build process
> we see for some time.
>
> Build Sage yourself, or use Conda.

I opened a ticket at binary-pkg for that:
https://github.com/sagemath/binary-pkg/issues/31

Marco Streng

unread,
Aug 25, 2021, 11:57:44 AM8/25/21
to sage-support
In the end I build 9.4 from source and that worked perfectly. And it turned out that the Ubuntu 18.04 binaries of 9.2 also work on this particular machine (though we went for 9.4 in the end). Thanks again for the help.

Op dinsdag 24 augustus 2021 om 18:03:01 UTC+2 schreef slelievre:

William Stein

unread,
Aug 25, 2021, 11:15:02 PM8/25/21
to sage-support
Hi,

I release cocalc-docker ([1], [2]) a few days ago with sage-9.4, and had people reporting back "illegal instruction" issues.  Sage is built there with SAGE_FAT_BINARY="yes", using this script [3].  One person who reported a problem had a "Dell PowerEdge R710." and I built on an intel Dell PowerEdge R630, for what it is worth.  They got the error "An illegal instructor occurred" when computing "5+2" in Sage. 

My solution for now is to keep cocalc-docker at sage-9.3 for the time being, and suggest that people build sage from source on their own machine if necessary.   I'll let you know if I have any further information, but I just wanted to add this data point.

Matthias Koeppe

unread,
Aug 26, 2021, 12:17:08 AM8/26/21
to sage-support
I've opened https://trac.sagemath.org/ticket/32424 for this issue with Sage 9.4.

Samuel Lelièvre

unread,
Aug 26, 2021, 6:02:50 AM8/26/21
to Sage-support
Would it help to set `CFLAGS` to `-mno-avx -mno-avx2 -mno-bmi2`
as is done for building the Sage macOS app? --Samuel

Nathan Dunfield

unread,
Aug 26, 2021, 2:38:10 PM8/26/21
to sage-support
I suspect the cause is OpenBLAS.  While this library is built with DYNAMIC_ARCH=1, there is still the non-performance critical code which will use whatever instructions are available on the machine at compile time unless you also set TARGET.  See

https://github.com/xianyi/OpenBLAS/issues/3056

For the macOS app, Marc Culler had to set TARGET=CORE2 so that it would run on a 2013 cylindrical Mac Pro (this version is not yet posted).

Best,

Nathan

Max Alekseyev

unread,
Sep 1, 2021, 3:30:02 PM9/1/21
to sage-support
I'm also seeing illegal instruction in Sage 9.3 and 9.4 (and not in 9.2) while doing some linear algebra, although I'm not sure if it's the same bug or not.
In either case, my bugreport is submitted to https://trac.sagemath.org/ticket/32447

Regards,
Max

Dima Pasechnik

unread,
Sep 1, 2021, 4:28:11 PM9/1/21
to sage-support

--
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.
Reply all
Reply to author
Forward
0 new messages