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 to pari 2.11.4 #29313

Closed
timokau opened this issue Mar 11, 2020 · 44 comments
Closed

Upgrade to pari 2.11.4 #29313

timokau opened this issue Mar 11, 2020 · 44 comments

Comments

@timokau
Copy link
Contributor

timokau commented Mar 11, 2020

Unfortunately the update is not trivial. Here are some doctest failures:

File "/nix/store/vqiiwb9rzmzh97gzx1wmvqyiy9d5qhxj-sage-src-8.9/src/sage/rings/number_field/number_field.py", line 3253, in sage.rings.number_field.number_field.NumberField_generic.ideals_of_bdd_norm
Failed example:
    for n in d:
        print(n)
        for I in d[n]:
            print(I)
Expected:
    1
    Fractional ideal (1)
    2
    Fractional ideal (2, 1/2*a - 1/2)
    Fractional ideal (2, 1/2*a + 1/2)
    3
    Fractional ideal (3, 1/2*a - 1/2)
    Fractional ideal (3, 1/2*a + 1/2)
    4
    Fractional ideal (4, 1/2*a + 3/2)
    Fractional ideal (2)
    Fractional ideal (4, 1/2*a + 5/2)
    5
    6
    Fractional ideal (1/2*a - 1/2)
    Fractional ideal (6, 1/2*a + 5/2)
    Fractional ideal (6, 1/2*a + 7/2)
    Fractional ideal (1/2*a + 1/2)
    7
    8
    Fractional ideal (1/2*a + 3/2)
    Fractional ideal (4, a - 1)
    Fractional ideal (4, a + 1)
    Fractional ideal (1/2*a - 3/2)
    9
    Fractional ideal (9, 1/2*a + 11/2)
    Fractional ideal (3)
    Fractional ideal (9, 1/2*a + 7/2)
    10
Got:
    1
    Fractional ideal (1)
    2
    Fractional ideal (2, 1/2*a - 1/2)
    Fractional ideal (2, 1/2*a + 1/2)
    3
    Fractional ideal (3, 1/2*a + 1/2)
    Fractional ideal (3, 1/2*a - 1/2)
    4
    Fractional ideal (4, 1/2*a + 3/2)
    Fractional ideal (2)
    Fractional ideal (4, 1/2*a + 5/2)
    5
    6
    Fractional ideal (6, 1/2*a + 7/2)
    Fractional ideal (1/2*a + 1/2)
    Fractional ideal (1/2*a - 1/2)
    Fractional ideal (6, 1/2*a + 5/2)
    7
    8
    Fractional ideal (1/2*a + 3/2)
    Fractional ideal (4, a - 1)
    Fractional ideal (4, a + 1)
    Fractional ideal (1/2*a - 3/2)
    9
    Fractional ideal (9, 1/2*a + 7/2)
    Fractional ideal (3)
    Fractional ideal (9, 1/2*a + 11/2)
    10
**********************************************************************
File "/nix/store/vqiiwb9rzmzh97gzx1wmvqyiy9d5qhxj-sage-src-8.9/src/sage/rings/number_field/number_field.py", line 4369, in sage.rings.number_field.number_field.NumberField_generic._S_class_group_and_units
Failed example:
    K._S_class_group_and_units(tuple(K.primes_above(13)))
Expected:
    ([2/13*a^2 + 1/13*a - 677/13,
      1/13*a^2 + 7/13*a - 332/13,
      -1/13*a^2 + 6/13*a + 345/13,
      -1,
      2/13*a^2 + 1/13*a - 755/13,
      1/13*a^2 - 19/13*a - 7/13],
     [(Fractional ideal (11, a - 2), 2), (Fractional ideal (19, a + 7), 2)])
Got:
    ([2/13*a^2 + 1/13*a - 677/13,
      1/13*a^2 + 7/13*a - 332/13,
      -1/13*a^2 + 6/13*a + 345/13,
      -1,
      2/13*a^2 + 1/13*a - 755/13,
      1/13*a^2 + 20/13*a - 7/13],
     [(Fractional ideal (11, a - 2), 2), (Fractional ideal (19, a + 7), 2)])
**********************************************************************
File "/nix/store/vqiiwb9rzmzh97gzx1wmvqyiy9d5qhxj-sage-src-8.9/src/sage/rings/number_field/number_field.py", line 4527, in sage.rings.number_field.number_field.NumberField_generic.selmer_group
Failed example:
    K.selmer_group(K.primes_above(13), 2)
Expected:
    [2/13*a^2 + 1/13*a - 677/13,
     1/13*a^2 + 7/13*a - 332/13,
     -1/13*a^2 + 6/13*a + 345/13,
     -1,
     2/13*a^2 + 1/13*a - 755/13,
     1/13*a^2 - 19/13*a - 7/13,
     -1/13*a^2 + 45/13*a - 97/13,
     2/13*a^2 + 40/13*a - 27/13]
Got:
    [2/13*a^2 + 1/13*a - 677/13,
     1/13*a^2 + 7/13*a - 332/13,
     -1/13*a^2 + 6/13*a + 345/13,
     -1,
     2/13*a^2 + 1/13*a - 755/13,
     1/13*a^2 + 20/13*a - 7/13,
     1/13*a^2 - 45/13*a + 97/13,
     -2/13*a^2 - 40/13*a + 27/13]
**********************************************************************
File "/nix/store/vqiiwb9rzmzh97gzx1wmvqyiy9d5qhxj-sage-src-8.9/src/sage/rings/number_field/number_field.py", line 5179, in sage.rings.number_field.number_field.NumberField_generic.elements_of_norm
Failed example:
    K.elements_of_norm(7)
Expected:
    [7/225*a^2 - 7/75*a - 42/25]
Got:
    [28/225*a^2 + 77/75*a - 133/25]
**********************************************************************
File "/nix/store/vqiiwb9rzmzh97gzx1wmvqyiy9d5qhxj-sage-src-8.9/src/sage/rings/number_field/number_field.py", line 5282, in sage.rings.number_field.number_field.NumberField_generic.factor
Failed example:
    f = L.factor(a + 1); f
Expected:
    (Fractional ideal (1/2*a*b - a + 1/2)) * (Fractional ideal (-1/2*a*b - a + 1/2))
Got:
    (Fractional ideal (-1/2*b + 1/2*a + 1)) * (Fractional ideal (-1/2*a*b - a + 1/2))
**********************************************************************
File "/nix/store/vqiiwb9rzmzh97gzx1wmvqyiy9d5qhxj-sage-src-8.9/src/sage/rings/number_field/number_field.py", line 6359, in sage.rings.number_field.number_field.NumberField_generic.uniformizer
Failed example:
    [K.uniformizer(P) for P,e in factor(K.ideal(7))]
Expected:
    [t^2 + 3*t + 1]
Got:
    [t^2 - 4*t + 1]
**********************************************************************
File "/nix/store/vqiiwb9rzmzh97gzx1wmvqyiy9d5qhxj-sage-src-8.9/src/sage/rings/number_field/number_field.py", line 6615, in sage.rings.number_field.number_field.NumberField_generic.S_unit_group
Failed example:
    U.log(u)
Expected:
    (1, 1, 4, 1, 5)
Got:
    (0, 1, 4, 1, 5)
**********************************************************************
File "/nix/store/vqiiwb9rzmzh97gzx1wmvqyiy9d5qhxj-sage-src-8.9/src/sage/rings/number_field/number_field.py", line 7599, in sage.rings.number_field.number_field.NumberField_absolute.optimized_representation
Failed example:
    K.optimized_representation()
Expected:
    (Number Field in a1 with defining polynomial x^3 - 7*x - 7,
     Ring morphism:
       From: Number Field in a1 with defining polynomial x^3 - 7*x - 7
       To:   Number Field in a with defining polynomial 7/9*x^3 + 7/3*x^2 - 56*x + 123
       Defn: a1 |--> 7/225*a^2 - 7/75*a - 42/25,
     Ring morphism:
       From: Number Field in a with defining polynomial 7/9*x^3 + 7/3*x^2 - 56*x + 123
       To:   Number Field in a1 with defining polynomial x^3 - 7*x - 7
       Defn: a |--> -15/7*a1^2 + 9)
Got:
    (Number Field in a1 with defining polynomial x^3 - 7*x - 7, Ring morphism:
       From: Number Field in a1 with defining polynomial x^3 - 7*x - 7
       To:   Number Field in a with defining polynomial 7/9*x^3 + 7/3*x^2 - 56*x + 123
       Defn: a1 |--> 28/225*a^2 + 77/75*a - 133/25, Ring morphism:
       From: Number Field in a with defining polynomial 7/9*x^3 + 7/3*x^2 - 56*x + 123
       To:   Number Field in a1 with defining polynomial x^3 - 7*x - 7
       Defn: a |--> -60/7*a1^2 + 15*a1 + 39)
**********************************************************************
8 items had failures:
   1 of  10 in sage.rings.number_field.number_field.NumberField_absolute.optimized_representation
   1 of  27 in sage.rings.number_field.number_field.NumberField_generic.S_unit_group
   1 of   9 in sage.rings.number_field.number_field.NumberField_generic._S_class_group_and_units
   1 of   6 in sage.rings.number_field.number_field.NumberField_generic.elements_of_norm
   1 of  15 in sage.rings.number_field.number_field.NumberField_generic.factor
   1 of   4 in sage.rings.number_field.number_field.NumberField_generic.ideals_of_bdd_norm
   1 of  32 in sage.rings.number_field.number_field.NumberField_generic.selmer_group
   1 of  20 in sage.rings.number_field.number_field.NumberField_generic.uniformizer
    [2076 tests, 8 failures, 52.52 s]
----------------------------------------------------------------------
sage -t --long /nix/store/vqiiwb9rzmzh97gzx1wmvqyiy9d5qhxj-sage-src-8.9/src/sage/rings/number_field/number_field.py  # 8 doctests failed

I will not do the update myself in this ticket, I only opened it to notify people of the issues.

Tarfile: see checksums_ini [upstream_url]

Depends on #29472

CC: @antonio-rojas @kiwifb @saraedum @tobihan @fchapoton @embray @jdemeyer @dimpase

Component: packages: standard

Author: Antonio Rojas

Branch/Commit: 549e094

Reviewer: Dima Pasechnik, François Bissey

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

@timokau timokau added this to the sage-9.1 milestone Mar 11, 2020
@antonio-rojas
Copy link
Contributor

comment:1

Already updated on Arch. Some of the failures are actual incorrect results which are due to a pari bug fixed in [1]. The remaining ones are due to changes in chosen ideal generators, and in computation precision. Those just need the doctests to be updated.

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

Will post a branch when I have some free time unless someone beats me to it.

@timokau
Copy link
Contributor Author

timokau commented Mar 11, 2020

comment:2

I just now noticed #28424 (missed it initially because I searched for pari 2.11.3 in particular). That ticket proposes an update to 2.12 though, which is still in beta and probably harder to do. So I think we can keep this open.

@timokau
Copy link
Contributor Author

timokau commented Mar 11, 2020

comment:3

Replying to @antonio-rojas:

Already updated on Arch. Some of the failures are actual incorrect results which are due to a pari bug fixed in [1]. The remaining ones are due to changes in chosen ideal generators, and in computation precision. Those just need the doctests to be updated.

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

Will post a branch when I have some free time unless someone beats me to it.

Thats great news, amazing how fast you always come up with those fixes :) For anyone else wondering, here is Antonio's patch.

@antonio-rojas
Copy link
Contributor

comment:4

Since Sage can now use system pari, perhaps 2.11.3 should be blacklisted until this is merged. Ideally, distros shipping 2.11.3 should backport the patch as it is quite a serious bug.

@timokau
Copy link
Contributor Author

timokau commented Mar 11, 2020

comment:5

Oh, I misread your original comment and I thought that you meant the tests were wrong before and 2.11.3 fixes the bug. I'll backport the pari fix for nix.

@dimpase
Copy link
Member

dimpase commented Mar 11, 2020

comment:6

Pari 2.11.3 has been released just few days ago, and that bug was fixed last year. Could it be that upstream forgot to include the fix?

What's an example of incorrect maths output without that patch?

@antonio-rojas
Copy link
Contributor

comment:7

Replying to @dimpase:

Pari 2.11.3 has been released just few days ago, and that bug was fixed last year. Could it be that upstream forgot to include the fix?

Yes, they forgot to backport the fix to stable. See [1]

What's an example of incorrect maths output without that patch?

You have some examples in [1] and [2]

[1] https://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=2208

[2] https://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=2164

This causes a few failures in Sage. Among other things, simon's scripts are totally broken.

@timokau
Copy link
Contributor Author

timokau commented Mar 11, 2020

comment:8

When patching pari with [1] and sage with [2] I still get at least one doctest failure (I only tested the number_fields.py file for now):

sage -t --long /nix/store/nsvlj78rfc0s8077drna9xw54xw2z50v-sage-src-8.9/src/sage/rings/number_field/number_field.py
**********************************************************************
File "/nix/store/nsvlj78rfc0s8077drna9xw54xw2z50v-sage-src-8.9/src/sage/rings/number_field/number_field.py", line 6615, in sage.rings.number_field.number_field.NumberField_generic.S_unit_group
Failed example:
    U.log(u)
Expected:
    (1, 1, 4, 1, 5)
Got:
    (0, 1, 4, 1, 5)
**********************************************************************
1 item had failures:
   1 of  27 in sage.rings.number_field.number_field.NumberField_generic.S_unit_group
    [2076 tests, 1 failure, 54.23 s]

Am I missing something?

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

[2] https://aur.archlinux.org/cgit/aur.git/plain/sagemath-pari-2.11.3.patch?h=sagemath-git&id=02e1d58bd1cd70935d69a4990469d18be6bd2c43

@kiwifb
Copy link
Member

kiwifb commented Mar 11, 2020

comment:9

Given that this seem to be a serious bug, can we expect upstream to release 2.11.4 shortly to fix it?

@antonio-rojas
Copy link
Contributor

comment:10

Replying to @timokau:

When patching pari with [1] and sage with [2] I still get at least one doctest failure (I only tested the number_fields.py file for now):

sage -t --long /nix/store/nsvlj78rfc0s8077drna9xw54xw2z50v-sage-src-8.9/src/sage/rings/number_field/number_field.py
**********************************************************************
File "/nix/store/nsvlj78rfc0s8077drna9xw54xw2z50v-sage-src-8.9/src/sage/rings/number_field/number_field.py", line 6615, in sage.rings.number_field.number_field.NumberField_generic.S_unit_group
Failed example:
    U.log(u)
Expected:
    (1, 1, 4, 1, 5)
Got:
    (0, 1, 4, 1, 5)
**********************************************************************
1 item had failures:
   1 of  27 in sage.rings.number_field.number_field.NumberField_generic.S_unit_group
    [2076 tests, 1 failure, 54.23 s]

Am I missing something?

That's one of the failures that should be fixed with pari's patch, are you sure you're running the patched version?

@timokau
Copy link
Contributor Author

timokau commented Mar 12, 2020

comment:11

No, I wasn't. I had a typo ("patch" instead of "patches") that resulted in the patch silently being ignored. Sorry for the noise.

As an aside, the upstream patch doesn't quite apply cleanly but the arch patch [1] is rebased. Thanks!

[1] https://git.archlinux.org/svntogit/community.git/plain/repos/community-x86_64/c7a1d35f.patch?h=packages/pari&id=27893d227290dc3821d68aa25877d9765c204dad

@antonio-rojas
Copy link
Contributor

Branch: u/arojas/upgrade_to_pari_2_11_3

@antonio-rojas
Copy link
Contributor

Commit: ce42f11

@antonio-rojas
Copy link
Contributor

comment:13

Needs testing for the check_functional_equation() output on 32 bits, i've only checked 64 bits. Also, some elliptic curves expert should check if the changes in elliptic_curves/ell_number_field.py are mathematically correct. All other ones seem OK to me.


New commits:

4ba1ea8Update pari to 2.11.3
d934a82Remove wrong patch
ce42f11Adjust doctests for new output with pari 2.11.3

@antonio-rojas
Copy link
Contributor

Author: Antonio Rojas

@kliem
Copy link
Contributor

kliem commented Apr 3, 2020

comment:14

The way I understand the configuration, once this ticket is through, it will reject a system pari unless it is at least version 2.11.3. Is this correct?

@antonio-rojas
Copy link
Contributor

comment:15

Replying to @kliem:

The way I understand the configuration, once this ticket is through, it will reject a system pari unless it is at least version 2.11.3. Is this correct?

No, the minimum pari system version is defined in spkg-configure and is independent of the version bundled in sage

@kliem
Copy link
Contributor

kliem commented Apr 3, 2020

comment:16

Ok, then I get why you want sage's test to be work with pari 2.11.3 and previous versions.

Do you want this to be done in this ticket or in a seperate ticket?

@antonio-rojas
Copy link
Contributor

comment:17

Replying to @kliem:

Ok, then I get why you want sage's test to be work with pari 2.11.3 and previous versions.

Do you want this to be done in this ticket or in a seperate ticket?

I don't really mind as long as I can get rid of my downstream patch. Feel free to take over this branch and modify the test results so they pass with both versions.

@kliem
Copy link
Contributor

kliem commented Apr 6, 2020

Dependencies: #29472

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 18, 2020

Changed commit from ce42f11 to 507576f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 18, 2020

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

507576fUpdate to 2.11.4

@antonio-rojas antonio-rojas changed the title Upgrade to pari 2.11.3 Upgrade to pari 2.11.4 Apr 18, 2020
@mkoeppe mkoeppe modified the milestones: sage-9.1, sage-9.2 May 4, 2020
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2020

Changed commit from 507576f to 4a23a12

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2020

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

4a23a12Merge branch 'develop' of git://git.sagemath.org/sage into t/29313/upgrade_to_pari_2_11_3

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2020

Changed commit from 4a23a12 to dfcdcb0

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2020

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

dfcdcb0Drop test fixes, handled in #29472

@dimpase
Copy link
Member

dimpase commented Jun 19, 2020

comment:25

please also apply

--- a/build/pkgs/pari/checksums.ini
+++ b/build/pkgs/pari/checksums.ini
@@ -2,3 +2,4 @@ tarball=pari-VERSION.tar.gz
 sha1=2b9ff51feb388664b834dc346a44867546c78618
 md5=fb2968d7805424518fe44a59a2024afd
 cksum=1247903778
+upstream_url=https://pari.math.u-bordeaux.fr/pub/pari/unix/pari-2.11.4.tar.gz

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2020

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

549e094Add upstream url

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2020

Changed commit from dfcdcb0 to 549e094

@dimpase

This comment has been minimized.

@dimpase
Copy link
Member

dimpase commented Jun 19, 2020

comment:28

some tests on macOS and Cygwin would be great. Perhaps adapting GH Actions to restrict platforms...

@mkoeppe
Copy link
Contributor

mkoeppe commented Jun 19, 2020

comment:29

Replying to @dimpase:

Perhaps adapting GH Actions to restrict platforms...

There's a ticket for that (#29535 - Customize CI workflows on GitHub Actions using specially structured tag names)

@dimpase
Copy link
Member

dimpase commented Jun 19, 2020

comment:30

for some reason I don't get macOS runs on GH Actions any more. Is it by design, or GH pulled them?

@mkoeppe
Copy link
Contributor

mkoeppe commented Jun 19, 2020

comment:31

Replying to @dimpase:

for some reason I don't get macOS runs on GH Actions any more. Is it by design, or GH pulled them?

No, works just fine for me -- for example here: https://github.com/mkoeppe/sage/actions/runs/141135018

@mkoeppe
Copy link
Contributor

mkoeppe commented Jun 19, 2020

comment:32

You probably need to cancel some of your old queued workflows such as this one: https://github.com/dimpase/sage/runs/784000040?check_suite_focus=true

@mkoeppe
Copy link
Contributor

mkoeppe commented Jul 19, 2020

comment:33

What's missing on this ticket?

@dimpase
Copy link
Member

dimpase commented Jul 19, 2020

comment:34

basically, someone should bite the bullet and make pari-related doctests less rigid (cf. e.g. the 1st example in the ticket description - it assumes an output order which is not really fixed),so that different versions of pari would still pass.

@antonio-rojas
Copy link
Contributor

comment:35

Replying to @dimpase:

basically, someone should bite the bullet and make pari-related doctests less rigid (cf. e.g. the 1st example in the ticket description - it assumes an output order which is not really fixed),so that different versions of pari would still pass.

That's done in #29472 already

@dimpase
Copy link
Member

dimpase commented Jul 19, 2020

comment:36

ah, ok, then in principle it should be good to go.

@kiwifb
Copy link
Member

kiwifb commented Jul 19, 2020

comment:37

Been using it for a little while in sage-on-gentoo and I don't need any patches for doctests anymore for some time now. So, I am putting this to positive.

@kiwifb
Copy link
Member

kiwifb commented Jul 19, 2020

Changed reviewer from Dima Pasechnik to Dima Pasechnik, François Bissey

@vbraun
Copy link
Member

vbraun commented Jul 28, 2020

Changed branch from u/arojas/upgrade_to_pari_2_11_3 to 549e094

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

7 participants