Is there ImageMagick multicore support (OpenMP) for OSX?

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
CousinCocaine
Posts: 3
Joined: 2012-09-24T02:24:42-07:00
Authentication code: 67789

Is there ImageMagick multicore support (OpenMP) for OSX?

Post by CousinCocaine »

I am running Mountin Lion OSX 10.8.2 and I am using ImageMagick for manipulating large image files (microscopy images, 30.000*30.000 pixels).

I installed ImageMagick using MacPorts using the following command, no errors occurred:

Code: Select all

$ sudo port install ImageMagick
When I run my image manipulation scripts, only one core is used. Checking for multicore support gives:

Code: Select all

$ identify -version
Version: ImageMagick 6.7.9-0 2012-09-21 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features:  OpenCL
No OpenMP (multi core support) is installed.

My hardware should be fine for multicore image processing:
  • Model Name: Mac mini
    Model Identifier: Macmini5,3
    Processor Name: Intel Core i7
    Processor Speed: 2 GHz
    Number of Processors: 1
    Total Number of Cores: 4
    L2 Cache (per Core): 256 KB
    L3 Cache: 6 MB
    Memory: 16 GB
    Solid state disk: 256 GB
For my analysis I think using multiple cores is essential. I would prefer using OSX as al my other software is on there. Is it possible to stay on OSX and use multiple cores within ImageMagick? Can I build and compile ImageMagic from scratch for OSX, and if so, how? Or do I need to use Linux and go from there?

I would like to know your experts opinion.
Thanks in advance.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Is there ImageMagick multicore support (OpenMP) for OSX?

Post by fmw42 »

Can I build and compile ImageMagic from scratch for OSX, and if so, how? Or do I need to use Linux and go from there?
There may be a way to recompile from MacPorts enabling OpenMP, but I do not know enough about that. Search the archives. I think there was a response to a similar question, though it may have been going the other way.

I am on Mac OSX Snow Leopard. I installed all my delegates from MacPorts and then I install IM from source and link to the delegates in /opt from MacPorts. That way I can recompile whenever there is a new release.

Here is my ./configure command:

./configure CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' \
--enable-delegate-build --enable-shared --disable-static --disable-opencl \
--with-modules --with-quantum-depth=16 --with-gslib --without-wmf \
--disable-silent-rules --disable-dependency-tracking --disable-openmp --without-pango \
--with-gs-font-dir=/opt/local/share/ghostscript/fonts/ --with-lqr


The key is the commands in blue. See
http://www.imagemagick.org/download/www ... .html#unix
http://www.imagemagick.org/script/advan ... lation.php

Note that I have disabled OpenMP, OpenCL and Pango as I am testing some of my scripts and do not want any problems from those components. You should remove them and anything else that is not relevant and/or use the correct command to enable them, e.g. --enable ... or --with ...


Hope that helps
CousinCocaine
Posts: 3
Joined: 2012-09-24T02:24:42-07:00
Authentication code: 67789

Re: Is there ImageMagick multicore support (OpenMP) for OSX?

Post by CousinCocaine »

Hi,

I configure succesfully using your suggested command:

Code: Select all

./configure CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' \
--enable-delegate-build --enable-shared --disable-static \
--with-modules --with-quantum-depth=16 --with-gslib --without-wmf \
--disable-silent-rules --disable-dependency-tracking \
--with-gs-font-dir=/opt/local/share/ghostscript/fonts/ --with-lqr
Make seems to run fine but ends with an error.

Code: Select all

...
  CC       coders/magick_libMagickCore_la-png.lo
  CC       coders/magick_libMagickCore_la-ept.lo
  CC       coders/magick_libMagickCore_la-tiff.lo
  CC       coders/magick_libMagickCore_la-x.lo
  CC       coders/magick_libMagickCore_la-xwd.lo
  CC       filters/magick_libMagickCore_la-analyze.lo
  CCLD     magick/libMagickCore.la
/usr/bin/nm: no name list
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: cannot export hidden symbol _SyncImagePixelCache from magick/.libs/magick_libMagickCore_la-cache.o
ld: warning: cannot export hidden symbol _ResetQuantumState from magick/.libs/magick_libMagickCore_la-quantum.o
copying selected object files to avoid basename conflicts...
/usr/bin/ranlib: file: magick/.libs/libMagickCore.a(magick_libMagickCore_la-PreRvIcccm.o) has no symbols
ranlib: file: magick/.libs/libMagickCore.a(magick_libMagickCore_la-PreRvIcccm.o) has no symbols
  CC       wand/wand_libMagickWand_la-animate.lo
  CC       wand/wand_libMagickWand_la-compare.lo
  CC       wand/wand_libMagickWand_la-composite.lo
  CC       wand/wand_libMagickWand_la-conjure.lo
  CC       wand/wand_libMagickWand_la-convert.lo
  CC       wand/wand_libMagickWand_la-deprecate.lo
  CC       wand/wand_libMagickWand_la-display.lo
  CC       wand/wand_libMagickWand_la-drawing-wand.lo
  CC       wand/wand_libMagickWand_la-identify.lo
  CC       wand/wand_libMagickWand_la-import.lo
  CC       wand/wand_libMagickWand_la-magick-image.lo
  CC       wand/wand_libMagickWand_la-magick-property.lo
  CC       wand/wand_libMagickWand_la-magick-wand.lo
  CC       wand/wand_libMagickWand_la-mogrify.lo
  CC       wand/wand_libMagickWand_la-montage.lo
  CC       wand/wand_libMagickWand_la-pixel-iterator.lo
  CC       wand/wand_libMagickWand_la-pixel-wand.lo
  CC       wand/wand_libMagickWand_la-stream.lo
  CC       wand/wand_libMagickWand_la-wand.lo
  CC       wand/wand_libMagickWand_la-wand-view.lo
  CCLD     wand/libMagickWand.la
ld: warning: directory not found for option '-L/opt/local/lib'
sed: OSX/ImageMagick-6.7.9-8/magick/libMagickCore.la: No such file or directory
libtool: link: `OSX/ImageMagick-6.7.9-8/magick/libMagickCore.la' is not a valid libtool archive
make[1]: *** [wand/libMagickWand.la] Error 1
make: *** [all] Error 2
Google learns that more OSX Mountin Lion users run into this error.

Till now I am still stuck on one core.
CousinCocaine
Posts: 3
Joined: 2012-09-24T02:24:42-07:00
Authentication code: 67789

Re: Is there ImageMagick multicore support (OpenMP) for OSX?

Post by CousinCocaine »

Finally I have got it working, ImageMagick multicore support (OpenMP) on OSX Mountin Lion.

What I did:
Install MacPorts and it's dependencies, like the command-line tools for Xcode. After that I did a selfupdate for MacPorts

Code: Select all

sudo port -v selfupdate
Then I installed some packages using MacPorts

Code: Select all

sudo port -v install freetype +bytecode
sudo port -v install librsvg
sudo port -v install +graphviz +gs +wmf +jbig +jpeg2 +lcms # results in an error?
sudo port install jpeg
After that I downloaded the ImageMagick source (http://www.imagemagick.org/download/ImageMagick.tar.gz), and did a regular 'configure', 'make', 'make install'. No errors occured.

Code: Select all

./configure
make
sudo make install
To check if my install was succesful I did a version check.

Code: Select all

identify -version
Version: ImageMagick 6.7.9-8 2012-09-27 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP OpenCL
Both OpenMP and OpenCL are installed (as they supposed to be).

Kudo's for fmw42 for his suggestion of using MacPorts to install the dependencies.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Is there ImageMagick multicore support (OpenMP) for OSX?

Post by fmw42 »

Glad to hear that you worked things out.
Post Reply