DirectCompute Mandelbrot Fractal Viewer
Introduction
Following in the footsteps of other people on the Internet, I’ve written a GPGPU language Mandelbrot fractal viewer. Along with a DirectCompute implementation, I’ve also written a reference unoptimized cpu version and am really excited that the DirectCompute implementation is more than 50x times faster! (With the caveat that my cpu implementation can probably be optimized much more.)
Other People’s GPGPU language Mandelbrot Fractal Implementations
During the past year, a bunch of people have released GPGPU language Mandelbrot fractal implementations. It seems to be a popular first program for GPGPU language learning.
1) DX11 DirectCompute Mandelbrot and Julia viewer
http://users.skynet.be/fquake/
I learned about this implementation from a Beyond3D forum post last year (http://forum.beyond3d.com/showthread.php?t=55330). The author has continued releasing DirectCompute demos after the release of the above Mandelbrot viewer demo. His latest DirectCompute fluid simulation demo blows my mind and looks amazing. Source code appears included with the demos.
2) A realtime Mandelbrot zoomer in SSE assembly and CUDA
http://users.softlab.ece.ntua.gr/~ttsiod/mandelSSE.html
I learned about this implementation from a VizWorld article (http://www.vizworld.com/2009/12/realtime-mandelbrot-zoomer-sse-assembly-cuda/). The author provides a multi-threaded, hand-optimized SIMD cpu implementation along with a Nvidia CUDA implementation. GPL-ed source code is provided.
3) MandelCPU vs MandelGPU
http://davibu.interfree.it/opencl/mandelgpu/mandelGPU.html
The author appears to be one of the main programmer behind the exciting developments in LuxRender’s OpenCL support (http://www.luxrender.net/wiki/index.php?title=Luxrender_and_OpenCL). This demos compares cpu and OpenCL implementations of a Mandelbrot fractal viewer. The author’s page http://davibu.interfree.it/index.html has other more advanced OpenCL demos with source code.
Explanation of the Mandelbrot Fractal
http://warp.povusers.org/Mandelbrot/
The above page provides a really good introduction to what the Mandelbrot fractal is. I had previously never written a Mandelbrot fractal program and the above page helped me a lot in my understanding and implementations.
Video of My Mandelbrot Fractal Viewer
The demo video starts off with the DirectCompute implementation running and toggles to my non-optimized cpu implementation midway through. As you can see by the VSync-disabled FPS at the top left-hand side of the screen, the DirectCompute implementation is much much faster. The ghosting in the video is probably due to the fact that I don’t know how to use my free video editing software properly, but I’m too tired to try to fix it. Yay, fixed the ghosting problem in my video. Turns out I just needed to increase the CamStudio video options compressor quality setting to 100%.
My Mandelbrot Fractal Viewer Demo
As I wrote in the introduction, the DirectCompute version is over 50x faster! I have been reading about how fast GPGPU languages can be for the right algorithms, but experiencing huge performance gains first-hand really hits home. The caveat is, of course, that both cpu and gpu implementations are unoptimized, and the cpu implementation has more potential to be sped up (but not +50x, I don’t think). Currently, my cpu implementation is single-threaded with no SIMD-use. The cpu in my machine is an Intel Core2Quad Q6600 2.4ghz (not overclocked) and my gpu is a ATI Radeon HD5750. In the demo, I don’t use doubles, but use floats in my calculations because my gpu doesn’t support doubles. Unfortunately, the insufficient precisions limits how closely you can zoom into the fractal.
Source Code & Binary
http://yakiimo3d.codeplex.com/releases/view/41053
. This entry was posted on Tuesday, February 2nd, 2010 at 6:30 PM and is filed under Demo, DirectCompute, DirectX11. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
February 6th, 2010 at 11:32 PM
Very nice! (your youtube video is horrible though)
BTW, the new DX SDK is here!.
I’m curious to see if there is now WARP support for CS 4.x and CS 5.0. Would be interesting to test performances with it! (WARP make use of multi-threaded and SIMD)
February 7th, 2010 at 1:18 AM
Hey, thanks for the comment. You are my first non-spam comment that I’ve gotten since starting this blog!
I know my video quality is horrible. Just doing this with my free time, and didn’t know what software to use, but yeah maybe I should fix my video.
Yup, DLed the new SDK. That’s an interesting idea about WARP. Wouldn’t have occurred to me, so thanks for the suggestion. I’ll probably return to this program and manually write SIMD and multi-threaded code eventually, but for now, I want to write other Compute Shader programs.
Again, thanks for the comment!
February 7th, 2010 at 1:05 PM
Re-uploaded my video. Turned out that all I needed to do was set the CamStudio video setting compressor quality value to 100% to remove the ghosting.
February 10th, 2010 at 9:34 PM
[...] Mandelbrot Fractal Viewer Demo (yakiimo02) – Compute Shader 5.0 [...]
March 29th, 2010 at 1:17 PM
[...] DirectCompute Mandelbrot Fractal Viewer [...]
June 3rd, 2010 at 12:54 AM
Very fast !!
June 3rd, 2010 at 11:27 PM
Haha yeah, computers shaders with fractals are fast!