Page 1 of 1

enable 0r disable OpenMP

Posted: 2013-08-28T11:01:07-07:00
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

Re: enable 0r disable OpenMP

Posted: 2013-08-28T11:54:11-07:00
by fmw42

Re: enable 0r disable OpenMP

Posted: 2013-08-28T11:58:49-07:00
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

Re: enable 0r disable OpenMP

Posted: 2013-08-28T14:51:14-07:00
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

Re: enable 0r disable OpenMP

Posted: 2013-08-28T16:26:31-07:00
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

Re: enable 0r disable OpenMP

Posted: 2013-08-29T10:22:05-07:00
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

Re: enable 0r disable OpenMP

Posted: 2013-08-29T10:42:01-07:00
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...

Re: enable 0r disable OpenMP

Posted: 2013-08-29T11:00:27-07:00
by Nik
Thanks for your thoughts Holden,

Nik :)

Re: enable 0r disable OpenMP

Posted: 2013-08-29T11:42:48-07:00
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

Re: enable 0r disable OpenMP

Posted: 2013-08-29T11:47:02-07:00
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?

Re: enable 0r disable OpenMP

Posted: 2013-08-30T02:48:00-07:00
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

Re: enable 0r disable OpenMP

Posted: 2013-08-30T04:39:39-07:00
by agriz
So, Do you guys recommend to enable OpenMP or disable OpenMP?
In which case we should do the reverse?

Re: enable 0r disable OpenMP

Posted: 2013-08-30T10:26:02-07:00
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.

Re: enable 0r disable OpenMP

Posted: 2013-08-30T13:24:26-07:00
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.

Re: enable 0r disable OpenMP

Posted: 2013-08-30T13:37:34-07:00
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.