Ask Your Question

PARI stack overflows

asked 2018-06-12 18:38:18 +0200

RegularUser gravatar image

updated 2018-06-14 00:25:02 +0200

Trying to determine the kernel of a map between free ZZ-modules of finite rank, I get the following error

  File "/home/ubuntu/SageMath/local/lib/python2.7/site-packages/sage/modules/", line 720, in kernel
    V = self.matrix().kernel()
  File "sage/matrix/matrix2.pyx", line 4337, in sage.matrix.matrix2.Matrix.left_kernel (build/cythonized/sage/matrix/matrix2.c:32211)
  File "sage/matrix/matrix2.pyx", line 4178, in sage.matrix.matrix2.Matrix.right_kernel (build/cythonized/sage/matrix/matrix2.c:31652)
  File "sage/matrix/matrix2.pyx", line 3782, in sage.matrix.matrix2.Matrix.right_kernel_matrix (build/cythonized/sage/matrix/matrix2.c:30166)
  File "sage/matrix/matrix_integer_dense.pyx", line 2558, in sage.matrix.matrix_integer_dense.Matrix_integer_dense._right_kernel_matrix (build/cythonized/sage/matrix/matrix_integer_dense.c:22234)
  File "cypari2/gen.pyx", line 4483, in cypari2.gen.Gen.matkerint
  File "cypari2/handle_error.pyx", line 196, in cypari2.handle_error._pari_err_handle
cypari2.handle_error.PariError: the PARI stack overflows (current size: 259719168; maximum size: 259719168)
You can use pari.allocatemem() to change the stack size and try again

How do I adjust the maximum PARI stack size from within Sage?

Edit: Strangely, whether this problem occurs does not only depend on the total memory used. In one case, the computation used up to 14 GB and ran just fine, in another case this error occured when only 8 GB had been used.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-13 17:23:16 +0200

tmonteil gravatar image

Your computation might be too heavy, but it is hard to say without a concrete example.

That said, you can try to enlarge the pari stack size:

You can get the current stack size as follows:

sage: pari.stacksize()

You can set a larger stacksize as follows:

sage: pari.allocatemem(10^9)
edit flag offensive delete link more


Would computing the kernel of an integer matrix of size about 2000x2000 be "heavy"?

RegularUser gravatar imageRegularUser ( 2018-06-13 18:59:54 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-06-12 18:38:18 +0200

Seen: 1,025 times

Last updated: Jun 14 '18