ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 06 Jun 2012 08:50:11 +0200how can I use parralelism in SAGE?https://ask.sagemath.org/question/9032/how-can-i-use-parralelism-in-sage/Hello
I will generete multiple elliptic curves with size between 6 and 16 digits and to earn time I want to use Parralelism.
Thank you for you answer Tue, 05 Jun 2012 07:54:33 +0200https://ask.sagemath.org/question/9032/how-can-i-use-parralelism-in-sage/Comment by John Palmieri for <p>Hello
I will generete multiple elliptic curves with size between 6 and 16 digits and to earn time I want to use Parralelism.</p>
<p>Thank you for you answer </p>
https://ask.sagemath.org/question/9032/how-can-i-use-parralelism-in-sage/?comment=19687#post-id-19687Look at the "parallel computing" section of the reference manual: http://sagemath.org/doc/reference/parallel.html. Does that help?Tue, 05 Jun 2012 14:59:42 +0200https://ask.sagemath.org/question/9032/how-can-i-use-parralelism-in-sage/?comment=19687#post-id-19687Answer by mmarco for <p>Hello
I will generete multiple elliptic curves with size between 6 and 16 digits and to earn time I want to use Parralelism.</p>
<p>Thank you for you answer </p>
https://ask.sagemath.org/question/9032/how-can-i-use-parralelism-in-sage/?answer=13656#post-id-13656A very simple way to use paralelism is provided by the @parallel decorator.
Just write a function that does what you want,with the decorator at the beginning. Then you can pass it a list of entries, and the output will be an iterator with the answers.
Example:
sage: @parallel
....: def f(a):
....: return a^2
....:
sage: r=f([1,2,3,4])
sage: r.next()
(((1,), {}), 1)
sage: r.next()
(((2,), {}), 4)
sage: r.next()
(((3,), {}), 9)
sage: r.next()
(((4,), {}), 16)
sage: r.next()
---------------------------------------------------------------------------
StopIteration Traceback (most recent call last)
Wed, 06 Jun 2012 08:50:11 +0200https://ask.sagemath.org/question/9032/how-can-i-use-parralelism-in-sage/?answer=13656#post-id-13656