[sage-devel] Re: Using several algorithms in parallel

2011-11-05 Thread Maarten Derickx
Well the best thing would be if you didn't import paralel in multi_polynomial_ideal.py. You should first write some decorators like leif mentioned based on the trick that Tom showed so it will become easy to make functions have multiple implementations. So that something like the following woul

[sage-devel] Re: Using several algorithms in parallel

2011-11-05 Thread mmarco
So, the solution is to move the parallel importation to somewhere else? Which would be the apropriate place? On 5 nov, 14:28, Maarten Derickx wrote: > The problem is that by putting > > from sage.parallel.all import parallel > > in sage/rings/polynomial/multi_polynomial_ideal.py you changed the i

[sage-devel] Re: Using several algorithms in parallel

2011-11-05 Thread Maarten Derickx
The problem is that by putting from sage.parallel.all import parallel in sage/rings/polynomial/multi_polynomial_ideal.py you changed the import order of the sage library causing the import to fail because now you try to import QuotientRing from the not yet completely initialized quotient_ring

[sage-devel] Re: Using several algorithms in parallel

2011-11-05 Thread mmarco
>From a clean sage braaanch, i put the line from sage.parallel.all import parallel in sage/rings/polynomial/multi_polynomial_ideal.py and after rebuilding i get the following output when starting up sage: -- | Sage Version 4.7.2

Re: [sage-devel] Re: Using several algorithms in parallel

2011-11-04 Thread William Stein
On Fri, Nov 4, 2011 at 11:31 AM, mmarco wrote: > Thanks for the example, Tom. I have tried to implement the > algorithm='parallel' in the primary decomposition, but it doesn't > recognize the parallel function. If i try to import it, it gives an > error message at startup. > > I have tried with >

[sage-devel] Re: Using several algorithms in parallel

2011-11-04 Thread mmarco
Thanks for the example, Tom. I have tried to implement the algorithm='parallel' in the primary decomposition, but it doesn't recognize the parallel function. If i try to import it, it gives an error message at startup. I have tried with import sage.parallel from sage.parallel import all But both

[sage-devel] Re: Using several algorithms in parallel

2011-11-04 Thread Maarten Derickx
Well to be technically correct it is not the garbage collector but the reference counting in python (the garbage collector is mainly for cleaning up unreachable cyclic stuff and is only run once in the so many times, while destruction after a reference count dropped to zero is done immediate ev

[sage-devel] Re: Using several algorithms in parallel

2011-11-04 Thread leif
On 4 Nov., 07:41, Tom Boothby wrote: > The @parallel instance kills its still-running children once it drops > out of scope.  This happens immediately after the return statement is > executed.  Since I merely call .next() on the generator, the first one > to finish gets picked out in milliseconds,

Re: [sage-devel] Re: Using several algorithms in parallel

2011-11-03 Thread Tom Boothby
The @parallel instance kills its still-running children once it drops out of scope. This happens immediately after the return statement is executed. Since I merely call .next() on the generator, the first one to finish gets picked out in milliseconds, and the remainders are axed almost immediatel

Re: [sage-devel] Re: Using several algorithms in parallel

2011-11-03 Thread Tom Boothby
On Thu, Nov 3, 2011 at 9:28 PM, leif wrote: > On 4 Nov., 02:15, Tom Boothby wrote: >> This is fairly easy to do with @parallel: >> >> def fast(x): >>     return x >> >> def slow(x): >>     sleep(x) >>     return x >> >> def slower(x): >>     sleep(x*x) >>     return x >> >> algorithms = [slower,

[sage-devel] Re: Using several algorithms in parallel

2011-11-03 Thread leif
On 4 Nov., 02:15, Tom Boothby wrote: > This is fairly easy to do with @parallel: > > def fast(x): >     return x > > def slow(x): >     sleep(x) >     return x > > def slower(x): >     sleep(x*x) >     return x > > algorithms = [slower, slow, fast] > > @parallel(len(algorithms)) > def fastest(i,x)

[sage-devel] Re: Using several algorithms in parallel

2011-11-03 Thread mmarco
What i had in mind is something like this: right now you can compute the primary decomposition of an ideal using I.primary_decomposition(algorithm='sy') (default) or I.primary_decomposition(algorithm='gtz') what i propose is to keep this, and add some option like I.primary_decomposition(algorit

[sage-devel] Re: Using several algorithms in parallel

2011-11-03 Thread leif
On 3 Nov., 20:08, Maarten Derickx wrote: > I already wrote some framework wich does this for my personal use. It isn't > up to sage library code quality yet but I can send it to you or upload it > to trac if you make a ticket. One could write some decorator for functions (implementing different s

[sage-devel] Re: Using several algorithms in parallel

2011-11-03 Thread Maarten Derickx
I already wrote some framework wich does this for my personal use. It isn't up to sage library code quality yet but I can send it to you or upload it to trac if you make a ticket. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an emai