sagemath / sage

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

Upgrade to Singular-3-1-7p1 #17184

Closed jdemeyer closed 9 years ago

jdemeyer commented 10 years ago

Singular 3-1-7p1 repackaged (see spkg-src):

CC: @vbraun @nbruin @burcin

Component: packages: standard

Author: Jean-Pierre Flori

Branch/Commit: 4e287c4

Reviewer: Volker Braun

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

jdemeyer commented 10 years ago

Branch: u/jdemeyer/ticket/17184

jdemeyer commented 10 years ago

Commit: 7c3f691

jdemeyer commented 10 years ago
comment:2

boxen is down, cannot test...


New commits:

7c3f691Upgrade to Singular-3-1-7
jpflori commented 10 years ago
comment:3

One thing I actually did not test because i just forgot: check that it still builds with SAGE_DEBUG as it is quite involved for Singular.

jpflori commented 10 years ago
comment:4

Boxen is back up (from here at least)!

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

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

1027b8fDocument templates.patch
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Changed commit from 7c3f691 to 1027b8f

kiwifb commented 10 years ago
comment:6

That's a lot of dropped patches. That, on its own, would justify the upgrade.

jpflori commented 10 years ago
comment:7

Needs some work for the debug version. I'm on it.

jpflori commented 10 years ago

Changed commit from 1027b8f to f70af8c

jpflori commented 10 years ago

Changed branch from u/jdemeyer/ticket/17184 to u/jpflori/ticket/17184

jpflori commented 10 years ago
comment:8

Should compile ok in debug mode now, though potentially not on top of the new NTL.


New commits:

3968376Update patches for Singular 3-1-7.
f70af8cAdd new alias for Singular debug memory allocation.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

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

cdedfc6Correct fuzz for Singular patches.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Changed commit from f70af8c to cdedfc6

jdemeyer commented 10 years ago
comment:11

Without the latest debug patches, without SAGE_DEBUG=yes, together with NTL-6.2.1:

sage -t --long src/sage/schemes/plane_curves/constructor.py
**********************************************************************
File "src/sage/schemes/plane_curves/constructor.py", line 69, in sage.schemes.plane_curves.constructor.Curve
Failed example:
    C.genus()
Expected:
    1
Got:
    // ** redefining my_awesome_sage_ring **
    1
**********************************************************************
1 item had failures:
   1 of  30 in sage.schemes.plane_curves.constructor.Curve
    [29 tests, 1 failure, 1.96 s]
sage -t --long src/sage/schemes/plane_curves/curve.py
**********************************************************************
File "src/sage/schemes/plane_curves/curve.py", line 116, in sage.schemes.plane_curves.curve.Curve_generic.geometric_genus
Failed example:
    C.geometric_genus()
Expected:
          1
Got:
    // ** redefining my_awesome_sage_ring **
    1
**********************************************************************
1 item had failures:
   1 of  16 in sage.schemes.plane_curves.curve.Curve_generic.geometric_genus
    [35 tests, 1 failure, 1.65 s]
sage -t --long src/sage/rings/polynomial/multi_polynomial_ideal.py
**********************************************************************
File "src/sage/rings/polynomial/multi_polynomial_ideal.py", line 1971, in sage.rings.polynomial.multi_polynomial_ideal.?.integral_closure
Failed example:
    I.integral_closure()
Expected:
    [x^2, y^5, -x*y^3]
Got:
    [x^2, x*y^4, y^5, x*y^3]
**********************************************************************
1 item had failures:
   1 of   4 in sage.rings.polynomial.multi_polynomial_ideal.?.integral_closure
    [708 tests, 1 failure, 11.48 s]
sage -t --long src/sage/schemes/plane_curves/projective_curve.py
**********************************************************************
File "src/sage/schemes/plane_curves/projective_curve.py", line 70, in sage.schemes.plane_curves.projective_curve.ProjectiveCurve_generic.arithmetic_genus
Failed example:
    C.genus()
Expected:
    4
Got:
    // ** redefining my_awesome_sage_ring **
    4
**********************************************************************
jdemeyer commented 10 years ago
comment:12

I get these doctest failures also with the latest version of this ticket, without NTL.

jpflori commented 10 years ago
comment:14

I don't really remember who committed the "my_awesome_ring" code. Was it Volker, or Nils, or anyone else? I didn't have a look at the code yet, but if the author could help, that would... help!

jpflori commented 10 years ago
comment:15

Looking at the failing example in src/sage/schemes/plane_curves/constructor.py, which is a call to genus going through Singular, it seems that there are three creations of SingularFunction objects:

vbraun commented 10 years ago
comment:16

Wasn't me, but if there were any changes to the genus function then hopefully they fix #15477

jpflori commented 10 years ago
comment:17

When the normal lib is loaded, currRingHdl is set back to zero. Here is when:

#0  rSetHdl (h=0x0) at ipshell.cc:4592
#1  0x00003fffa487ce04 in iiPStart (pn=<optimized out>, v=<optimized out>) at iplib.cc:456
#2  0x00003fffa487d334 in iiMake_proc (pn=0x3fffa426dd10, pack=0x3fffa42584b8, sl=0x0) at iplib.cc:612
#3  0x00003fffa487f65c in iiRunInit (p=<error reading variable: value has been optimized out>) at iplib.cc:889
#4  iiLoadLIB (fp=0x0, libnamebuf=0x3fffffffa280 "/home/jpflori/sage.git/local/share/singular/modstd.lib", newlib=0x3fffa4270280 "modstd.lib", 
    pl=<optimized out>, autoexport=<optimized out>, tellerror=<optimized out>) at iplib.cc:941
#5  0x00003fffa487f840 in iiLibCmd (newlib=0x3fffa4270280 "modstd.lib", autoexport=<optimized out>, tellerror=<optimized out>, force=<optimized out>)
    at iplib.cc:842
#6  0x00003fffa487f3f8 in iiLoadLIB (fp=0x0, libnamebuf=0x3fffffffa4a0 "/home/jpflori/sage.git/local/share/singular/locnormal.lib", newlib=
    0x3fffa42701a0 "locnormal.lib", pl=<optimized out>, autoexport=<optimized out>, tellerror=<optimized out>) at iplib.cc:950
#7  0x00003fffa487f840 in iiLibCmd (newlib=0x3fffa42701a0 "locnormal.lib", autoexport=<optimized out>, tellerror=<optimized out>, 
    force=<optimized out>) at iplib.cc:842
#8  0x00003fffa487f3f8 in iiLoadLIB (fp=0x0, libnamebuf=0x3fffffffa6c0 "/home/jpflori/sage.git/local/share/singular/reesclos.lib", newlib=
    0x3fffa4254b20 "reesclos.lib", pl=<optimized out>, autoexport=<optimized out>, tellerror=<optimized out>) at iplib.cc:950
#9  0x00003fffa487f840 in iiLibCmd (newlib=0x3fffa4254b20 "reesclos.lib", autoexport=<optimized out>, tellerror=<optimized out>, 
    force=<optimized out>) at iplib.cc:842
#10 0x00003fffa487f3f8 in iiLoadLIB (fp=0x0, libnamebuf=0x3fffffffa8e0 "/home/jpflori/sage.git/local/share/singular/normal.lib", newlib=
    0x3fffa4254a60 "normal.lib", pl=<optimized out>, autoexport=<optimized out>, tellerror=<optimized out>) at iplib.cc:950
#11 0x00003fffa487f840 in iiLibCmd (newlib=0x3fffa4254a60 "normal.lib", autoexport=<optimized out>, tellerror=<optimized out>, force=<optimized out>)
    at iplib.cc:842
#12 0x00003fffa4082cd8 in __pyx_pf_4sage_4libs_8singular_8function_10lib (__pyx_self=<optimized out>, __pyx_v_name='normal.lib')
    at build/cythonized/sage/libs/singular/function.cpp:16752
#13 __pyx_pw_4sage_4libs_8singular_8function_11lib (__pyx_self=<optimized out>, __pyx_v_name='normal.lib')
    at build/cythonized/sage/libs/singular/function.cpp:16623
#14 0x00003fffb7ecbfb4 in call_function (oparg=<optimized out>, pp_stack=0x3fffffffab28) at Python/ceval.c:4021
#15 PyEval_EvalFrameEx (f=
    Frame 0x3fff9e5b0b60, for file /home/jpflori/sage.git/local/lib/python2.7/site-packages/sage/libs/singular/function_factory.py, line 44, in __getattr__ (self=<type unknown at remote 0x3fffa40dee90>, name='normal'), throwflag=<optimized out>) at Python/ceval.c:2679
#16 0x00003fffb7ecd7e0 in PyEval_EvalCodeEx (co=<code at remote 0x3fffa40f9430>, globals=<optimized out>, locals=<optimized out>, 
    args=<optimized out>, argcount=<optimized out>, kws=<optimized out>, kwcount=<optimized out>, defs=0x0, defcount=0, closure=0x0)
    at Python/ceval.c:3265
#17 0x00003fffb7e1d5d4 in function_call (func=<function at remote 0x3fffa40fc2a8>, arg=(<type unknown at remote 0x3fffa40dee90>, 'normal__lib'), kw=
    0x0) at Objects/funcobject.c:526
jpflori commented 10 years ago
comment:18

And this is the new piece of code in 3-1-7 in iplib.cc around line 453:

+    if ((currRing!=NULL) &&
+      ((currRingHdl==NULL)||(IDRING(currRingHdl)!=currRing)
+       ||(IDLEV(currRingHdl)>=myynest-1)))
+    {
+      rSetHdl(rFindHdl(currRing,NULL));
+      iiLocalRing[myynest-1]=NULL;
+    }

In fact the whole block (not only the one included above) used to be around line 556 in 3-1-6.

jpflori commented 10 years ago
comment:19

In that very piece of code, Singular 4-0-1 and 3-1-7 look similar, so we might face this issue even if going for 4-0-1 directly...

jpflori commented 10 years ago
comment:20

Groumpf, I don't remmeber if anyone from the Singualr team has an account here on trac...

ea1d0bf8-c27a-4548-8cb7-de0b1d02441a commented 10 years ago
comment:21

Groumpf, I don't remmeber if anyone from the Singualr team has an account here on trac...

I do, you are welcome to ask questions if you have any.

Jakob

jpflori commented 10 years ago
comment:22

The following segfaults with Singular 3-1-7.

sage: from sage.libs.singular import ff
sage: ff.modstd__lib
<sage.libs.singular.function_factory.SingularFunctionFactory object at 0x3fff9e6c5450>
sage: ff.modstd__lib
<sage.libs.singular.function_factory.SingularFunctionFactory object at 0x3fff9e6c5590>
sage: ff.modstd__lib
<sage.libs.singular.function_factory.SingularFunctionFactory object at 0x3fff9e6c5690>
sage: from sage.libs.singular import ff
sage: ff.modstd__lib
<sage.libs.singular.function_factory.SingularFunctionFactory object at 0x3fff9e695450>
sage: ff.modstd__lib
// ** redefining root my_awesome_sage_ring **
Program received signal SIGSEGV, Segmentation fault.
nSetChar (r=0x3fffa42365f0) at numbers.cc:205

with backtrace:

#0  nSetChar (r=0x3fffa42365f0) at numbers.cc:205
#1  0x00003fffa49aef34 in rChangeCurrRing (r=<error reading variable: value has been optimized out>) at ring.cc:112
#2  0x00003fffa4864b54 in killlocals (v=<optimized out>) at ipshell.cc:386
#3  0x00003fffa484ce24 in iiPStart (pn=<optimized out>, v=<optimized out>) at iplib.cc:499
#4  0x00003fffa484d334 in iiMake_proc (pn=0x3fffa424fc80, pack=0x3fffa4228260, sl=0x0) at iplib.cc:612
#5  0x00003fffa484f65c in iiRunInit (p=<error reading variable: value has been optimized out>) at iplib.cc:889
#6  iiLoadLIB (fp=0x0, libnamebuf=0x3fffffffb980 "/home/jpflori/sage.git/local/share/singular/modstd.lib", newlib=0x3fffa42521c0 "modstd.lib", 
    pl=<optimized out>, autoexport=<optimized out>, tellerror=<optimized out>) at iplib.cc:941
#7  0x00003fffa484f840 in iiLibCmd (newlib=0x3fffa42521c0 "modstd.lib", autoexport=<optimized out>, tellerror=<optimized out>, force=<optimized out>)
    at iplib.cc:842
#8  0x00003fffa4052cd8 in __pyx_pf_4sage_4libs_8singular_8function_10lib (__pyx_self=<optimized out>, __pyx_v_name='modstd.lib')
    at build/cythonized/sage/libs/singular/function.cpp:16752
...
jpflori commented 10 years ago
comment:23

No issue using ./sage -singular:

> option(loadLib);
> LIB "modstd.lib";
// ** loaded /home/jpflori/sage.git/local/share/singular/modstd.lib (3-1-7-0,May_2014)
// ** loaded /home/jpflori/sage.git/local/share/singular/parallel.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/tasks.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/resources.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/modular.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/poly.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/ring.lib (4.0.0.0,Jun_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/primdec.lib (4.0.0.0,Jun_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/absfact.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/triang.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/matrix.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/nctools.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/random.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/elim.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/inout.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/general.lib (3-1-7-0,Sep_2013)
> LIB "modstd.lib";
// ** redefining modStd **
...
jpflori commented 10 years ago
comment:25

This looks related... #13447 comment:63

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

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

32f3be6Avoid redefining Singular mock ring.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Changed commit from cdedfc6 to 32f3be6

jpflori commented 10 years ago
comment:27

Fix extracted from the discussion at #13447.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Changed commit from 32f3be6 to e2d2920

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

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

e2d2920Remove debug stuff.
jpflori commented 10 years ago
comment:29

There is still one doctest to fix.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Changed commit from e2d2920 to cde2930

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

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

cde2930Update doctest for Singular new behavior.
nbruin commented 10 years ago
comment:32

Replying to @jpflori:

I don't really remember who committed the "my_awesome_ring" code.

It looks like it was there from the start: #6628 introduced this in 2009. It also looks like you've resolved your issue with it already.

jpflori commented 10 years ago
comment:33

I hope so, I just picked up a minimal change from #13447.

vbraun commented 9 years ago
comment:34

lgtm

vbraun commented 9 years ago

Reviewer: Volker Braun

vbraun commented 9 years ago
comment:35

A build with SAGE_DEBUG=yes fails in:

sage -t --long src/sage/schemes/plane_curves/curve.py
**********************************************************************
File "src/sage/schemes/plane_curves/curve.py", line 122, in sage.schemes.plane_curves.curve.Curve_generic.geometric_genus
Failed example:
    C.geometric_genus()
Expected:
          3
Got:
    <BLANKLINE>
    // ***dError: T[3] pLength error: has 1, specified to have 2 occured at: 
    <BLANKLINE>
    // ***dError: T[3] pLength error: has 1, specified to have 2 occured at: 
    3

there are more failures, always in geometric genus. If somebody can extract a singular-only testcase from that and report it on libsingular-devel then Hans is usually quick to patch that...

vbraun commented 9 years ago
comment:36

Log: http://build.sagedev.org/release/builders/%20%20fast%20Volker%20Desktop%20%28Fedora%2021%20x86_64%29%20incremental/builds/43/steps/shell_4/logs/stdio

jpflori commented 9 years ago
comment:37

Ok it seems to be upstream and not because of our broken reference handling. I'm just discovering singular syntax and might be wrong, but I get the following:

$ ./sage -singular
                     SINGULAR                                 /  Development
 A Computer Algebra System for Polynomial Computations       /   version 3-1-7
                                                           0<
 by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann     \   Aug 2013
FB Mathematik der Universitaet, D-67653 Kaiserslautern        \
> LIB "normal.lib";
// ** loaded /home/jpflori/sage.git/local/share/singular/normal.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/algebra.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/matrix.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/nctools.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/random.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/reesclos.lib (3-1-7-1,Jan_2014)
// ** loaded /home/jpflori/sage.git/local/share/singular/locnormal.lib (3-1-7-1,Jan_2014)
// ** loaded /home/jpflori/sage.git/local/share/singular/modstd.lib (3-1-7-0,May_2014)
// ** loaded /home/jpflori/sage.git/local/share/singular/parallel.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/tasks.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/resources.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/modular.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/hnoether.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/primitiv.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/ring.lib (4.0.0.0,Jun_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/inout.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/presolve.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/elim.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/primdec.lib (4.0.0.0,Jun_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/absfact.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/triang.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/sing.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/poly.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/general.lib (3-1-7-0,Sep_2013)
> ring R=5,(x,y,z),dp;
// ** Could not open dynamic library: /home/jpflori/sage.git/local/bin/p_Procs_FieldIndep.sog
// ** Error message from system: /home/jpflori/sage.git/local/bin/p_Procs_FieldIndep.sog: cannot open shared object file: No such file or directory
// ** Singular will work properly, but much slower.
// ** See the INSTALL section in the Singular manual for details.
> ideal I = x^10 + y^7*z^3 + z^10;
> genus(I);

// ***dError: T[3] pLength error: has 1, specified to have 2 occured at: 

// ***dError: T[3] pLength error: has 1, specified to have 2 occured at: 
3

Also note the Singular's warning, so it seems our way of launching singular might not be the best.

vbraun commented 9 years ago
comment:38

Looks good, can you post to libsingular-devel?

jpflori commented 9 years ago
comment:39

I'm not subscribed there and I just applied. In the meantime I posted on the forum on their homepage:

jpflori commented 9 years ago
comment:40

Great a fix was posted upstream and a 3-1-7p1 version released. I'm in the process of testing it.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

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

badc6f7Merge remote-tracking branch 'trac/develop' into ticket/17184
ac60a76Update Singular to 3-1-7p1.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from cde2930 to ac60a76

jpflori commented 9 years ago

Description changed:

--- 
+++ 
@@ -1,2 +1,2 @@
-Singular 3-1-7 repackaged (see spkg-src):
+Singular 3-1-7p1 repackaged (see spkg-src):
 * http://boxen.math.washington.edu/home/jpflori/upstream/singular-3.1.7.tar.bz2
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from ac60a76 to 9b3b933

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

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

9b3b933Use actual upstream version number for Singular.