Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade: pari 2.13 #30801

Closed
slel opened this issue Oct 20, 2020 · 249 comments
Closed

Upgrade: pari 2.13 #30801

slel opened this issue Oct 20, 2020 · 249 comments

Comments

@slel
Copy link
Member

slel commented Oct 20, 2020

This is to upgrade to PARI 2.13.x. https://repology.org/project/pari/versions

This new PARI release brings a lot of bug fixes,
new functionality, and speedups.

Changes in the PARI library that needs adaptation in SageMath code

 34- bnfissunit is obsolete, use bnfisunit
 35- bnfsunit is mostly obsolete, use bnfunits
 36- bnfisunit and bnfissunit: torsion unit exponent is now a t_INT (used
     to be a t_INTMOD)
 1- Removed member functions .futu and .tufu [deprecated since 2.2], used in simon two descent scripts.
 56- zetamultall: add flag

Last upgrade:

Follow-up ticket: #31754

Upstream: Fixed upstream, but not in a stable release.

CC: @dimpase @orlitzky @mkoeppe @slel @antonio-rojas @kiwifb @videlec @tobihan @collares @isuruf @dkwo @xcaruso @loefflerd @kliem

Component: packages: standard

Keywords: upgrade, pari

Author: Vincent Delecroix, Antonio Rojas, Gonzalo Tornaría

Branch: c78b147

Reviewer: Dima Pasechnik, David Loeffler

Issue created by migration from https://trac.sagemath.org/ticket/30801

@slel slel added this to the sage-9.3 milestone Oct 20, 2020
@antonio-rojas
Copy link
Contributor

comment:2

This needs first a new cypari release including sagemath/cypari2@1a4be24, otherwise it crashes immediately. After that, things don't look good:

sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/quadratic_forms/genera/genus.py  # 2 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/libs/pari/tests.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/libs/pari/__init__.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/structure/factorization.py  # 4 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/lfunctions/pari.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/matrix/matrix2.pyx  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/coding/linear_code.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/arith/misc.py  # 2 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/groups/fqf_orthogonal.py  # 2 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/groups/abelian_gps/abelian_group.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/groups/additive_abelian/additive_abelian_group.py  # 10 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/modules/torsion_quadratic_module.py  # 3 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/modules/fg_pid/fgp_module.py  # 30 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/modules/fg_pid/fgp_morphism.py  # 5 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/modules/fg_pid/fgp_element.py  # 8 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/tests/parigp.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/tests/books/judson-abstract-algebra/galois-sage.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/tests/books/computational-mathematics-with-sagemath/linalg_doctest.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/integer.pyx  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/complex_number.pyx  # 2 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/qqbar.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/polynomial/polynomial_element.pyx  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/polynomial/multi_polynomial_element.py  # 3 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/polynomial/multi_polynomial_ideal.py  # 2 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/polynomial/plural.pyx  # 3 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/polynomial/polynomial_quotient_ring.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/function_field/function_field.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/finite_rings/residue_field.pyx  # 7 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/finite_rings/finite_field_constructor.py  # 2 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/finite_rings/integer_mod_ring.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/number_field/maps.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/number_field/number_field_rel.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/number_field/unit_group.py  # 17 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/number_field/S_unit_solver.py  # 8 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/number_field/number_field_element.pyx  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/number_field/number_field_ideal_rel.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/number_field/splitting_field.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/number_field/order.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/number_field/number_field_ideal.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/number_field/number_field.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/rings/number_field/class_group.py  # 2 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/gal_reps.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/ell_generic.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/ell_finite_field.py  # 3 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/height.py  # 6 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/ell_number_field.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/ell_torsion.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/period_lattice.py  # 3 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/gp_simon.py  # 4 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/ell_rational_field.py  # 2 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/kraus.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/ell_curve_isogeny.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/heegner.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/gal_reps_number_field.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/elliptic_curves/isogeny_small_degree.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/toric/homset.py  # 3 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/toric/points.py  # 9 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/toric/chow_group.py  # 4 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/schemes/plane_conics/con_rational_function_field.py  # Timed out
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/geometry/cone.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/modular/multiple_zeta.py  # 403 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/modular/local_comp/smoothchar.py  # 2 doctests failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/modular/local_comp/liftings.py  # 1 doctest failed
sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/modular/modsym/p1list_nf.py  # 1 doctest failed

@antonio-rojas
Copy link
Contributor

comment:3

The timeouts are hangs when calling nffactor. A minimal test case:

sage: K=NumberField(x^12 + 5, 't')
sage: P.<x>=K[]
sage: f=x^2 - 1
sage: f.factor()

I've bisected it to upstream commit [1], but running the same code directly in gp works fine.

[1] https://pari.math.u-bordeaux.fr/cgi-bin/gitweb.cgi?p=pari.git;a=commitdiff;h=473226c477c674838de87f4aaa67939eaa2fb034

@antonio-rojas
Copy link
Contributor

comment:5

So, the actual issue seems to be:

sage: pari("default")
...
  primelimit = 0

If I set primelimit to 0 in gp I can reproduce the hangs. Reported to cypari sagemath/cypari2#96

@thierry-FreeBSD
Copy link

comment:6

Another issue is the return of:

$ echo "bnf = bnfinit(y^4-y-1); bnfisunit(bnf,-y^3+2*y^2-1)" | gp -qf

returns:

[0, 2, 0]~

but configure expects [[0, 2, Mod(0, 2)]]~
(from build/pkgs/pari/spkg-configure.m4)

@dimpase
Copy link
Member

dimpase commented Oct 28, 2020

comment:7

ok, they changed the output format.
This is certainly easy to take care of.

@videlec

This comment has been minimized.

@videlec

This comment has been minimized.

@videlec
Copy link
Contributor

videlec commented Nov 1, 2020

Author: Vincent Delecroix

@videlec
Copy link
Contributor

videlec commented Nov 1, 2020

Commit: 390d870

@videlec
Copy link
Contributor

videlec commented Nov 1, 2020

New commits:

3df29d3upgrade to pari 2.13.0
e16c581upgrade cypari2 to 2.1.2b1
68214e4adapt libs/pari to 2.13.0
ec9fbb5doctests in libs/pari
3af9483fix some doctests and discard .pari_nf() in number_field.py
ace4395doctests in unit_group.py
5358fc2poldegree is now a GEN
390d870fix cygwin patch

@videlec
Copy link
Contributor

videlec commented Nov 1, 2020

@videlec

This comment has been minimized.

@antonio-rojas
Copy link
Contributor

comment:13

Many test failures are caused by pari having changed the normal Smith form algorithm, which now gives different transition matrices. Most of them are still correct, but it also has some unfortunate side effects:

sage: V=ZZ^2
sage: W=span([[1,0],[0,6]],ZZ)
sage: M=V/W
sage: a=M[1]; a
(1)
sage: a.lift()
(0, -1)

@antonio-rojas

This comment has been minimized.

@videlec
Copy link
Contributor

videlec commented Nov 1, 2020

comment:15

On Tuesday (November 3) from 14h to 17h (UTC+2) there is a virtual PARI/GP workshop. I intend to discuss with Bill the cypari2 release and the adaptation in SageMath. Anybody interested is more than welcome. Just send me a private e-mail so that I can forward the announcement.

@antonio-rojas
Copy link
Contributor

comment:16

The update to cypari 2.1.2b causes some additional issues (not present in 2.1.1, both tested with pari 2.13)

File "/usr/lib/python3.8/site-packages/sage/rings/rational.pyx", line 1450, in sage.rings.rational.Rational.is_norm
Failed example:
    7.is_norm(K)
Expected:
    Traceback (most recent call last):
    ...
    NotImplementedError: is_norm is not implemented unconditionally for norms from non-Galois number fields
Got:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/usr/lib/python3.8/site-packages/sage/doctest/forker.py", line 720, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib/python3.8/site-packages/sage/doctest/forker.py", line 1145, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.rings.rational.Rational.is_norm[13]>", line 1, in <module>
        Integer(7).is_norm(K)
      File "sage/rings/integer.pyx", line 5443, in sage.rings.integer.Integer.is_norm (build/cythonized/sage/rings/integer.c:34562)
        return QQ(self).is_norm(K, element=element, proof=proof)
      File "sage/rings/rational.pyx", line 1464, in sage.rings.rational.Rational.is_norm (build/cythonized/sage/rings/rational.c:13741)
        return self.is_norm(L, element=True, proof=proof)[0]
      File "sage/rings/rational.pyx", line 1484, in sage.rings.rational.Rational.is_norm (build/cythonized/sage/rings/rational.c:14464)
        M = L.galois_closure('a')
      File "/usr/lib/python3.8/site-packages/sage/rings/number_field/number_field.py", line 8606, in galois_closure
        L, self_into_L = self._galois_closure_and_embedding(names)
      File "/usr/lib/python3.8/site-packages/sage/rings/number_field/number_field.py", line 8541, in _galois_closure_and_embedding
        L, self_into_L = self.defining_polynomial().change_ring(self).splitting_field(names, map=True, degree_multiple=deg)
      File "sage/rings/polynomial/polynomial_element.pyx", line 4635, in sage.rings.polynomial.polynomial_element.Polynomial.splitting_field (build/cythonized/sage/rings/polynomial/polynomial_element.c:39244)
        return splitting_field(f, name, map, **kwds)
      File "/usr/lib/python3.8/site-packages/sage/rings/number_field/splitting_field.py", line 454, in splitting_field
        rel_degree_divisor = rel_degree_divisor.lcm(q.poldegree())
      File "sage/structure/element.pyx", line 3917, in sage.structure.element.PrincipalIdealDomainElement.lcm (build/cythonized/sage/structure/element.c:24871)
        return coercion_model.bin_op(self, right, lcm)
      File "sage/structure/coerce.pyx", line 1248, in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:11304)
        raise bin_op_exception(op, x, y)
    TypeError: unsupported operand parent(s) for lcm: 'Integer Ring' and '<class 'cypari2.gen.Gen'>'

@videlec
Copy link
Contributor

videlec commented Nov 2, 2020

comment:17

This is the problematic line

      File "/usr/lib/python3.8/site-packages/sage/rings/number_field/splitting_field.py", line 454, in splitting_field
        rel_degree_divisor = rel_degree_divisor.lcm(q.poldegree())

poldgree used to return an Python integer. But now that it is auto-generated in cypari it returns a Gen which is not accepted by lcm

sage: 4.lcm(pari(5))
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for lcm: 'Integer Ring' and '<class 'cypari2.gen.Gen'>'

Some of these poldegree are "corrected" in commit 5358fc2.

I see several solutions

  • manually add a q.poldegree().sage() to all the problematic calls
  • make sage gcd/lcm accepts pari integers
  • undo the change in cypari2 that makes poldgree returns a Gen
  • in cypari2, return a Pyton integer instead of a Pari integer when natural (ie something that can be used as an index: poldegree, length of vectors, ...)

@videlec
Copy link
Contributor

videlec commented Nov 2, 2020

comment:18

To my mind, fixing Sage gcd/lcm makes more sense.

@videlec
Copy link
Contributor

videlec commented Nov 2, 2020

comment:19

Related: the functions gcd/lcm are not commutative

sage: type(lcm(2, pari(3)))
<class 'sage.rings.integer.Integer'>
sage: type(lcm(pari(3), 2))
<class 'cypari2.gen.Gen'>

@videlec
Copy link
Contributor

videlec commented Nov 2, 2020

comment:20

See #30849

@videlec
Copy link
Contributor

videlec commented Nov 2, 2020

Dependencies: #30849

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 2, 2020

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

75c1516make gcd/lcm of Integer works with gmpy2/pari types
8c675b4upgrade to pari 2.13.0
2833d06upgrade cypari2 to 2.1.2b1
886e9d2adapt libs/pari to 2.13.0
d93c350doctests in libs/pari
b7fed64fix some doctests and discard .pari_nf() in number_field.py
b4afd2adoctests in unit_group.py
7679cfafix cygwin patch

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 2, 2020

Changed commit from 390d870 to 7679cfa

@videlec
Copy link
Contributor

videlec commented Nov 2, 2020

comment:22

(Rebased on top of #30849 dropping modification to gcd/lcm when poldegree is involved)

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 2, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

e04727dfix argument order in rnfisnorm call

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 2, 2020

Changed commit from 7679cfa to e04727d

@octonion
Copy link

octonion commented Jun 9, 2021

comment:188

Confirming this branch eliminates the error I was seeing in PARI/GP's qfminim(), due to a bug in PARI/GP that's since been corrected in that libraries source code. My elliptic curve code is now running properly again.


New commits:

c78b147fix pari 2.13-related issue of different Smith form

@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Jun 10, 2021

comment:189

This had a positive review before the issues with local components came up, and I'm confident those are fixed, so I think we can reinstate the positive review.

@dimpase
Copy link
Member

dimpase commented Jun 10, 2021

Changed reviewer from Dima Pasechnik to Dima Pasechnik, David Loeffler

@vbraun
Copy link
Member

vbraun commented Jun 20, 2021

Changed branch from public/30801 to c78b147

@fchapoton
Copy link
Contributor

Changed commit from c78b147 to none

@fchapoton
Copy link
Contributor

comment:192

With 9.4.b3 and pari 2.13, my patchbot petitbonum has now two errors in src/sage/modules/fg_pid/fgp_module.py

https://patchbot.sagemath.org/ticket/0/

@dimpase
Copy link
Member

dimpase commented Jun 23, 2021

comment:193

Replying to @fchapoton:

With 9.4.b3 and pari 2.13, my patchbot petitbonum has now two errors in src/sage/modules/fg_pid/fgp_module.py

https://patchbot.sagemath.org/ticket/0/

is it the same as in comment:178 ?
I tried reproducing this, but failed.

@fchapoton
Copy link
Contributor

@dimpase
Copy link
Member

dimpase commented Jun 23, 2021

comment:195

Right, I see, it actually depends upon the random seed.
E.g. on Fedora 32 with gcc 10.3 and non-0 seed I get

$ ./sage -t --long --random-seed=423333338768755345354 src/sage/modules/fg_pid/fgp_module.py
Running doctests with ID 2021-06-23-14-11-38-7a14ecbb.
Git branch: HEAD
Using --optional=build,dochtml,fedora,gap_packages,libsemigroups,pip,sage,sage_spkg
Doctesting 1 file.
sage -t --long --warn-long 53.3 --random-seed=423333338768755345354 src/sage/modules/fg_pid/fgp_module.py
**********************************************************************
File "src/sage/modules/fg_pid/fgp_module.py", line 1274, in sage.modules.fg_pid.fgp_module.FGP_Module_class.coordinate_vector
Failed example:
    Q.coordinate_vector(Q.0 - Q.1)
Expected:
    (1, -1)
Got:
    (1, 47)
**********************************************************************
File "src/sage/modules/fg_pid/fgp_module.py", line 1294, in sage.modules.fg_pid.fgp_module.FGP_Module_class.coordinate_vector
Failed example:
    Q.coordinate_vector(x)
Expected:
    (0, -1)
Got:
    (0, 11)
**********************************************************************
File "src/sage/modules/fg_pid/fgp_module.py", line 1701, in sage.modules.fg_pid.fgp_module.FGP_Module_class.random_element
Failed example:
    Q.random_element()
Expected:
    (1, 5)
Got:
    (3, 8)
**********************************************************************
File "src/sage/modules/fg_pid/fgp_module.py", line 1923, in sage.modules.fg_pid.fgp_module.random_fgp_module
Failed example:
    fgp.random_fgp_module(4)
Expected:
    Finitely generated module V/W over Integer Ring with invariants (4)
Got:
    Finitely generated module V/W over Integer Ring with invariants (0)
**********************************************************************
File "src/sage/modules/fg_pid/fgp_module.py", line 1951, in sage.modules.fg_pid.fgp_module.random_fgp_morphism_0
Failed example:
    fgp.random_fgp_morphism_0(4)
Expected:
    Morphism from module over Integer Ring with invariants (4,) to module with invariants (4,) that sends the generators to [(0)]
Got:
    Morphism from module over Integer Ring with invariants (0,) to module with invariants (0,) that sends the generators to [(1)]
**********************************************************************
4 items had failures:
   2 of  23 in sage.modules.fg_pid.fgp_module.FGP_Module_class.coordinate_vector
   1 of   4 in sage.modules.fg_pid.fgp_module.FGP_Module_class.random_element
   1 of   3 in sage.modules.fg_pid.fgp_module.random_fgp_module
   1 of   3 in sage.modules.fg_pid.fgp_module.random_fgp_morphism_0
    [397 tests, 5 failures, 1.93 s]
----------------------------------------------------------------------
sage -t --long --warn-long 53.3 --random-seed=423333338768755345354 src/sage/modules/fg_pid/fgp_module.py  # 5 doctests failed
----------------------------------------------------------------------
Total time for all tests: 2.0 seconds

on the same machine, but with Sage built using clang 10, with 0 random seed these tests pass.
With random seed as above I get

$ ./sage -t --long --random-seed=423333338768755345354 src/sage/modules/fg_pid/fgp_module.py
Running doctests with ID 2021-06-23-14-10-28-0b9d083c.
Git branch: HEAD
Using --optional=build,dochtml,fedora,gap_packages,libsemigroups,pip,sage,sage_spkg
Doctesting 1 file.
sage -t --long --warn-long 53.3 --random-seed=423333338768755345354 src/sage/modules/fg_pid/fgp_module.py
**********************************************************************
File "src/sage/modules/fg_pid/fgp_module.py", line 1701, in sage.modules.fg_pid.fgp_module.FGP_Module_class.random_element
Failed example:
    Q.random_element()
Expected:
    (1, 5)
Got:
    (3, 8)
**********************************************************************
File "src/sage/modules/fg_pid/fgp_module.py", line 1923, in sage.modules.fg_pid.fgp_module.random_fgp_module
Failed example:
    fgp.random_fgp_module(4)
Expected:
    Finitely generated module V/W over Integer Ring with invariants (4)
Got:
    Finitely generated module V/W over Integer Ring with invariants (0)
**********************************************************************
File "src/sage/modules/fg_pid/fgp_module.py", line 1951, in sage.modules.fg_pid.fgp_module.random_fgp_morphism_0
Failed example:
    fgp.random_fgp_morphism_0(4)
Expected:
    Morphism from module over Integer Ring with invariants (4,) to module with invariants (4,) that sends the generators to [(0)]
Got:
    Morphism from module over Integer Ring with invariants (0,) to module with invariants (0,) that sends the generators to [(1)]
**********************************************************************
3 items had failures:
   1 of   4 in sage.modules.fg_pid.fgp_module.FGP_Module_class.random_element
   1 of   3 in sage.modules.fg_pid.fgp_module.random_fgp_module
   1 of   3 in sage.modules.fg_pid.fgp_module.random_fgp_morphism_0
    [397 tests, 3 failures, 2.21 s]
----------------------------------------------------------------------
sage -t --long --warn-long 53.3 --random-seed=423333338768755345354 src/sage/modules/fg_pid/fgp_module.py  # 3 doctests failed
----------------------------------------------------------------------
Total time for all tests: 2.3 seconds

I suppose this should become part of #29935

@kliem
Copy link
Contributor

kliem commented Jun 23, 2021

comment:196

I believe this will be fixed with #29978.

@fchapoton
Copy link
Contributor

comment:197

No, #29978 does not fix the problem.

@kliem
Copy link
Contributor

kliem commented Jun 23, 2021

comment:198

I see. I got confused.

So there is actually 2 failing doctests in lines 1274 and lines 1294 that should be fixed.

@dimpase
Copy link
Member

dimpase commented Jun 23, 2021

comment:199

Replying to @kliem:

I see. I got confused.

So there is actually 2 failing doctests in lines 1274 and lines 1294 that should be fixed.

#29978 fixes the clang setup from comment:195 fully, but the gcc (gcc version 10.3.1 20210422 (Red Hat 10.3.1-1))
setup still exhibits 2 failures (irrespectively of the random seed).

Maybe it's a gcc 10 bug? Or we have randomness in various Sage packages not fully under control, otherwise this discrepancy looks strange.

@kliem
Copy link
Contributor

kliem commented Jun 23, 2021

comment:200

I think the fix is quite trivial. Apparently with reduce=False things really are random. There is already one test in line 1`288 that is marked as random because of this. So yes, this could be done in a follow up of #29978.

@kliem
Copy link
Contributor

kliem commented Jun 24, 2021

comment:201

See #32048 for a possible fix.

@kliem
Copy link
Contributor

kliem commented Jul 1, 2021

comment:202

The problem above and another error not reported before, are responsible for "my" patchbot panke to be dead for now, I just found out.

sage -t --long --random-seed=0 src/sage/modular/local_comp/local_comp.py                                                                                                                                                                                                       
**********************************************************************                                                                                                                                                                                                         
File "src/sage/modular/local_comp/local_comp.py", line 653, in sage.modular.local_comp.local_comp.PrimitiveSupercuspidal.characters                                                                                                                                            
Failed example:                                                                                                                                                                                                                                                                
    set(Pi.characters())                                                                                                                                                                                                                                                       
Expected:                                                                                                                                                                                                                                                                      
    {Character of unramified extension Q_5(s)* (s^2 + 4*s + 2 = 0), of level 1, mapping s |--> 1/3*j0^2*d - 1/3*j0^3, 5 |--> 5,                                                                                                                                                
     Character of unramified extension Q_5(s)* (s^2 + 4*s + 2 = 0), of level 1, mapping s |--> -1/3*j0^2*d, 5 |--> 5}                                                                                                                                                          
Got:                                                                                                                                                                                                                                                                           
    {Character of unramified extension Q_5(s)* (s^2 + 4*s + 2 = 0), of level 1, mapping s |--> -1/3*j0^2*d, 5 |--> 5,                                                                                                                                                          
     Character of unramified extension Q_5(s)* (s^2 + 4*s + 2 = 0), of level 1, mapping s |--> 1/3*j0^2*d - 1/3*j0^3, 5 |--> 5}  

I don't know why you introduced set in a doctest. It's not stable.

In #29977 I try to fix it by just outputing Pi.characters(). I don't know if that is stable either.

@dimpase
Copy link
Member

dimpase commented Jul 1, 2021

comment:203

the Python's insane treatment of sets makes me mentally unstable, this is for sure.
Is there any fcking way in this crp of a language to output anything at all in a unique order?

@dimpase
Copy link
Member

dimpase commented Jul 1, 2021

comment:204

sorry for screaming...

@slel
Copy link
Member Author

slel commented Jul 1, 2021

comment:205

Perhaps sorted could sort this out?

sage: chars = sorted(Pi.characters())
sage: chars

How about using sorted for all occurrences
of Pi.characters() in that file?

@kliem
Copy link
Contributor

kliem commented Jul 2, 2021

comment:206

Doctests try to sort dictionaries and sets uniquely. However it fails here.

This is really strange.

It apparently depends on the compiler(?):

sage: from IPython.lib.pretty import pprint 
sage: f = Newforms(GammaH(25, [6]), 3, names='j')[0]
sage: Pi = LocalComponent(f, 5)                                                                                                       
sage: pprint(set(Pi.characters()))                                                                                                    
{Character of unramified extension Q_5(s)* (s^2 + 4*s + 2 = 0), of level 1, mapping s |--> -1/3*j0^2*d, 5 |--> 5,
 Character of unramified extension Q_5(s)* (s^2 + 4*s + 2 = 0), of level 1, mapping s |--> 1/3*j0^2*d - 1/3*j0^3, 5 |--> 5}

on Debian buster with pari 2.13.1 installed and gcc 8.3.

sage: from IPython.lib.pretty import pprint 
sage: f = Newforms(GammaH(25, [6]), 3, names='j')[0]
sage: Pi = LocalComponent(f, 5)                                                                                                       
sage: pprint(set(Pi.characters()))  
{Character of unramified extension Q_5(s)* (s^2 + 4*s + 2 = 0), of level 1, mapping s |--> 1/3*j0^2*d - 1/3*j0^3, 5 |--> 5,
 Character of unramified extension Q_5(s)* (s^2 + 4*s + 2 = 0), of level 1, mapping s |--> -1/3*j0^2*d, 5 |--> 5}

on Ubuntu focal with pari 2.13.1 installed and gcc 9.3.0.

The problems is that the output is not sortable:

sage: f = Newforms(GammaH(25, [6]), 3, names='j')[0]
sage: Pi = LocalComponent(f, 5)        
sage: a = list(Pi.characters())
sage: b = [a[1], a[0]]
sage: sorted(a) == sorted(b)
False
sage: a                                                                                                                             
[Character of unramified extension Q_5(s)* (s^2 + 4*s + 2 = 0), of level 1, mapping s |--> 1/3*j0^2*d - 1/3*j0^3, 5 |--> 5,
 Character of unramified extension Q_5(s)* (s^2 + 4*s + 2 = 0), of level 1, mapping s |--> -1/3*j0^2*d, 5 |--> 5]
sage: b                                                                                                                               
[Character of unramified extension Q_5(s)* (s^2 + 4*s + 2 = 0), of level 1, mapping s |--> -1/3*j0^2*d, 5 |--> 5,
 Character of unramified extension Q_5(s)* (s^2 + 4*s + 2 = 0), of level 1, mapping s |--> 1/3*j0^2*d - 1/3*j0^3, 5 |--> 5]

Hence ipythons pretty printer fails https://github.com/ipython/ipython/blob/master/IPython/lib/pretty.py.

@slel
Copy link
Member Author

slel commented Jul 2, 2021

comment:207

Let's move the discussion to #29977.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests