Page 1 of 2

ImageMagick Accelerate Using OpenCL

Posted: 2013-03-05T18:41:33-07:00
by oneal
Hello, all

I'm a engineer and focusing on the acceleration technology of GPU. now we have done some optimizations In ImageMagick and get some performance improvment, so I want to share and contribute my optimizations.

the goal of my optimizations is speeding up the image processing. such as I make the gaussian-blur filter run on the GPU using OpenCL and compare the performance improvement, I get a more than 5x speedup (CPU vs GPU)

I get about 1x ~ 10x speedup base my optimized imageMagick version for some filters. Is there anyone interesting my work ?
If you are interesting my work, I can share my optimization design with you and discusse it.


Thanks
Oneal

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-03-05T19:03:25-07:00
by magick
ImageMagick includes an OpenCL convolution filter which supports blur. How does your filter differ?

Do you have a repository or patch that we can download your filter to test?

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-03-05T19:44:24-07:00
by oneal
magick wrote:ImageMagick includes an OpenCL convolution filter which supports blur. How does your filter differ?

Do you have a repository or patch that we can download your filter to test?

I have done more than 20 filters. but our optimizations is base on the 6.7.3. now we are merge our optimizations with the latest ImagMagick version(version 7).
if ImageMgick community can create a branch for our optimizations, I can do the merge base on the OpenCL branch and submit our code into this branch when I finished this integration.

For our optimizations. we have the done three optimzations.
1) optimizing more than 20 filters using OpenCL
2) optimizing the jpeg decoder using OpenCL and SSE
3) changes for cache some OpenCL runtime objects(we add a demon mode to do the image processing, this mode have big benefit in case of images batch processing ). if we want to get the max speedup, we should do the three components.

I'm merging the optimized filters into the latest ImageMagick version by following the customer filter rule. I'm also merging the optimized jpeg decoder into the latest ImageMagick by foolwing rules:

http://www.imagemagick.org/script/archi ... php#coders. You'll need an unique id such as OJPEG then type:
convert ojpeg:image.jpg image.png
to utilize the optimized JPEG decoder.

For the 3th optimzation. because this approach has changes the original framework of ImageMagick, I want to know How I can implement this idear. is there other mechanism that I can use to cach these OpenCL runtime objects.

Thanks
Oneal

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-03-24T18:45:15-07:00
by oneal
now I merge my OpenCL-filters optimization with 6.8.3 as custom filter.
and the jpeg decoder optimizing using OpenCL and SSE merged as custom image code,also in 6.8.3.

Where shall I update my code ?

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-03-25T05:04:01-07:00
by magick
Post a URL to your distribution. We can add it to the contrib/ folder of the ImageMagick distribution archive. Be sure to include a separate README.txt file so users can readily identify how to utilize your OpenCL operators.

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-03-27T00:55:42-07:00
by oneal
I modify the configure project and the imagemagick can utilize your OpenCL operators automaticly.
And I will send you a private message with the git URL,username,password by.
You can build and test it by following the "Readme.txt" file.

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-03-27T15:43:40-07:00
by magick
We got the credentials to download your OpenCL-enabled distribution of ImageMagick. Instead of downloading it to the ImageMagick archives, why not announce your GIT repository here so the user community can download it and start making contributions / patches / etc.?

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-03-28T02:46:58-07:00
by oneal
Can you merge my OpenCL-enabled distribution with the imagemagick repository?so the user community can download and patches it.
And I have another optimization which is use a demon programme to initialize all the opencl environment.
That's can reduce much time when you use opencl filter,but it need another background process and I don't konw this demon programme is acceptable.

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-03-28T05:40:32-07:00
by magick
We can make your OpenCL distributions available in the ImageMagick contrib folder at http://www.imagemagick.org/download. It needs to go through an incubation period before we can consider merging it in the Subversion trunk.

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-03-28T08:58:15-07:00
by magick
Find the GPU-enabled patches to ImageMagick to accelerate common image processing operators such as blur, sharpening, and edge detection here: http://www.imagemagick.org/download/contrib/. We encourage the user community to download, test, and contribute bug reports and patches.

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-03-28T11:51:50-07:00
by fmw42
The text file GPUMagick.txt seems to indicate that this is Windows only as it references .exe. Is this usable on unix platforms?

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-03-28T17:41:08-07:00
by oneal
fmw42 wrote:The text file GPUMagick.txt seems to indicate that this is Windows only as it references .exe. Is this usable on unix platforms?
I only modify and test my optimization on Windows platforms with different CPU and GPU.

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-03-28T21:17:18-07:00
by oneal
magick wrote:We can make your OpenCL distributions available in the ImageMagick contrib folder at http://www.imagemagick.org/download. It needs to go through an incubation period before we can consider merging it in the Subversion trunk.
Hi,
What is the step of merging code in the subversion trunk? In other words will the incubation period takes?
And I think a demon programme will reduce the time of opencl environment initializion but It needs a background process and I don't konw a background process is acceptable or not?

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-04-07T04:43:48-07:00
by magick
We don't think about merging until a user base / user demand is established for the OpenCL acceleration. Another consideration: its possible that your acceleration may be achieved with simple OpenACC pragmas. Or perhaps with an Intel PHI coprocessor. Both of these solutions are desirable because they only require no or few patches and do not require maintenance of separate algorithm codesets, one for the CPU and one for the GPU / coprocessor.

Another consideration is that your codeset needs to be supported under ImageMagick 7 before we could think about merging.

Re: ImageMagick Accelerate Using OpenCL

Posted: 2013-05-23T08:28:32-07:00
by Frank.Wei
Hi, Magick,

Actually the user demand for GPU computing is quite big in the image processing area. Many corresponding open source software has added their OpenCL module.There is a long list for that: OpenCV, x264, Handbrake, FFMPEG, Irfanview... At the same time, Adobe is pushing very heavy on enabling OpenCL in Photoshop going forward. From the users feedback, they all have achieved tremendous performance improvements and are welcomed in open community.
User experience is quite importance, the user would not know the benefits of OpenCL acceleration until they can try it on their laptop/desktop for Imagemagick. It will be convenient for the users if the community could merge the OpenCL code.

Although the OpenACC is good option but they reply much on the compiler itself and of course could not achieve the best performance results. There are many debates on that already.Intel PHI coprocessor is somehow far away from common users who can not afford the expensive processors. OpenCL is supported widely on different product lines by major chip manufacturer which is its great advantage over any other heterogeneous programming language.