multiprocessing module and matplotlib.pyplot/PdfPages

Paulo da Silva p_s_d_a_s_i_l_v_a_ns at
Wed Apr 22 16:37:38 CEST 2015

On 21-04-2015 03:14, 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?
> Thanks for any help/comments.

After all kind answers ...

I tried os.fork.
Besides some problems with a also produced csv file, which I solved
using a pipe and making the parent task to do all the writes, things are
working :-)

Using 16 tasks (my cpu supports 8) and 70 graphics elapsed time passed
from 1m40s to 25s plus ~5s to convert to a pdf book. Not bad :-) It
could be better however. BTW, using 8 tasks takes 30s.

For more graphics ... the result should be much worser. At the end of
the 70 graphics the cpu already became to heat and the clock freq reduced.

Thanks to all who responded.

More information about the Python-list mailing list