CPU/GPU Multiprecision Mandelbrot Set

Eric Bainville - Dec 2009

Introduction

The classical Mandelbrot Set computation algorithm is well suited for a GPU implementation: almost no inputs, all threads are independent, and each thread produces a single integer input after an intensive computation.

In this page I describe a CPU/GPU Mandelbrot Set interactive application, working on CPU double, GPU float, and CPU or GPU fixed-point reals. The algorithms are implemented in both C++ multithreaded code running on the CPU, and in OpenCL running on CPU and GPU.

The interface and thread management are implemented using Qt, and the application compiles and runs identically on Windows and Linux (and probably on MacOS X too).

I won't give more details about the Qt interface. One notable feature is that the computation is done asynchronously in a different thread, to continue process interface events while computing the images. Interested readers will find an example of the use of QThread, QMutex and QSemaphore.

Contents

  1. Simple C Code
  2. Simple OpenCL Code
  3. Fixed Point Reals
  4. fp128 for OpenCL
  5. Benchmarks Updated May 2010

Source code and binaries

Windows 32-bit binaries: MPMandelbrot-bin32-20091223.zip (4201 KB)

Windows 64-bit binaries: MPMandelbrot-bin64-20091223.zip (5077 KB)

Linux/Windows source code: MPMandelbrot-src-20091223.zip (64 KB)

In order to run the application, you may need to install the Visual C++ runtime. An OpenCL DLL should be in the path, or at least copied in the executable directory. An OpenCL driver should be installed too: AMD Catalyst 9.12 Hotfix, or NVidia 195.xx.

The sources include a command-line version for Linux, not using Qt. It is the default make target (mpmt).

The next page shows a simple C implementation of the classical Mandelbrot Set algorithm.