Page 1 of 1

MAGICK_THREAD_LIMIT Not Working

Posted: 2015-04-16T09:57:48-07:00
by mhallen
Hello,'

The identify process has been consuming too much CPU on our servers and I am trying to limit the number of threads it uses. So far I've tried putting MAGICK_THREAD_LIMIT=1 into the environment and adding <configure name="MAGICK_THREAD_LIMIT" value="1"/> into configure,xml, neither of which is working for me. Any insight would be greatly appreciated. We're running 2.6.32-431.el6.x86_64 on HP DL380 Gen8 servers.

Version: ImageMagick 6.5.4-7 2012-04-10 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

Thanks much,
Mark

Re: MAGICK_THREAD_LIMIT Not Working

Posted: 2015-04-16T12:49:32-07:00
by fmw42
try either

Code: Select all

MAGICK_THREAD_LIMIT=1 convert ....
or

Code: Select all

convert -limit thread 1 ....
Do they work?

You can also recompile IM using

Code: Select all

./configure --disable-openmp ...

Re: MAGICK_THREAD_LIMIT Not Working

Posted: 2018-10-03T05:07:17-07:00
by shashwat
Hello.

(Apologies for rekindling an old thread. Since OP didn't close/respond to the suggested answer, I reckoned I could just continue the discussion. If this is against forum rules, please let me know and I will create a new thread.)

I am facing a problem very similar to the one described by OP. I was wondering how OP addressed the issue.

So far, I have tried both of the suggested solutions i.e.

1. Setting the environment variable.
The modified command looks as below.
"MAGICK_THREAD_LIMIT=1; identify -define identify:locate=maximum -define identify:limit=1 p.tif".

2. Specifying number of threads explicitly.
This looks as shown below.
"identify -limit thread 1 -define identify:locate=maximum -define identify:limit=1 p.tif".

Neither of them seem to have any impact. CPU usage for the "identify" process is as high as 2100%.

I suspect some imagemagick operations override user specified thread limits and default to using all available cores. Is that so?

Thank You

Re: MAGICK_THREAD_LIMIT Not Working

Posted: 2018-10-03T05:58:01-07:00
by snibgo
The limits work fine for me, on various versions of IM on Windows 8.1.

Please, you must tell us the version of IM, and the platform. And tell us what command you are using.

The thread limit applies to IM only, not to any delegate programs. For example, if you are reading a PDF file, then Ghostscript will use as many threads as it wants.

Re: MAGICK_THREAD_LIMIT Not Working

Posted: 2018-10-03T10:10:36-07:00
by shashwat
I am using IM 6.8.9 Q16.
The OS is OpenSuse 11.3

Here's the command I run.

Code: Select all

identify -limit thread 1 -define identify:locate=maximum -define identify:limit=1 tmp.mpc
For the sake of completeness, the said image file (tmp.mpc) is a spectrum image generated after fft of another image (Lena).