Unable to parallelize pdf -> png conversion
Posted: 2019-06-25T09:27:15-07:00
Hi,
I have the following problem:
I am trying to speed up single page conversions from a pdf to a png image by starting several magick processes in parallel, one for each CPU core I have available on my machine.
I am passing the pdf document as stdin (with a page number) and reading the stdout of the magick process to retrieve a specific page.
Basically I am running something like the following in parallel:
The pdf that I pipe in is the same for all calls.
This works all fine and well, but I don't see a speed up or a any additional cpu load - just as if I had executed them one after the other.
That's strange, because I've successfully achieved speedups (and of course higher cpu load) for rotating png images by invoking magick in that way using:
in parallel.
As this approach works fine for rotation, I don't think it's my code - so I was wondering if there could be something peculiar about pdfs - maybe magick takes a global lock instead of an application wide lock or something like that?!
I tried to look up the code in github but my crappy c++ skills failed me.
Does somebody have an idea?
Thanks in advance!
I am running on Win10 x64 and using the magick commandline with the following version:
Take care,
Martin
I have the following problem:
I am trying to speed up single page conversions from a pdf to a png image by starting several magick processes in parallel, one for each CPU core I have available on my machine.
I am passing the pdf document as stdin (with a page number) and reading the stdout of the magick process to retrieve a specific page.
Basically I am running something like the following in parallel:
Code: Select all
magick -density 300 -[0] png:-
magick -density 300 -[5] png:-
magick -density 300 -[15] png:-
This works all fine and well, but I don't see a speed up or a any additional cpu load - just as if I had executed them one after the other.
That's strange, because I've successfully achieved speedups (and of course higher cpu load) for rotating png images by invoking magick in that way using:
Code: Select all
magick - -rotate 90 -
As this approach works fine for rotation, I don't think it's my code - so I was wondering if there could be something peculiar about pdfs - maybe magick takes a global lock instead of an application wide lock or something like that?!
I tried to look up the code in github but my crappy c++ skills failed me.
Does somebody have an idea?
Thanks in advance!
I am running on Win10 x64 and using the magick commandline with the following version:
Code: Select all
Version: ImageMagick 7.0.7-6 Q16 x64 2017-10-04 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
Martin