Ask Your Question

Revision history [back]

PARI stack overflows

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/matrix_morphism.py", 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?

PARI stack overflows

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/matrix_morphism.py", 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.