A Mandelbrot set is defined as the set of all complex numbers
remains bounded (i.e., does not diverge to
Traditionally, divergence is defined by a threshold of the magnitude of the current element in the sequence. For example, if we choose a threshold of
- Pixel-level parallelization, each thread evolves the Mandelbrot set for differnt starting values
$c$ in the complex plane. - Poor scaling due to critical access of shared data buffer.
- Frame-by-frame parallelization when generating multiple frames of the Mandelbrot set at different scales to create a movie (i.e. zooming into one point of the plane).
- Each frame is assigned to a different thread for parallel processing.
- The generated frames are then compiled into a video.
- Much more efficient scaling, each thread works on independent chunck of data
Generated animation of the Mandelbrot set zooming into specific regions:
-
Seahorse Valley
$(-0.743643887037151 + 0.131825904205330i)$ : Download Seahorse.mp4 -
Elephant Valley
$(0.282 + 0.5307i)$ : Download Elephant.mp4 -
Feigenbaum Point
$(-1.401155 + 0i)$ : Download Feigenbaum.mp4
The colormap uses the Escape-Time Algorithm to provide a cool visualization of the complex plane.
g++
with OpenMP supportffmpeg
(for compiling frames into a video)
-
Compile the Mandelbrot generator:
g++ -fopenmp -o mandelbrot_generator main.cpp src/*cpp -I ./include -O3
Note: if program crashes try reducing compiler optimizations by removing -O3 flag.
-
Run the generator with parallel processing:
./mandelbrot_generator 8 100 "Seahorse" true "./figures/frames/" 1.025 0.001
-
8
→ Number of processors -
100
→ Number of frames -
"Seahorse"
→ Region of interest -
true
→ Save frames -
"./figures/frames/"
→ Directory to save frames -
1.05
→ The zoom factor, set to 5.0% zoom between frames -
0.001
→ Standard resolution (defined as distance between grid points so smaller value is more resolution) for a frame without zoom, scales with dimensions
Note: resolution significantly increses the computational load with
$O(r^2)$ , and computing 100 frames at the above resolution takes ~10min with 32 threads of execution. Try changing resolution to0.005
or0.01
for quicker execution. -
-
Convert frames into an MP4 video:
python3 makeVideo.py ./figures/frames ./seahorse-100.mp4 --fps 30
- Implement GPU acceleration using CUDA.
- Optimize frame generation with better load balancing.
- Enable dynamic thresholding to improve visualization quality.
- Reuse computation between frames.