multiprocessing module and matplotlib.pyplot/PdfPages
Paulo da Silva
p_s_d_a_s_i_l_v_a_ns at netcabo.pt
Tue Apr 21 19:12:53 CEST 2015
On 21-04-2015 16:58, Chris Angelico wrote:
> On Wed, Apr 22, 2015 at 1:53 AM, Paulo da Silva
> <p_s_d_a_s_i_l_v_a_ns at netcabo.pt> wrote:
>> Yes, I have 8 cores and the graphics' processes calculation are all
>> independent. The problem I have is that if there is any way to generate
>> independent figures in matplotlib. The logic seems to be build the
>> graphic and save it. I was trying to know if there is any way to build
>> graphic objects that can be built in parallel and, at the end, saved by
>> the controller task.
> The very simplest way would be to simply spawn entirely separate
> Python processes. Each one would import matplotlib independently, do
> its work, and save its figure. Would that work for what you're trying
> to do?
Yes. fork will do that. I have just looked at it and it is the same as
unix fork (module os). I am thinking of launching several forks that
will produce .png images and at the end I'll call "convert" program to
place those .png files into a pdf book. A poor solution but much faster.
Unfortunately matplotlib seems not to be object oriented!
More information about the Python-list