Hello all,
I'm working on a computer performance benchmark relating to image processing. ImageMagick looks like it'll be a great tool for this. The thing is, I'm trying to exercise all the processor cores on my workstation (8, in this case), so I'm looking for some pointers to operations which are multi-threaded, either by default or with a command-line switch.
For example, I tried -blur, but it was clearly using only one core.
I'm using the standard Windows 6.3.8-9 dll.exe binary, downloaded today.
Are there some multi-threaded operations, filters, reads, writes, etc? If so, and they're not multi-threaded by default, how to I enable multi-threading? Do I need a different build?
Thanks!
Regards,
Dan
Multi-threaded operations?
Re: Multi-threaded operations?
From http://magick.imagemagick.org/script/ar ... hp#threads:
Many of ImageMagick's internal algorithms are threaded to take advantage of speed-ups offered by the dual and quad-core processor technologies. However, you are welcome to use ImageMagick algorithm in your threads of execution with the exception of the MagickCore AcquireImagePixels(), GetImagePixels(), SetImagePixels(), and SyncImagePixels() pixel cache methods. These methods are intended for one thread of execution only. To access the pixel cache with more than one thread of execution, use a cache view. We do this for the CompositeImage() method, for example. Suppose we want to composite a single image over a different image in each thread of execution. If we use AcquireImagePixels(), the results could be corrupt since multiple threads might be asking for different areas of the pixel cache simultaneously. Instead we use AcquireCacheViewPixels() which creates a unique view for each thread of execution ensuring our program behaves properly regardless of how many threads are invoked. The other program interfaces, such as the MagickWand API, are completely thread safe so there are no special precautions for threads of execution.
Many of ImageMagick's internal algorithms are threaded to take advantage of speed-ups offered by the dual and quad-core processor technologies. However, you are welcome to use ImageMagick algorithm in your threads of execution with the exception of the MagickCore AcquireImagePixels(), GetImagePixels(), SetImagePixels(), and SyncImagePixels() pixel cache methods. These methods are intended for one thread of execution only. To access the pixel cache with more than one thread of execution, use a cache view. We do this for the CompositeImage() method, for example. Suppose we want to composite a single image over a different image in each thread of execution. If we use AcquireImagePixels(), the results could be corrupt since multiple threads might be asking for different areas of the pixel cache simultaneously. Instead we use AcquireCacheViewPixels() which creates a unique view for each thread of execution ensuring our program behaves properly regardless of how many threads are invoked. The other program interfaces, such as the MagickWand API, are completely thread safe so there are no special precautions for threads of execution.
Re: Multi-threaded operations?
Thanks. Yes, I had seen this in my searches; but I don't have the knowledge to know how that information maps to the question: which operations in (say) convert are multi-threaded? I'm intending to use existing binary tools; I'm not planning to use the API.magick wrote:From http://magick.imagemagick.org/script/ar ... hp#threads:
Many of ImageMagick's internal algorithms are threaded to take advantage of speed-ups offered by the dual and quad-core processor technologies. However, you are welcome to use ImageMagick algorithm in your threads of execution with the exception of the MagickCore AcquireImagePixels(), GetImagePixels(), SetImagePixels(), and SyncImagePixels() pixel cache methods. These methods are intended for one thread of execution only. To access the pixel cache with more than one thread of execution, use a cache view. We do this for the CompositeImage() method, for example. Suppose we want to composite a single image over a different image in each thread of execution. If we use AcquireImagePixels(), the results could be corrupt since multiple threads might be asking for different areas of the pixel cache simultaneously. Instead we use AcquireCacheViewPixels() which creates a unique view for each thread of execution ensuring our program behaves properly regardless of how many threads are invoked. The other program interfaces, such as the MagickWand API, are completely thread safe so there are no special precautions for threads of execution.
Thanks,
Dan
Re: Multi-threaded operations?
If you add --enable-openmp to your configure script command line and build ImageMagick, convolution operations run in multiple threads (e.g. blur, sharpen, unsharp mask, edge, etc). We intend to thread additional image processing algorithms in the future as time permits.
Re: Multi-threaded operations?
Thanks - that's what I was looking for. Now I've got to find a compiler... Presumably GCC is first choice (I'm on Windows XP-32)? What else is needed for a build environment that will build IM? I'm used to building on unixes, less so on Windows.magick wrote:If you add --enable-openmp to your configure script command line and build ImageMagick, convolution operations run in multiple threads (e.g. blur, sharpen, unsharp mask, edge, etc). We intend to thread additional image processing algorithms in the future as time permits.
Thanks,
Dan
Re: Multi-threaded operations?
Some Unix users prefer to build ImageMagick under Cygwin or MinGW otherwise build a native version with Visual C++.