I develop and distribute a program that uses pthreads and Magick++. Since pthreads aren't compatible with OpenMP on many platforms (including OS X) users of our software have to build Magick++ with the --disable-openmp option. (If it's omitted, the program crashes on the first Magick++ call from a subthread.) Two of the OS X package managers, fink and macports, distribute ImageMagick with openMP enabled, so our users can't use the package managers and have to build ImageMagick manually. This is an enormous burden for some of them. The maintainers of the fink and macports ImageMagick packages don't want to disable OpenMP by default, for obvious reasons.
So, the question is, is it possible to completely disable OpenMP at run-time? Setting MAGICK_THREAD_LIMIT to 1 (or even 0) doesn't do the trick. The program still crashes in gomp_resolve_num_threads. Here's part of the trace:
- Thread 2 Crashed:
0 libMagickCore.3.dylib 0x0000000102c9e12c gomp_resolve_num_threads + 28
1 libMagickCore.3.dylib 0x0000000102b34c95 AcquirePixelCache + 325
2 libMagickCore.3.dylib 0x0000000102be9257 AcquireImage + 375
3 libMagick++.3.dylib 0x000000010298a0b6 Magick::ImageRef::ImageRef() + 86
4 libMagick++.3.dylib 0x0000000102980632 Magick::Image::Image() + 50
Thanks.
-- Steve