multiprocessing module and matplotlib.pyplot/PdfPages

Paulo da Silva p_s_d_a_s_i_l_v_a_ns at
Tue Apr 21 17:53:01 CEST 2015

On 21-04-2015 11:26, Dave Angel wrote:
> On 04/20/2015 10:14 PM, Paulo da Silva wrote:
>> I have program that generates about 100 relatively complex graphics and
>> writes then to a pdf book.
>> It takes a while!
>> Is there any possibility of using multiprocessing to build the graphics
>> and then use several calls to savefig(), i.e. some kind of graphic's
>> objects?

> If the 100 plots are really quite independent, you could also consider
> recruiting time from multiple machines.  As long as the data that needs
> to go between them is not too large, it can pay off big time.
Sorry if I was not clear.

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.

May be using fork instead of multiprocessing may do the job, but I still
didn't look at fork in Python. Being it possible to use multiprocessing
module for this purpose would make things easier.


More information about the Python-list mailing list