Ask Your Question

Revision history [back]

Creating plots in parallel

Ok, even though my last question about @parallel was foolish, here is another one. I want to create a simple animation that consists of many plots. It takes a minute or two on my computer to produce. But it would be nice if I could harness the idle CPU's I have and create the frames for the animation in parellel. I thought this would be easy like this:

x = var('x')    
FRAMES = 10

@parallel
def frame(i):
    return plot(sin(i*x), (x, 0, pi))

P = [ p[1] for p in frame(range(1,FRAMES+1)) ]
#A = animate(blah, blah, ...)

and what I get back (in the Sage notebook) is:

invalid load key, 'x'.
Killing any remaining workers...

Any idea what is going wrong here?