Page 1 of 1

Threading Question

Posted: 2012-04-13T10:00:03-07:00
by fmw42
I am curious, in a script, if I want just one convert command to use 1 thread, is there any difference between

MAGICK_THREAD_LIMIT=1 convert ....

and

convert -limit thread 1 ....

Is the former limited to that one convert command or does it continue to the rest of the script?

Re: Threading Question

Posted: 2012-04-13T11:18:14-07:00
by magick
There is no difference. Both set the thread resource limit to 1 such that all algorithms in ImageMagick run in a single thread regardless of the number of cores the host supports.

Re: Threading Question

Posted: 2012-04-13T12:09:30-07:00
by fmw42
But are both limited to one command line within a script?

Re: Threading Question

Posted: 2012-04-15T02:32:35-07:00
by anthony
Unless you actually 'export' the MAGICK_THREAD_LIMIT setting then it will only effect the command it is attached to.

That is

Code: Select all

  MAGICK_THREAD_LIMIT=1
  convert ....
will not effect convert

Code: Select all

  MAGICK_THREAD_LIMIT=1 convert ...
  convert ...
will only effect the first convert

While

Code: Select all

  export MAGICK_THREAD_LIMIT=1
  convert ...
or

Code: Select all

MAGICK_THREAD_LIMIT=1
export MAGICK
convert ....
effects every convert command that follows.

Using the option -limit thread 1 will only effect operations that follow it.

However their is no +limit (reset setting) form for this setting. One of the few setting without a + reset form. You can however either give it a 'number' or the string "unlimited". Though if that is the right 'reset' value for 'thread' I have no idea.