Threading Question

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Threading Question

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Threading Question

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Threading Question

Post by fmw42 »

But are both limited to one command line within a script?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Threading Question

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply