Parallel Computing

mr wong   google bookmarks   del.icio.us   yigg   digg   folkd
Mandelbrot set

This demo computes the Mandelbrot set. Its numerical calculation can be easily parallelized. Up to four threads, each of them is coded in another programming language, compute one horizontal part of this fractal. Use the mouse to enhance any part of this graphical representation:

  • If the mouse pointer is over the fractal image, labelled Mandelbrot set, a crosshair cursor will appear.
  • Press the left mouse button to determine the upper left corner of the part which is to be enlarged.
    Move the mouse pointer to the chosen lower right corner of the part which is to be enlarged. Then press the left mouse button again.
  • Now the range of the Mandelbrot set will be computed according to the selected rectangle.
  • Alternatively, you can alter the range manually via the appropriate input fields.
  • Click the Compute button to generate a Mandelbrot set that matches the changed range.
  • The Reset button restores the initial range and the corresponding fractal image.
Fractal
Thread times in milliseconds
JAVA 32            
Range
x-axis
y-axis
Program language Java
C
FORTRAN77
Assembler (x86)

Remarks

For the interpretation of the thread runtimes the following technical facts must be taken into account:

  • As this demonstration runs on a single-processor system, the parallelization by means of threads does not yield any advantage with regard to speed.
  • In contrast to the Java-Thread, the threads that are coded in C, FORTRAN77 and Assembler have to use JNI (Java Native Interface) to pass on the computed graphics data to the servlet. Given the short computation times, this interaction can lower the speed advantages of the native programming languages compared with the JIT (Just In Time) Java-Code.
  • Mandelbrot sets that are computed by means of the manually coded Assembler-Codes can differ from the results of the other programming languages (Java, C and FORTRAN77) in subtle graphical details. The assembler-code performs the computations continuously with 80-bit-accuracy via the stack of the FPU (Floating Point Unit), whereas the compiled code of the other programming languages deposits interim results of the FPU in the store (2*32 = 64 Bit). As a point of the Mandelbrot set is defined by a recursion, the difference in computational accuracy (64/80 Bit) can lead to a different point colour.

Mathematical background

This well-known fractal is based on the simple recursive function z = z2 + c with the initial value z0 = 0 and c being the constant. z and c correspond to complex numbers that can also be represented as points on the plane. For the computation this recursion is performed for a finite set of points of this plane. The recursion of a point can behave as follows:

  • The values of a point do not leave a certain interval - the values remain finite. In this case the point belongs to the so-called Mandelbrot-set* and it will be assigned the colour black.
  • If the values of the point approach infinity, the point will not be an element of the Mandelbrot set, and its colour will compare to the number of iterations, after which its values approach infinity.
* The set is named after the French mathematician Benoît Mandelbrot, who was the first to generate this kind of pictures with the aid of a computer.