sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.43k stars 479 forks source link

Upgrade PARI to svn snapshot 12577 - a pre-release of PARI 2.4.3. #9343

Closed williamstein closed 14 years ago

williamstein commented 14 years ago

See #7736 (a bug this will fix), #8453 (last pari upgrade).

See http://wiki.sagemath.org/NewPARI for more information and links.

CC: @robertwb @loefflerd @JohnCremona @jdemeyer

Component: packages: standard

Author: Robert Bradshaw, John Cremona, Jeroen Demeyer, William Stein, David Kirkby

Reviewer: Robert Bradshaw, John Cremona, Jeroen Demeyer, William Stein, David Kirkby, François Bissey, Leif Leonhardy

Merged: sage-4.6.alpha0

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

williamstein commented 14 years ago
comment:1

NOTE: According to http://pari.math.u-bordeaux.fr/packages.html, there are now two seadata tarballs; we'll have to make one standard, and one optional.

williamstein commented 14 years ago
comment:3

The new ellap (which replaces the sea.gp script in sage) is seriously buggy, evidently. Sometimes it works, but the first example I tried fails miserably.


? ellap(ellinit([1,2,7,4,3]),nextprime(10^20))
%1 = -4070602678
? ellap(ellinit([1,2,3,4,5]),nextprime(10^20))
  ***   at top-level: ellap(ellinit([1,2,3
  ***                 ^--------------------
  *** ellap: bug in PARI/GP (Segmentation Fault), please report
  ***   Break loop: type 'break' to go back to GP
break> 

? ellap(ellinit([1,2,3,4,5]),nextprime(10^25))
%2 = 1231939791654
? ellap(ellinit([1,2,3,4,5]),nextprime(10^30))
%3 = 1790178944607137
? ellap(ellinit([1,2,3,4,5]),nextprime(10^35))
  ***   at top-level: ellap(ellinit([1,2,3
  ***                 ^--------------------
  *** ellap: bug in PARI/GP (Segmentation Fault), please report
  ***   Break loop: type 'break' to go back to GP
break> 

NOTE: To use ellap for big p, you must put the extracted data from seadata.tgz/data/* in local/share/pari, as explained here: http://pari.math.u-bordeaux.fr/packages.html

I'm reporting this bug upstream now.

mwhansen commented 14 years ago
comment:4

This could hopefully fix the SEA segfault in Cygwin.

robertwb commented 14 years ago
comment:5

pari.listcreate no longer pre-allocates the entire list, so can't be used in the _pari_trap (out of memory) tests.

robertwb commented 14 years ago

Attachment: 9343-part1-builds.patch.gz

williamstein commented 14 years ago
comment:6

My spkg is here:

http://sage.math.washington.edu/home/wstein/build/sd22/pari/sage-4.5.alpha0/pari-2.4.3.svn.spkg
williamstein commented 14 years ago
comment:7

Attachment: trac_9343-part2.patch.gz

williamstein commented 14 years ago

Description changed:

--- 
+++ 
@@ -2,4 +2,4 @@

 After doing this, we also need to remove sea.gp, since it is included in pari now.

-
+Running todo list: http://sage.math.washington.edu/home/wstein/build/sd22/pari/pari.txt
robertwb commented 14 years ago

Attachment: trac_9343-part4.patch.gz

Attachment: 9343-part3-algdep.patch.gz

robertwb commented 14 years ago
comment:8

Here is a list of functions from decl.pxi that show up nowhere in the pari sources (using grep): http://sage.math.washington.edu/home/robertwb/scratch/robertwb/sage-4.4.4/missing_functions.txt

kiwifb commented 14 years ago
comment:9

Just as a practicality could we put a date in the spkg's name? It is a svn snapshot so we really want to know when it has been taken.

robertwb commented 14 years ago

Attachment: trac_9343-part5.patch.gz

williamstein commented 14 years ago
comment:10

Attachment: 9343-part6-symbols.patch.gz

New spkg location:

http://sage.math.washington.edu/home/wstein/build/sd22/pari/pari-2.4.3.svn.spkg

robertwb commented 14 years ago
comment:11

New spkg at http://sage.math.washington.edu/home/robertwb/pari-2.4.3.svn.p1.spkg (updated patch files).

williamstein commented 14 years ago
comment:12

Attachment: trac_9343-part7-fix_signals.patch.gz

Suspiciousness when installing pari-2.4.3.svn.p1.spkg:


0 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5659)
****************************************************
./spkg-install: line 1: B1: command not found
./spkg-install: line 1: 2000: command not found
./spkg-install: line 1: 0c#!/bin/sh: No such file or directory
Configuring pari-2.4.3 (DEVELOPMENT VERSION) 
Checking echo to see how to suppress newlines...
...using \c
Looking for some tools first ...
williamstein commented 14 years ago
comment:13

Polynomial factorization over number fields is broken:

?  nffactor(nfinit(y^2-5), x^5 - x^4 - 7*x^3 + x^2 + 7*x - 3)
%6 = 
[x - 3 1]

[x + Mod(-1/2*y + 1/2, y^2 - 5) 4]

[x + Mod(1/2*y + 1/2, y^2 - 5) 0]

? factor                 
factor        factorcantor  factorial     factormod     factorpadic   
factorback    factorff      factorint     factornf      
? factornf(x^5 - x^4 - 7*x^3 + x^2 + 7*x - 3, y^2-5)
%7 = 
[x - 3 1]

[x + Mod(-1/2*y + 1/2, y^2 - 5) 0]

[x + Mod(1/2*y + 1/2, y^2 - 5) 4]

Here's what used to happen:

? nffactor(nfinit(y^2-5), x^5 - x^4 - 7*x^3 + x^2 + 7*x - 3)
%7 = 
[x - 3 1]
[x + Mod(-1/2*y + 1/2, y^2 - 5) 2]
[x + Mod(1/2*y + 1/2, y^2 - 5) 2]
williamstein commented 14 years ago
comment:14

Above "Polynomial factorization over number fields is broken" has now been reported upstream by me to submit@pari.math.u-bordeaux.fr

robertwb commented 14 years ago
comment:15

Here's a link to the doctest failures: http://sage.math.washington.edu/home/robertwb/scratch/robertwb/sage-4.4.4/doctests.log

williamstein commented 14 years ago
comment:16

New spkg:

 http://sage.math.washington.edu/home/wstein/patches/pari-2.4.3.svn.p2.spkg
williamstein commented 14 years ago
comment:17

New version

http://sage.math.washington.edu/home/wstein/patches/pari-2.4.3.svn.p3.spkg
williamstein commented 14 years ago
comment:18

NOTE: pari-2.4.3.svn.p3.spkg fixes the polynomial factorization bug mentioned above.

robertwb commented 14 years ago

Attachment: 9343-part8.patch.gz

robertwb commented 14 years ago
comment:19

I've updated http://sage.math.washington.edu/home/robertwb/scratch/robertwb/sage-4.4.4/doctests.log

williamstein commented 14 years ago

Attachment: trac_9343-extcode-buzzard_slopes.patch.gz

Attachment: trac_9343-extcode-delete_sea_directory.patch.gz

williamstein commented 14 years ago

Attachment: trac_9343-part9-get_rid_of_sea.patch.gz

robertwb commented 14 years ago

Attachment: 9343-part10.patch.gz

a couple more doctest fixes

JohnCremona commented 14 years ago
comment:22

Replying to @JohnCremona:

I nearly finished sorting out extcode/pari/cremona and elliptic_curves/gp_cremona.py and will finish that today (Sunday) and post a patch for it.

JohnCremona commented 14 years ago
comment:23

Replying to @JohnCremona:

Replying to @JohnCremona:

I nearly finished sorting out extcode/pari/cremona and elliptic_curves/gp_cremona.py and will finish that today (Sunday) and post a patch for it.

I had to make one chenge to extcode/pari/simon/ell.gp (removing one comma!) and have reported it upstream.

williamstein commented 14 years ago

Attachment: trac_9343-part11-fixing_misc_tests.patch.gz

williamstein commented 14 years ago
comment:24

As of right now, you can install this into 4.4.4 by doing:

1.

  ./sage -f -m http://sage.math.washington.edu/home/wstein/patches/pari-2.4.3.svn.p3.spkg
  1. import the patch called sagelib_9343.patch to the main Sage repo.

  2. import the patch extcode_9343.patch into the SAGE_ROOT/data extcode.

JohnCremona commented 14 years ago

Attachment: trac_9343-extcode-delete-cremona.patch.gz

williamstein commented 14 years ago

Attachment: trac_9343-gp-cremona.patch.gz

Attachment: extcode_9343.patch.gz

this flattens all extcode patches above

williamstein commented 14 years ago

flattening of all sagelib patches above.

JohnCremona commented 14 years ago
comment:25

Attachment: sagelib_9343.patch.gz

Thanks!

kiwifb commented 14 years ago
comment:26

Are there any separate entry for patching problems with: eclib lcalc genus2reduction Or has no one tried to to see if these were broken by this version of pari?

JohnCremona commented 14 years ago
comment:27

I will compile eclib with pari 2.4.3; if any changes are needed, I will change the source at source, so patches will not be needed.

JohnCremona commented 14 years ago
comment:28

Replying to @JohnCremona:

I will compile eclib with pari 2.4.3; if any changes are needed, I will change the source at source, so patches will not be needed.

eclib compiles and runs fine with 2.4.3. It even now compiles with -ansi (which was not true before) and almost with -pedantic (just 4 extraneous semicolons need deleting; not worth a new spkg version).

kiwifb commented 14 years ago
comment:29

lcalc has some problems with pari-2.4. I am not sure yet if they are minor or major.

Lcommandline_elliptic.cc: In function ‘void data_E(char*, char*, char*, char*, char*, int, Double*)’:
Lcommandline_elliptic.cc:124: error: ‘lgeti’ was not declared in this scope
make[1]: *** [Lcommandline_elliptic.o] Error 1

I'll be checking genus2reduction next.

kiwifb commented 14 years ago
comment:30

lcalc problem is minor. Not sure why pariold.h is not properly included when it should be sourced from pari.h (in pari-2.3 it was sourced from paricom.h itself included from pari.h). Anyway replacing lgeti by (long)cgeti as would be done by pariold.h works like a charm.

kiwifb commented 14 years ago
comment:31

genus2reduction suffer the same kind of problems. But it is more serious:

genus2reduction.c: In function ‘main’:
genus2reduction.c:476: error: ‘polun’ undeclared (first use in this function)
genus2reduction.c:476: error: (Each undeclared identifier is reported only once
genus2reduction.c:476: error: for each function it appears in.)
genus2reduction.c:600: error: ‘polx’ undeclared (first use in this function)
genus2reduction.c:96: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
genus2reduction.c:98: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
genus2reduction.c: In function ‘factorpadicnonun’:
genus2reduction.c:1676: error: ‘polx’ undeclared (first use in this function)
genus2reduction.c: In function ‘polymini’:
genus2reduction.c:1701: error: ‘polx’ undeclared (first use in this function)
genus2reduction.c:1712: error: ‘zero’ undeclared (first use in this function)
genus2reduction.c:1731: error: ‘un’ undeclared (first use in this function)
genus2reduction.c: In function ‘discpart’:
genus2reduction.c:1818: error: ‘polun’ undeclared (first use in this function)
genus2reduction.c: In function ‘polyminizi’:
genus2reduction.c:1856: error: ‘gi’ undeclared (first use in this function)
genus2reduction.c:1859: error: ‘polx’ undeclared (first use in this function)
genus2reduction.c: In function ‘polyminizi2’:
genus2reduction.c:1939: error: ‘polx’ undeclared (first use in this function)
genus2reduction.c:1942: error: ‘gi’ undeclared (first use in this function)
genus2reduction.c: In function ‘zi2mod’:
genus2reduction.c:2001: error: ‘gi’ undeclared (first use in this function)

polun, polx, zero and un were all defined in pariold.h but are not anywhere anymore in pari-2.4. I cannot track the definition of gi in anything from pari-2.3, anyone knows where that come from and what it should be replaced with? There is a line in pari-2.3 headers mentioning it but not a definition of it as far as I can see:

#define is_universal_constant(x) ((GEN)(x) >= gen_0 && (GEN)(x) <= gi)

this is in paristio.h form pari-2.3.5.

JohnCremona commented 14 years ago
comment:33

I just noticed that the .p3.spkg compiles pari with flag -O1. Surely this is not a sensible choice?

JohnCremona commented 14 years ago
comment:34

I have fixed a bug in Simon's extcode and am currently fixing doctest failures in sage/schemes/elliptic_curves -- so no-one else should work on thar dir without contacting me first! John C

williamstein commented 14 years ago
comment:35

Replying to @JohnCremona:

I just noticed that the .p3.spkg compiles pari with flag -O1. Surely this is not a sensible choice?

Surely it was done on purpose, because with a bigger optimization flag PARI must have exhibited some bugs. The question is how/why/if this is still needed.

jdemeyer commented 14 years ago
comment:36

Can somebody please have a look at this:

RR(gp(exp(1)))

This just hangs sage, in a way which can not even be interrupted.

jdemeyer commented 14 years ago
comment:37

Replying to @williamstein:

Replying to @JohnCremona:

I just noticed that the .p3.spkg compiles pari with flag -O1. Surely this is not a sensible choice?

Surely it was done on purpose, because with a bigger optimization flag PARI must have exhibited some bugs. The question is how/why/if this is still needed.

I always compile my own copy of PARI/GP with -O3 -fomit-frame-pointer -march=core2 using the latest gcc and that seems to work fine.

jdemeyer commented 14 years ago
comment:38

I found a bug in PARI's nfbasis() command: PARI bug 1072. Now that it has been fixed, maybe somebody should make a new spkg with the latest pari?

williamstein commented 14 years ago
comment:39

Replying to @jdemeyer:

Replying to @williamstein:

Replying to @JohnCremona:

I just noticed that the .p3.spkg compiles pari with flag -O1. Surely this is not a sensible choice?

Surely it was done on purpose, because with a bigger optimization flag PARI must have exhibited some bugs. The question is how/why/if this is still needed.

I always compile my own copy of PARI/GP with -O3 -fomit-frame-pointer -march=core2 using the latest gcc and that seems to work fine.

"Seems to"? The Sage test suite is a much better test suite for PARI than pari's own, IMHO.

williamstein commented 14 years ago
comment:40

Replying to @jdemeyer:

I found a bug in PARI's nfbasis() command: PARI bug 1072. Now that it has been fixed, maybe somebody should make a new spkg with the latest pari?

Yes, definitely. It is nontrivial to make a new spkg though -- see spkg-dist...

jdemeyer commented 14 years ago
comment:41

I am working on the number field code in sage/rings/number_field/* Lots of doctests simply fail because ideals have different generators: "Fractional Ideal (a)" is the same ideal as "Fractional Ideal (-a)" but of course this makes doctests fail.

JohnCremona commented 14 years ago
comment:42

I just reported another bug in nffactor to pari's bug-tracker:

sage -gp
...
f = polcyclo(21,y)
nf = nfinit(f);
b = Mod(y^7,f)
nffactor(nf, x^2-b)

gives


  ***   at top-level: nffactor(nf,x^2-b)
  ***                 ^------------------
  *** nffactor: not enough precomputed primes
  ***   Break loop: type 'break' to go back to GP

This breaks a doctest in ell_generic.py