How to parallelize animations

I have been using the @animate macro in the Plots.jl package. I have noticed that the animation is always built using one thread. So for example, in the following toy example :

N=1000;
anim = @animate for t in 1:N
        x = [ 0;cos(n)]; y = [ 0;sin(n) ];
        plt = plot( x, y )
    end
    gif( anim, "t.gif", fps=10);

The animation is created one frame at a time and put together. I have checked that it used only processor although 36 are available.

julia> Threads.nthreads()
36

Is it possible to parallelize this ? For example, if there are 4 threads, one could parallely compute the frames for n in the ranges 1:250, 251:500, 501:750 and 751:1000, and finally append them end to end.

2 Likes