Closed mmasdeu closed 13 years ago
Which version of Sage are you using?
Works for me in both PARI (version 2.4.3 development svn-12623 as shipped with Sage, i.e. ./sage -gp
) and from within Sage, version 4.7 (cf. this SAGENB worksheet) as well as version 4.7.1.alpha2. (Haven't yet tried with 4.7.1.rc0 though.)
Description changed:
---
+++
@@ -1,4 +1,4 @@
-When calling the function
+In Sage 4.7, when calling the function
pari('qfminim(%s,2,0)'%(A._pari_()))
I am using Sage Version 4.7, Release Date: 2011-05-23.
I tried the worksheet you attached and it doesn't work for me. I also tried the sage -gp (I didn't know about it before) and it also fails, so I change my opinion on it being a problem with interfaces...
When asked about pari version (in sage -gp) I get 2.4.3... I am running Linux kernel 2.6.39, and compiled Sage from source on a 32bit machine, if that is of any use.
Is there any other info that might be relevant?
Thank you,
marc.
Replying to @nexttime:
Which version of Sage are you using?
Works for me in both PARI (version 2.4.3 development svn-12623 as shipped with Sage, i.e.
./sage -gp
) and from within Sage, version 4.7 (cf. this SAGENB worksheet) as well as version 4.7.1.alpha2. (Haven't yet tried with 4.7.1.rc0 though.)
Replying to @mmasdeu:
I am using Sage Version 4.7, Release Date: 2011-05-23.
I am running Linux kernel 2.6.39, and compiled Sage from source on a 32bit machine, if that is of any use.
Is there any other info that might be relevant?
Maybe the Linux distribution you are using, the processor type (cat /proc/cpuinfo
) / architecture (uname -a
) and last but not least the version of GCC (gcc -v
).
If you haven't yet run Sage's test suite, you could at least run a subset of it:
/home/float/sage$ ./sage -t -long devel/sage/sage/libs/pari/
...
/home/float/sage$ ./sage -t -long devel/sage/sage/interfaces/gp.py
...
(Both together should at most take a few minutes on a slow machine; the second one doesn't make much sense if the error also occurs in plain PARI/GP as you said.)
Probably more important, as this seems to be an upstream bug, you can run PARI's test suite, which unfortunately requires rebuilding PARI, and hence will take much more time (up to 30 minutes I think, depending on your machine):
/home/float/sage$ env SAGE_CHECK=yes ./sage -f -s pari-2.4.3.alpha.p5 2>&1 | tee pari-test.log
(This reinstalls the package unless PARI's test suite fails, and logs the output to pari-test.log
. If you end up with a broken Sage installation because the test suite didn't pass, you can reinstall it by almost the same command, simply omitting the env SAGE_CHECK=yes
and optionally -s
, i.e. ./sage -f pari-2.4.3.alpha.p5
.)
P.S.: In case PARI's test suite fails, you can attach (upload) the log file pari-test.log
to this ticket.
I have run all tests you suggested and everything seems ok. I have also tried to run the code in another machine that has Sage installed (that is an Intel Xeon with 8 cores, so quite different to my '06 laptop). That one is running Sage 4.6.2 (2011-02-25). And got the same error.
Here is the data about my laptop (in which it is easiest for me to experiment):
Distribution: Arch Linux updated a few hours ago (but I have seen the bug weeks ago).
Cpuinfo:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 13
model name : Intel(R) Pentium(R) M processor 1.50GHz
stepping : 8
cpu MHz : 1496.431
cache size : 2048 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss tm pbe up bts est tm2
bogomips : 2994.56
clflush size : 64
cache_alignment : 64
address sizes : 32 bits physical, 32 bits virtual
power management:
Architecture (uname -a): Linux tablarch 2.6.39-ARCH #1 SMP PREEMPT Sat Jul 9 15:31:04 CEST 2011 i686 Intel(R) Pentium(R) M processor 1.50GHz GenuineIntel GNU/Linux
GCC:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-linux-gnu/4.6.1/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: /build/src/gcc-4.6.1/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --disable-multilib --disable-libstdcxx-pch --enable-checking=release
Thread model: posix
gcc version 4.6.1 (GCC)
Thanks again,
marc.
Replying to @nexttime:
Replying to @mmasdeu:
I am using Sage Version 4.7, Release Date: 2011-05-23.
I am running Linux kernel 2.6.39, and compiled Sage from source on a 32bit machine, if that is of any use.
Is there any other info that might be relevant?
Maybe the Linux distribution you are using, the processor type (
cat /proc/cpuinfo
) / architecture (uname -a
) and last but not least the version of GCC (gcc -v
).If you haven't yet run Sage's test suite, you could at least run a subset of it:
/home/float/sage$ ./sage -t -long devel/sage/sage/libs/pari/ ... /home/float/sage$ ./sage -t -long devel/sage/sage/interfaces/gp.py ...
(Both together should at most take a few minutes on a slow machine; the second one doesn't make much sense if the error also occurs in plain PARI/GP as you said.)
Probably more important, as this seems to be an upstream bug, you can run PARI's test suite, which unfortunately requires rebuilding PARI, and hence will take much more time (up to 30 minutes I think, depending on your machine):
/home/float/sage$ env SAGE_CHECK=yes ./sage -f -s pari-2.4.3.alpha.p5 2>&1 | tee pari-test.log
(This reinstalls the package unless PARI's test suite fails, and logs the output to
pari-test.log
. If you end up with a broken Sage installation because the test suite didn't pass, you can reinstall it by almost the same command, simply omitting theenv SAGE_CHECK=yes
and optionally-s
, i.e../sage -f pari-2.4.3.alpha.p5
.)
Hmmm, anything in common with the other machine (e.g. distro, compiler, special build options)?
Did you also try ./sage -gp
there?
Replying to @nexttime:
Hmmm, anything in common with the other machine (e.g. distro, compiler, special build options)?
Don't think so. The other machine is my math department. What I know about it is that everything is compiled from scratch (so no distro), gcc is 4.2.4. My guess is that Sage has been built with the default options, but I can't confirm at this moment.
Did you also try
./sage -gp
there?
Yes, I did.
Also, I have tried on a third machine with same results. Do you have access to other Sage installs on different types of machines? It might be that it only affects precompiled versions and 32 bit ones?
I am running out of ideas, but since two Sage installs in different math departments (and in different continents, for that matter) give the same error, it shouldn't be hard to find other installations with the same problem...
marc.
Replying to @mmasdeu:
Replying to @nexttime:
Did you also try
./sage -gp
there?Yes, I did.
How does the error look like there? (Sage may somewhat obscure PARI's error message when you use PARI from the Sage prompt, sage:
.)
Also, I have tried on a third machine with same results. Do you have access to other Sage installs on different types of machines? It might be that it only affects precompiled versions and 32 bit ones?
Did you also build your working PARI/GP versions from scratch / source?
I am running out of ideas, but since two Sage installs in different math departments (and in different continents, for that matter) give the same error, it shouldn't be hard to find other installations with the same problem...
I'll try to find some where I can reproduce this...
Did you make any changes in $SAGE_ROOT/local/lib/
(i.e. create symbolic links to system libraries as replacements for Sage's versions, e.g. libreadline*
)?
readline
is currently my top candidate, as we already had quite a lot of trouble with it and in fact do use the system's version (without user intervention) instead of building Sage's one on some platforms (including ArchLinux and openSUSE), also depending on the version found.
You could
$SAGE_ROOT/spkg/logs/readline*
to see if just a symbolic link was created (or the system version got copied) by Sage,$SAGE_ROOT/local/lib/
that point outside the Sage tree, i.e. start with /lib/...
, /usr/lib/...
or alike.We so far couldn't reproduce the error on
libreadline
gets copied,libreadline
was built and is used,More to come... ;-)
P.S.: What operating system / distribution does the Xeon run?
Changed keywords from pari, qfminim, ZM_lll, large matrix to pari, qfminim, ZM_lll, large matrix, ArchLinux, PARI/GP
Replying to @nexttime:
How does the error look like there? (Sage may somewhat obscure PARI's error message when you use PARI from the Sage prompt,
sage:
.)
? A %2 = [32982266684193100 1368614777139719 224591013270052693 276460184982223238]
[1368614777139719 56791380087354 9319512049770279 11471848267545007]
[224591013270052693 9319512049770279 1529340971891522140 1882541434053596358]
[276460184982223238 11471848267545007 1882541434053596358 2317313350044091414]
? qfminim(A,2,0) at top-level: qfminim(A,2,0) ^-------------- qfminim: bug in ZM_lll, please report Break loop: type 'break' to go back to GP
Did you also build your working PARI/GP versions from scratch / source?
Yes. For the stable version I used the PKGBUILDs from the ArchUserRepo, which grabs the code and build it. For the devel version, I downloaded myself the source from the PARI website and compiled it.
I'll try to find some where I can reproduce this...
Did you make any changes in
$SAGE_ROOT/local/lib/
(i.e. create symbolic links to system libraries as replacements for Sage's versions, e.g.libreadline*
)?
When I compiled it in my machine I there was an issue with libppl. I followed some advice from the web and linked it to my system version.
You could
- take a look at your
$SAGE_ROOT/spkg/logs/readline*
to see if just a symbolic link was created (or the system version got copied) by Sage,- look for symbolic links in
$SAGE_ROOT/local/lib/
that point outside the Sage tree, i.e. start with/lib/...
,/usr/lib/...
or alike.
OK, apart from libppl (which points to the system version), the readline lib seems to be also copied from my system. This library has been updated afterwards (ArchLinus is rolling release, right?). I have just trying copying again the library from my system over there, but I still get the same error.
I noticed in the log file you mentioned this error at the end of the file. Hopefully it's harmless...
...
Making Sage/Python scripts relocatable...
File "./sage-make_relative", line 5
print "Making script relocatable"
^
SyntaxError: invalid syntax
Replying to @nexttime:
P.S.: What operating system / distribution does the Xeon run?
It's running Linux, but I once asked the sysadmin in my department about the distribution, and he told me that everything is compiled from scratch. So I guess the "distro" would be LFS :).
marc.
PS: thanks for the help and promptness in tracking this down, I really appreciate it!
Success! ;-)
I could reproduce the error on Ubuntu 9.04 x86 (Pentium4 Prescott) with Sage 4.7, both from the Sage prompt and in GP (sage -gp
), which raises the question if the Sage version running on the Xeon was perhaps also built as a 32-bit application.
Guess it'll take some time to track this down though.
Replying to @nexttime:
Success! ;-)
I could reproduce the error on Ubuntu 9.04 x86 (Pentium4 Prescott) with Sage 4.7, both from the Sage prompt and in GP (
sage -gp
), which raises the question if the Sage version running on the Xeon was perhaps also built as a 32-bit application.
Yes, I checked and even in the Xeon machine Sage was built for i686! Thanks, and hope that this gets resolved soon...
Upstream: Fixed upstream, but not in a stable release.
I've made an spkg that fixes the (btw. upstream) bug.
Please test & report back / review!
Description changed:
---
+++
@@ -22,3 +22,23 @@
I have found other examples of (also large) matrices where pari fails similarly. I have tried this example with standalone pari (both stable and developement versions) and it returns with no problem, so I guess it is a problem with the interface Sage-PARI.
+
+---
+
+This is an instance of PARI bug 1154.
+
+---
+
+New spkg: http://spkg-upload.googlecode.com/files/pari-2.4.3.alpha.p8.spkg
+
+md5sum: 4ad98aabafa69cf5b5aab6e05956b472 pari-2.4.3.alpha.p8.spkg
+
+(This spkg is based on the p7 from #11605, which at the moment still needs review.)
+
+
+### pari-2.4.3.alpha.p8 (Leif Leonhardy, July 17th, 2011)
+* #11604: Apply patch for PARI bug 1154 (src/basemath/lll.c only,
Author: Leif Leonhardy
Diff between the p7 (#11605) and the p8. For reference / review.
Attachment: pari-2.4.3.alpha.p7-p8.diff.gz
Worked for me. I will do more tests that used to fail and see if it is solid...
Thanks!
So far the bug seems fixed by the above spkg (I didn't apply the patch you attached).
Replying to @mmasdeu:
So far the bug seems fixed by the above spkg (I didn't apply the patch you attached).
All changes are to the spkg; the diff is just for documentation purposes.
You can add yourself to http://trac.sagemath.org/sage_trac/wiki#AccountNamesmappedtoRealNames, and put your (real / full) name into the Reviewer(s) field of the ticket.
There are too many PARI spkgs floating around, I suggest this patch simply gets added to #11130.
Replying to @jdemeyer:
There are too many PARI spkgs floating around, I suggest this patch simply gets added to #11130.
Until we have a working PARI 2.5.0.whatever, I think we should still add a few fixes to our more stable 2.4.3 series, to get merged in reasonable time.
P.S.: I've tested the p8 here on Ubuntu 9.04 x86 (Pentium4 Prescott) and Ubuntu 10.04 x86_64 (Core2), Sage 4.7 and 4.7.1.alpha2 respectively, running PARI's test suite as well as a full ptestlong
on both.
As far as I can see, there've also been no follow-up reports regarding this change (of January 14th) on the PARI site.
Reviewer: Marc Masdeu
For the record, a bit more readable, this is the patch for PARI bug 1154:
--- src/basemath/lll.c 2011-07-17 02:01:36.000000000 +0200
+++ src/basemath/lll.c 2011-07-17 01:35:55.000000000 +0200
@@ -1,4 +1,4 @@
-/* $Id: lll.c 12380 2010-06-03 12:32:58Z bill $
+/* $Id: lll.c 12825 2011-01-14 23:09:00Z bill $
Copyright (C) 2008 The PARI group.
@@ -533,36 +533,25 @@
return U? U: B;
}
-static long
-good_prec(long d, double delta, double eta)
-{
- double t = eta+1, rho = t*t / (delta - eta*eta);
- long goodprec = (ulong) (7.0 + 0.2*d + d*log2(rho)
- + 2.0 * log ((double) d) - log2( (eta-0.5)*(1.0-delta) ));
- return nbits2prec(goodprec);
-}
-
/* Assume x a ZM, if ptB != NULL, set it to Gram-Schmidt (squared) norms */
GEN
ZM_lll_norms(GEN x, double DELTA, long flag, GEN *B)
{
pari_sp ltop = avma;
const double ETA = 0.51;
- long p,prec, d, n = lg(x)-1;
+ long p, d, n = lg(x)-1;
GEN U;
if (n <= 1) return lll_trivial(x, flag);
d = lg(gel(x,1))-1;
- prec = good_prec(d,DELTA,ETA);
x = RgM_shallowcopy(x);
U = (flag & LLL_INPLACE)? NULL: matid(n);
- for (p = minss(3,prec); p <= prec; p++)
+ for (p = 3; ; p++)
{
GEN m = fplll(&x, &U, B, DELTA, ETA, flag, p);
if (m) return m;
gerepileall(ltop, U? 2: 1, &x, &U);
}
- pari_err(bugparier,"ZM_lll");
- return NULL;
+ return NULL; /* NOT REACHED */
}
/********************************************************************/
Changed upstream from Fixed upstream, but not in a stable release. to Fixed upstream, in a later stable release.
Description changed:
---
+++
@@ -21,24 +21,4 @@
4ad98aabafa69cf5b5aab6e05956b472 pari-2.4.3.alpha.p8.spkg
- -### pari-2.4.3.alpha.p8 (Leif Leonhardy, July 17th, 2011) -* #11604: Apply patch for PARI bug 1154 (src/basemath/lll.c only,
+This is fixed by #11130, this ticket simply adds a doctest.
Changed author from Leif Leonhardy to Jeroen Demeyer
Changed reviewer from Marc Masdeu to none
Dependencies: #11321, #11130
Attachment: 11604_doctest.patch.gz
Doctest for the bug
For the impatient: A new spkg fixing this for Sage versions 4.6.x, 4.7 and 4.7.1 is still available at http://spkg-upload.googlecode.com/files/pari-2.4.3.alpha.p8.spkg .
Description changed:
---
+++
@@ -21,4 +21,4 @@
-This is fixed by #11130, this ticket simply adds a doctest. +This is PARI bug 1154, fixed by #11130, this ticket simply adds a doctest.
The attached doctest obviously catches the error reported here.
Reviewer: Leif Leonhardy
Description changed:
---
+++
@@ -22,3 +22,5 @@
This is PARI bug 1154, fixed by #11130, this ticket simply adds a doctest. + +Apply attachment: 11604_doctest.patch
Milestone sage-4.7.3 deleted
Merged: sage-4.8.alpha1
In Sage 4.7, when calling the function
pari('qfminim(%s,2,0)'%(A.pari()))
with certain matrix, I get the following:
This is PARI bug 1154, fixed by #11130, this ticket simply adds a doctest.
Apply attachment: 11604_doctest.patch
Depends on #11321 Depends on #11130
Upstream: Fixed upstream, in a later stable release.
CC: @jdemeyer
Component: number theory
Keywords: pari, qfminim, ZM_lll, large matrix, ArchLinux, PARI/GP
Author: Jeroen Demeyer
Reviewer: Leif Leonhardy
Merged: sage-4.8.alpha1
Issue created by migration from https://trac.sagemath.org/ticket/11604