On Monday 10 November 2008, Thomas Kahle wrote:
> Dear all,
> I'm curious about performance of Singular computations which are run
> from sage:
>
> I tried the following test:
>
> ---
> cat singulartest.sage
> R = singular.ring(0,'(a,b,c,w,x,y,z)','lp');
> I = singular.ideal('x5-abc3', 'x7-w5a5b5', 'bc3-a7', 'b2a3c5x-yzw2',\
> 'xyz-wz2ab', 'bx-awz9')
> S = I.std()
> Ir = S.radical()
> Sr = Ir.std()
> quit
> ---
>
> VS:
>
> ----
> LIB "primdec.lib";
> ring R = 0,(a,b,c,w,x,y,z),lp;
> ideal I = x5-abc3, x7-w5a5b5, bc3-a7, b2a3c5x-yzw2, xyz-wz2ab, bx-
> awz9;
> ideal s = std(I);
> ideal Ir = radical(s);
> ideal Sr = std(Ir);
> Sr;
> quit;
> ----
>
> The result is
> time /usr/local/sage/local/bin/Singular singulartest.sing
> [...]
> real 0m32.112s
> user 0m31.509s
> sys 0m0.295s
>
> time sage singulartest.sage
> [...]
> real 0m42.653s
> user 0m1.027s
> sys 0m0.262s
>
> Looking at "top" during the computation it seems to me that the
> spawned Singular process is just taking more time to do the
> computation. It does not look like overhead of the python wrapper to
> me.
> Furthermore some experiments showed that the time difference scales
> with the size of the problem.
> Does anybody know what's going on here ? Is the bundled libsingular
> compiled with less optimization ??
Hi there,
You are definitely not using libSingular but the Singular pexpect interface.
libSingular is the C++ interface to a subset of Singular (the kernel).
I can reproduce the discrepancy only to some extend:
Singular
real 0m22.033s
user 0m21.026s
sys 0m0.856s
Sage:
real 0m23.251s
user 0m0.846s
sys 0m0.303s
of this 22.1012639999 is the actual walltime in the computation (without
Sage's startup).
Some overhead is unavoidable because data has to be exchanged between Singular
and Sage. Since the radical command is only available as a Singular script
(rather than in the kernel) I don't see an immediate way around it.
So I guess for now I don't see an easy solution, except maybe:
s = """LIB "primdec.lib";
ring R = 0,(a,b,c,w,x,y,z),lp;
ideal I = x5-abc3, x7-w5a5b5, bc3-a7, b2a3c5x-yzw2, xyz-wz2ab, bx-awz9;
ideal s = std(I);
ideal Ir = radical(s);
ideal Sr = std(Ir);
"""
%time _= singular.eval(s)
CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
Wall time: 22.06 s
singular("Sr") is then what you are looking for.
Cheers,
Martin
--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---