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.17.1, cypari 2.2.1, cysignals 1.12.3 #38749

Open
wants to merge 39 commits into
base: develop
Choose a base branch
from

Conversation

antonio-rojas
Copy link
Contributor

NEXT_PRIME_VIADIFF is removed in 2.17, port pari_prime_range to pari_PRIMES instead

Needs sagemath/cypari2#165 applied to cypari

@antonio-rojas
Copy link
Contributor Author

Needs work because this is not compatible with 2.15. So either it needs to be merged with the pari upgrade or be made to work with older pari too (no idea how).

Running tests now.

@antonio-rojas antonio-rojas changed the title Fix build with pari 2.17 [WIP] Fix build with pari 2.17 Oct 3, 2024
@antonio-rojas
Copy link
Contributor Author

Many test failures.

@antonio-rojas antonio-rojas changed the title [WIP] Fix build with pari 2.17 [WIP] Fix build and tests with pari 2.17 Oct 3, 2024
@jhpalmieri
Copy link
Member

If the changes here eventually allow us to use a system Pari 2.17, then we should undo the change in #38772.

@antonio-rojas antonio-rojas changed the title [WIP] Fix build and tests with pari 2.17 Fix build and tests with pari 2.17 Oct 6, 2024
@antonio-rojas
Copy link
Contributor Author

antonio-rojas commented Oct 6, 2024

With this MR and the cypari fixes sagemath/cypari2#165 and sagemath/cypari2#166 all tests are passing with pari 2.17.

The changes are not compatible with 2.15 though, making them compatible requires more work. Also, some pari opeations (such as the number field prime ideals above a given prime) give random output with 2.17, which makes it harder to test. To solve both issues (and make tests more future proof), we should gradually move away from testing the exact output to just testing that the output is correct.

@tobiasdiez
Copy link
Contributor

tobiasdiez commented Jan 28, 2025

I don't want to spoil the happiness, but it looks like on Python 3.12 there are a couple of failed tests (that I've never seen before failing): https://github.com/sagemath/sage/actions/runs/13007996602/job/36279129460?pr=38749#step:10:5594

It might be only one of these temporary issues, maybe an admin can restart the failing run to see if it persists.

@user202729
Copy link
Contributor

For reference:

File "src/sage/matroids/transversal_matroid.pyx", line 701, in sage.matroids.transversal_matroid.TransversalMatroid.transversal_extension
Failed example:
    M2 = M.transversal_extension(element='d', newset=True)
Exception raised:
    Traceback (most recent call last):
      File "/home/runner/miniconda3/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 728, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/runner/miniconda3/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 1152, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.matroids.transversal_matroid.TransversalMatroid.transversal_extension[3]>", line 1, in <module>
        M2 = M.transversal_extension(element='d', newset=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "transversal_matroid.pyx", line 671, in sage.matroids.transversal_matroid.TransversalMatroid.transversal_extension
      File "transversal_matroid.pyx", line 792, in sage.matroids.transversal_matroid.TransversalMatroid.transversal_extension
      File "transversal_matroid.pyx", line 181, in sage.matroids.transversal_matroid.TransversalMatroid.__init__
    ValueError: set labels cannot be element labels

Doesn't look temporary but that part of code seem to have nothing to do with pari either.

@collares
Copy link
Contributor

I don't want to spoil the happiness, but it looks like on Python 3.12 there are a couple of failed tests (that I've never seen before failing): https://github.com/sagemath/sage/actions/runs/13007996602/job/36279129460?pr=38749#step:10:5594

You haven't seen it before because the tests were introduced in 10.6.beta5 (#39155). But current master is also failing on the same tests: see, e.g., https://github.com/sagemath/sage/actions/runs/12979684201/job/36195720098

vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 29, 2025
    
`NEXT_PRIME_VIADIFF` is removed in 2.17, port `pari_prime_range` to
`pari_PRIMES` instead

Needs sagemath/cypari2#165 applied to cypari
    
URL: sagemath#38749
Reported by: Antonio Rojas
Reviewer(s): Antonio Rojas, Dima Pasechnik, Gonzalo Tornaría
@collares
Copy link
Contributor

Probably unrelated, but while testing this PR I hit a timeout in src/sage/groups/perm_gps/partn_ref/refinement_matrices.pyx (arguments --long --random-seed=148318620575155482011548963229209273971). Can anyone reproduce?

@collares
Copy link
Contributor

Probably unrelated, but while testing this PR I hit a timeout in src/sage/groups/perm_gps/partn_ref/refinement_matrices.pyx (arguments --long --random-seed=148318620575155482011548963229209273971). Can anyone reproduce?

I can also reproduce the test hang with PARI 2.15, so this PR is not the problem. Filed #39407.

vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 30, 2025
    
`NEXT_PRIME_VIADIFF` is removed in 2.17, port `pari_prime_range` to
`pari_PRIMES` instead

Needs sagemath/cypari2#165 applied to cypari
    
URL: sagemath#38749
Reported by: Antonio Rojas
Reviewer(s): Antonio Rojas, Dima Pasechnik, Gonzalo Tornaría
vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 31, 2025
    
`NEXT_PRIME_VIADIFF` is removed in 2.17, port `pari_prime_range` to
`pari_PRIMES` instead

Needs sagemath/cypari2#165 applied to cypari
    
URL: sagemath#38749
Reported by: Antonio Rojas
Reviewer(s): Antonio Rojas, Dima Pasechnik, Gonzalo Tornaría
vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 3, 2025
    
`NEXT_PRIME_VIADIFF` is removed in 2.17, port `pari_prime_range` to
`pari_PRIMES` instead

Needs sagemath/cypari2#165 applied to cypari
    
URL: sagemath#38749
Reported by: Antonio Rojas
Reviewer(s): Antonio Rojas, Dima Pasechnik, Gonzalo Tornaría
vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 4, 2025
    
`NEXT_PRIME_VIADIFF` is removed in 2.17, port `pari_prime_range` to
`pari_PRIMES` instead

Needs sagemath/cypari2#165 applied to cypari
    
URL: sagemath#38749
Reported by: Antonio Rojas
Reviewer(s): Antonio Rojas, Dima Pasechnik, Gonzalo Tornaría
vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 9, 2025
    
`NEXT_PRIME_VIADIFF` is removed in 2.17, port `pari_prime_range` to
`pari_PRIMES` instead

Needs sagemath/cypari2#165 applied to cypari
    
URL: sagemath#38749
Reported by: Antonio Rojas
Reviewer(s): Antonio Rojas, Dima Pasechnik, Gonzalo Tornaría
@vbraun
Copy link
Member

vbraun commented Feb 9, 2025

On macos (mac mini m2) I'm getting

[cysignals-1.12.3] [spkg-install] The Meson build system
[cysignals-1.12.3] [spkg-install] Version: 1.3.1
[cysignals-1.12.3] [spkg-install] Source dir: /Users/buildbot-sage/worker/sage_git/build/local/var/lib/sage/venv-python3.12.5/var/tmp/sage/build/cysignals-1.12.3/src
[cysignals-1.12.3] [spkg-install] Build dir: /Users/buildbot-sage/worker/sage_git/build/local/var/lib/sage/venv-python3.12.5/var/tmp/sage/build/cysignals-1.12.3/src/.mesonpy-oe6svlmq
[cysignals-1.12.3] [spkg-install] Build type: native build
[cysignals-1.12.3] [spkg-install] Project name: cysignals
[cysignals-1.12.3] [spkg-install] Project version: undefined
[cysignals-1.12.3] [spkg-install] C compiler for the host machine: gcc (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.3.9.4)")
[cysignals-1.12.3] [spkg-install] C linker for the host machine: gcc ld64 classic  PROJECT:ld64
[cysignals-1.12.3] [spkg-install] 
[cysignals-1.12.3] [spkg-install] ../meson.build:1:0: ERROR: Unable to get clang pre-processor defines:
[cysignals-1.12.3] [spkg-install] Compiler stdout:
[cysignals-1.12.3] [spkg-install] 
[cysignals-1.12.3] [spkg-install] -----
[cysignals-1.12.3] [spkg-install] Compiler stderr:
[cysignals-1.12.3] [spkg-install] error: invalid argument '-std=gnu++11' not allowed with 'C'
[cysignals-1.12.3] [spkg-install] 
[cysignals-1.12.3] [spkg-install] -----

vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 9, 2025
    
`NEXT_PRIME_VIADIFF` is removed in 2.17, port `pari_prime_range` to
`pari_PRIMES` instead

Needs sagemath/cypari2#165 applied to cypari
    
URL: sagemath#38749
Reported by: Antonio Rojas
Reviewer(s): Antonio Rojas, Dima Pasechnik, Gonzalo Tornaría
@dimpase
Copy link
Member

dimpase commented Feb 9, 2025

clang 15? This is a very old Xcode, can you upgrade?

@vbraun
Copy link
Member

vbraun commented Feb 9, 2025

Thats XCode 15.4 released in May 2024

vbraun@Mini-M2 ~ % gcc --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Applications/Xcode-15.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@dimpase
Copy link
Member

dimpase commented Feb 9, 2025

and no update available?

@dimpase
Copy link
Member

dimpase commented Feb 9, 2025

I tested on William's M1 box:

dima@studio ~ % gcc -v
Apple clang version 16.0.0 (clang-1600.0.26.4)
Target: arm64-apple-darwin24.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
dima@studio ~ % uname -a
Darwin studio.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:15 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6000 arm64

and all was good.

@dimpase
Copy link
Member

dimpase commented Feb 9, 2025

@vbraun - on the other hand it's a bug of sorts, in cysignals, most probably. @tobiasdiez - here cysignals meson build fails due to an over-strict C compiler which errors upon finding a C++-only flag.

@vbraun
Copy link
Member

vbraun commented Feb 10, 2025

There is some unrelated bug that keeps me from updating, but also we should build on a less than one year old compiler release...

@jhpalmieri
Copy link
Member

I see this on OS X:

sage -t --long --warn-long 30.0 --random-seed=73715025106880345904056137452377696661 src/sage/schemes/elliptic_curves/gp_simon.py
**********************************************************************
File "src/sage/schemes/elliptic_curves/gp_simon.py", line 84, in sage.schemes.elliptic_curves.gp_simon.?
Failed example:
    E.simon_two_descent()                             # long time
Expected:
    (0, 2, [])
Got:
    (2, 2, [(-121/64*w - 2719/64 : -15555/512*w - 186181/512 : 1)])

For what it's worth:

  • I don't get this failure with a different random seed.
  • With the develop branch (using Sage's pari 2.15.5), I get a failure but a different one if I use this random seed.
    So this may be a pre-existing bug in a new guise.

@user202729
Copy link
Contributor

@jhpalmieri Looks like that's an improvement instead of a bug? The first and second number are the lower and upper bound of the rank of MW group, and the output seems to mean in newer PARI version, the code can successfully prove that the rank is exactly 2 instead of just "between 0 and 2".

Related: #9322

But because the test is intended to check that the function call doesn't take too long, maybe we should change it to a harder test case?

@JohnCremona any comment on this?

@JohnCremona
Copy link
Member

@jhpalmieri Looks like that's an improvement instead of a bug? The first and second number are the lower and upper bound of the rank of MW group, and the output seems to mean in newer PARI version, the code can successfully prove that the rank is exactly 2 instead of just "between 0 and 2".

Related: #9322

But because the test is intended to check that the function call doesn't take too long, maybe we should change it to a harder test case?

@JohnCremona any comment on this?

It is not quite as wonderful as you suggest @user202729 . In the old version we only learn that the rank is bounded by 2, with no lower bound and no points. In the new version although the output claims that the rank is 2, it only gives one point, and in fact it has only proved that the lower bound is 1. But conjecturally the difference between the actual rank and the bound (which is called the 2-Se;mer rank) is even (this is a consequence of part of the Birch Swinnerton-Dyer conjectures, and is called the 'parity conjecture'), and Simon's script increases the lower bound by one in such cases.

Unless someone can point me to a specific result towards the parity conjecture (there are results in this direction) which justifies this, I would only rigorously conclude from the new output that the rank is either 1 or 2, however much I believe that the rank must in fact be 2, as I would need to be shown a second independent point to be convinced.

When I first wrote a Sage wrapper around Simon's script, years ago, I was careful not to use the parity conjecture, so that the lower bound was always equal to the number of points of initinite order returned. (Older versions of Simon's GP code were also a bit careless in the list of points, which might include points of finite order (which do not ontribute to the rank).)

In this case, all we are reporting is what the script outputs, so just change the expected output to the actual output. Perhaps with a comment saying that the lower bound has been increased by 1 using the parity conjecture.

I did think that now that lipari itself has a very good implementation of 2-descent, we had abandoned Simon's GP version (after many years of useful service). But that is only for curves defined over Q.

@saraedum
Copy link
Member

cc @AndreasEnge who is waiting for this to package for guix.

@dimpase
Copy link
Member

dimpase commented Feb 10, 2025

There is some unrelated bug that keeps me from updating, but also we should build on a less than one year old compiler release...

IIRC correctly, Apple's clang 15 started to convert quite harmless warnings into errors, something that was then rolled back.
One can in principle try to pass an appropriate option in CFLAGS, or sanitise CFLAGS...

@tobiasdiez
Copy link
Contributor

On macos (mac mini m2) I'm getting

[cysignals-1.12.3] [spkg-install] The Meson build system
[cysignals-1.12.3] [spkg-install] Version: 1.3.1
[cysignals-1.12.3] [spkg-install] Source dir: /Users/buildbot-sage/worker/sage_git/build/local/var/lib/sage/venv-python3.12.5/var/tmp/sage/build/cysignals-1.12.3/src
[cysignals-1.12.3] [spkg-install] Build dir: /Users/buildbot-sage/worker/sage_git/build/local/var/lib/sage/venv-python3.12.5/var/tmp/sage/build/cysignals-1.12.3/src/.mesonpy-oe6svlmq
[cysignals-1.12.3] [spkg-install] Build type: native build
[cysignals-1.12.3] [spkg-install] Project name: cysignals
[cysignals-1.12.3] [spkg-install] Project version: undefined
[cysignals-1.12.3] [spkg-install] C compiler for the host machine: gcc (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.3.9.4)")
[cysignals-1.12.3] [spkg-install] C linker for the host machine: gcc ld64 classic  PROJECT:ld64
[cysignals-1.12.3] [spkg-install] 
[cysignals-1.12.3] [spkg-install] ../meson.build:1:0: ERROR: Unable to get clang pre-processor defines:
[cysignals-1.12.3] [spkg-install] Compiler stdout:
[cysignals-1.12.3] [spkg-install] 
[cysignals-1.12.3] [spkg-install] -----
[cysignals-1.12.3] [spkg-install] Compiler stderr:
[cysignals-1.12.3] [spkg-install] error: invalid argument '-std=gnu++11' not allowed with 'C'
[cysignals-1.12.3] [spkg-install] 
[cysignals-1.12.3] [spkg-install] -----

This should be fixed in more recent versions of meson, eg with mesonbuild/meson#13289.

@dimpase
Copy link
Member

dimpase commented Feb 10, 2025

is this fix already in a released version of meson?
Then we should upgrade

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

Successfully merging this pull request may close these issues.