Megabrot: multi-core fractals

Why

Multi-core processors being common place, I wanted to know how close to 'ideal' performance I could get from a symmetric multi-core processor.


What

Megabrot is a fractal generator, written as an experiment in data-parallel multi-core utilization.  It is as close to an ideal case for data parallelization as I could think of at the time, and having written fractal generators many times before, the choice basically made itself.


This is for those of you interested in efficient use of symmetric multi-core processors, or those of you who are fractal enthusiasts.  Especially those who never dreamed that one day we'd have computers fast enough to draw fractals in under a minute, let alone in a real-time animated fashion.


Downloads

source code: megabrot_src.zip

binary (win32): megabrot_bin.zip


Background

Megabrot utilizes the data-parallel paradigm, as opposed to the task-parallel one.  For more information on what that means, you can check out this excellent introductory video from Intel.

http://www.techrepublic.com/blog/itdojo/video-task-parallelism-and-data-parallelism-explained/610


Notes

Megabrot, in test mode, will generate several fractal images using various methods of dividing the workload among the physical cores.  In the end you get a little report describing the results of each variation, as compared to the basic single core performance.


The code is very crude, and leaves all the cleanup work to the OS, but for what it is (a fun experiment), it does the job just fine.


The result of the experiment was the knowledge that one can indeed get very close to 'ideal' performance from an SMP, if the problem (like this one) is well suited to data parallelization.


Predicting The Future

When SMPs with hundreds or thousands of cores are commonplace, it may make sense to move to a hybrid technique.  A thousand cores may be more than some particular task types can feed, in which case running sets of data-parallel tasks on different groups of cores might bear some fruit in the performance

department, so long as the task types have no dependencies.


Further Reading

There's a lot of material out there, and most is better written than this.  Some key phrases you might try feeding into google are: "task parallel vs data parallel" and "lockless thread synchronization".


© Paul Glinker 2002 - 2016