Opened 3 years ago

Last modified 2 weeks ago

#54050 reopened enhancement

ImageMagick: variant to enable or disable multiprocessing with openmp

Reported by: kencu (Ken) Owned by: ryandesign (Ryan Schmidt)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: ImageMagick


Imagemagick has the capacity for multiprocessing, which can be desirable in some, but apparently not all, circumstances.

Multiprocessing with OpenMP is automatically compiled into imagemagic, without specifically being requested, if the compiler supports this. As of this writing, the latest Xcode 8.3.2 does not appear to support OpenMP.

$ /usr/bin/clang --version
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.5.0
Thread model: posix

during configuration of imagemagick:

checking for /usr/bin/clang++ option to support OpenMP... unsupported

As usual, it's not easy to figure out exactly what version of clang/llvm this corresponds to. Perhaps it is indeed a new enough version, but OpenMP support is not compiled into Apple's XCode version of clang?

I confirm that both macports-clang-3.8.1 and macports-clang-3.9.1 automatically enable and build in OpenMP support during the build of imagemagick.

To disable multiprocessing during a build with these compilers, you must specifically pass the flag --disable-openmp.

To achieve granular control over multiprocessing, it might desirable to have the default configure flags include --disable-openmp, and then have a specific openmp variant that either deletes or replaces this flag with --enable-openmp (both would accomplish the same end result, one is more obvious in it's intent though), and then passes in a requirement for clang-3.8.1 or newer.

A brief read through the OpenMP clang info suggests that the OpenMP support is becoming more robust as clang versions progress, so perhaps the best idea would be to require the newest clang available to get the best OpenMP support.

It is to be noted that even if OpenMP support is compiled in to Imagemagick, it appears that it can be controlled and essentially disabled by adjusting certain environment variables.

Change History (10)

comment:1 Changed 3 years ago by ryandesign (Ryan Schmidt)

Cc: ryandesign removed
Owner: set to ryandesign
Port: ImageMagick added; imagemagick removed
Status: newassigned
Summary: imagemagick - logic to enable or disable multiprocessing with openmpImageMagick: variant to enable or disable multiprocessing with openmp

I agree with all this.

Note that there are multiple preexisting open tickets about ImageMagick OpenMP support.

comment:2 Changed 3 years ago by kencu (Ken)

And I learn another something new -- the port search field in the ticket box is case sensitive.... so my search for tickets against 'imagemagick' turned up only one ticket about a different issue, but 'ImageMagick' turns up a number of previous tickets, as you mention....

comment:3 in reply to:  2 Changed 3 years ago by ryandesign (Ryan Schmidt)

Replying to kencu:

the port search field in the ticket box is case sensitive....

That's probably this bug: #52871

comment:5 Changed 3 years ago by kencu (Ken)

Last edited 3 years ago by kencu (Ken) (previous) (diff)

comment:7 Changed 2 years ago by kencu (Ken)

Resolution: wontfix
Status: assignedclosed

we can put this in the cupboard after a year, I think. Those interested can find the ticket or the PR with the fix for their own use.

comment:8 Changed 2 years ago by ryandesign (Ryan Schmidt)

Resolution: wontfix
Status: closedreopened

I said in comment:1 that I agree with this ticket, so please don't close it. Closing the ticket will not help anybody find it or work on it. I am merely not taking responsibility for merging these changes at this time. There were some problems with the PR, including the use of compiler.whitelist instead of compiler.blacklist. If you or anybody else would like to fix up the PR and merge it and be responsible for any issues that arise, please do so.

comment:9 Changed 2 years ago by kencu (Ken)

OK. I'll admit I thought it was not going to meet the cut. But given this, I'm prepared to make whatever changes we need to do to get this done. I do believe that having a MP version of this port would be useful to all of us with multiprocessor Macs (which is pretty much everyone these days). Let's do what it takes to get this over the finish line.

comment:10 Changed 2 weeks ago by kencu (Ken)

Last edited 2 weeks ago by kencu (Ken) (previous) (diff)
Note: See TracTickets for help on using tickets.