enable 0r disable OpenMP

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Nik
Posts: 37
Joined: 2009-09-16T03:54:58-07:00
Authentication code: 8675309

enable 0r disable OpenMP

Post by Nik »

Hi there,

I recently installed imagemagick 6.8.6-6 using macports, on a mac running mountain lion 10.8.4. After running a few tests I noticed that 'convert' was only using 1 of the 8 threads available. I found a post on the imagemagick forum about OpenMP not being installed when installing IM using macports on Mountain Lion after running convert --version I could see OpenMP was not enabled. I then came across a mac installer http://cactuslab.com/imagemagick/ for IM and installed IM using the package. After installation I could see that OpenMP was installed using the package. After running a few test I noticed that the macports installed version was running faster on 1 thread than the version of IM using 8 threads!!!! Would you happen to know why this might be or how I can make IM have optimum performance?

Is there an easy way of enabling or disabling OpenMP without having to reinstall?

Many Thanks,
Nik
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: enable 0r disable OpenMP

Post by fmw42 »

Last edited by fmw42 on 2013-08-28T12:00:55-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: enable 0r disable OpenMP

Post by snibgo »

I know nothing about Mac or threads, but "-limit threads 1" might do what you want. See references to "thread" on http://www.imagemagick.org/script/comma ... ptions.php
snibgo's IM pages: im.snibgo.com
Nik
Posts: 37
Joined: 2009-09-16T03:54:58-07:00
Authentication code: 8675309

Re: enable 0r disable OpenMP

Post by Nik »

Thanks for the tips guys, I will take a look at these properly tomorrow and try to implement. But why would a convert command that's using 8 threads run slower than the command just using 1 thread?

Thanks,
Nik
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: enable 0r disable OpenMP

Post by fmw42 »

Nik wrote:Thanks for the tips guys, I will take a look at these properly tomorrow and try to implement. But why would a convert command that's using 8 threads run slower than the command just using 1 thread?

Thanks,
Nik

Some unix platforms have been known to have problems with multi-threading using OpenMP. The IM developers would have to let you know more. But is this the same platform with all the same delegate libraries and the same version of IM?

Personally, I have not had this problem on my dual-core Mac Mini running OSX Snow Leopard.

But I also run IM differently that from MacPorts. See viewtopic.php?f=1&t=21502&p=88202&hilit ... rts#p88202 But in this configuration I have OpenMP disabled, but one can easily remove --disable-openmp
Nik
Posts: 37
Joined: 2009-09-16T03:54:58-07:00
Authentication code: 8675309

Re: enable 0r disable OpenMP

Post by Nik »

Hi,

like you I have IM installed on a mac running Snow leopard that has 2 quad cores and convert makes use of all 8 threads very efficiently. Can you answer why, when I install the same version of IM using macports on a mac running mountain Lion it doesn't install OpenMP like it does on the Snow Leopard machine and why, if I get a version of IM installed that does include OpenMP it runs a lot slower when making use of all 8 threads? Sorry to ask so many questions and if there's a better place for me to direct my questions please let me know.

I also have the latest version of IM installed on a machine running CentOS which did install OpenMP. The machine also seems to use all 8 threads efficiently like my Snow Leopard version. Could it just be an issue with multi threading in Mountain Lion?

When purchasing a machine to run IM would you say that it's better to buy a machine that's got the fastest processor possible rather than the amount of processors? Should I also invest in solid state drives? Does the amount of ram need to be considered also?

Many, Many thanks for taking the time to read and your thoughts,
Nik
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: enable 0r disable OpenMP

Post by holden »

When purchasing a machine to run IM would you say that it's better to buy a machine that's got the fastest processor possible rather than the amount of processors? Should I also invest in solid state drives? Does the amount of ram need to be considered also?
Yes :D

To me the only thing the IM project is not focusing on performance-wise is OpenCL/Cuda. RAM really depends on what size images you are processing- you don't want to start tapping into HD swap, but IMO 16GB is a good low standard. SSDs will improve speed also due to writing faster. Processors I'm not too sure about, but if you skimp on the gfx card you can upgrade the cpu. I'm sure the devs have more solid input though...
Nik
Posts: 37
Joined: 2009-09-16T03:54:58-07:00
Authentication code: 8675309

Re: enable 0r disable OpenMP

Post by Nik »

Thanks for your thoughts Holden,

Nik :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: enable 0r disable OpenMP

Post by fmw42 »

holden wrote:To me the only thing the IM project is not focusing on performance-wise is OpenCL/Cuda.
More functions are being implemented with OpenCL right now. I do not know which ones. see viewtopic.php?f=2&t=23263&p=100918&hilit=OpenCl#p100918
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: enable 0r disable OpenMP

Post by fmw42 »

[quote="NiK']like you I have IM installed on a mac running Snow leopard that has 2 quad cores and convert makes use of all 8 threads very efficiently. Can you answer why, when I install the same version of IM using macports on a mac running mountain Lion it doesn't install OpenMP like it does on the Snow Leopard machine and why, if I get a version of IM installed that does include OpenMP it runs a lot slower when making use of all 8 threads? Sorry to ask so many questions and if there's a better place for me to direct my questions please let me know.

Could it just be an issue with multi threading in Mountain Lion?[/quote]

I would post this on the Developers forum or Bugs forum to get the attention of the IM developer. I believe that he has IM running on Mountain Lion.

Perhaps it is a bad release from MacPorts.

Have you tried installing all your delegates via MacPorts and then Install IM from source as I did in one of the links I sent above?
Nik
Posts: 37
Joined: 2009-09-16T03:54:58-07:00
Authentication code: 8675309

Re: enable 0r disable OpenMP

Post by Nik »

Hi,

yes I did follow your previous post and installed the delegates using macports and then installed IM using configure. When I installed it this way OpenMP was installed and this is how I was able to do the timing difference between IM installed using macports (/opt/local/bin) running only 1 thread and the version manually installed that used all 8 threads.

I will add a post on the developers site.

Thanks again,
Nik
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: enable 0r disable OpenMP

Post by agriz »

So, Do you guys recommend to enable OpenMP or disable OpenMP?
In which case we should do the reverse?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: enable 0r disable OpenMP

Post by fmw42 »

agriz wrote:So, Do you guys recommend to enable OpenMP or disable OpenMP?
In which case we should do the reverse?
You will have to test your own OS to know which is best. It is typically better to run with OpenMP enabled. But some systems do work well with OpenMP.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: enable 0r disable OpenMP

Post by snibgo »

On a Windows 7 laptop with two cores, IM with OpenMP, I find that simple converts taking under a second work faster with threads limited to 1. Longer jobs run faster without limiting threads.
snibgo's IM pages: im.snibgo.com
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: enable 0r disable OpenMP

Post by magick »

We have a thread tuning parameter such that an image needs to be a certain size before the algorithm is threaded. We'll adjust this parameter so that larger images are required before an algorithm is threaded. This should fix the Windows issue where some algorithms run faster when not threaded.
Post Reply