I have use the @parallel and @fork decorators (as documented at http://doc.sagemath.org/html/en/reference/parallel/sage/parallel/decorate.html) also using the timeout parameter. Has anyone successfully managed to do the following:
Suppose you have two functions f() and g() which take the same input and produce the same output, using different methods. Sometimes one is faster, sometimes the other, and I have no idea which inputs f() works faster than g() or vice versa. So what I would like to do is set them both going in parallel, and whenever one finished kill the other. I think I know how to do everything except the "kill the other" part. Can anyone help? As a test case (not the real one!) think of def f(N): return N.factor(algorithm='pari') deg g(N): return N.factor(algorithm='ecm') sage: @parallel ....: def apply(func): ....: return func(29038109543453453498320938204932840238210981) ....: sage: for res in apply([f,g]): print res; break (((<function f at 0x7fb0537d6050>,), {}), 3^2 * 12248508919 * 263416276811813669131602539468011) sage: f <function f at 0x7fb0537d6050> sage: g <function g at 0x7fb0522551b8> The first bit of the output shows that it is f which returns the result. But I don't know if g stops working because of the 'break' -- does it? John Cremona -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.