Skip to content

Utility for generating an image of the mandelbrot set in parallel

Notifications You must be signed in to change notification settings

wolfpeyton/mandelbrot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

mandelbrot

Utility for generating an image of the mandelbrot set in parallel

The program created for this project generates an image of the mandelbrot set with arbitrary precision. It optionally takes a single integer as a command line argument which specifies the desired width of the image to be created. If no argument is given, it defaults to 350.

The algorithm used to generate the mandelbrot set is called the escape time algorithm. For each pixel in the image, it finds the scaled position within the unit mandelbrot plane, which places the x coordinate in (-2.5, 1) and the y coordinate in (-1, 1). It then repeats a certain calculation on the x and y coordinates until either the sum of the squares of x and y exceeds 4, in which case the pixel is not in the fractal, or until a certain ceiling of iterations is reached, in which case the pixel is assumed to be in the fractal. The calculation is that x is set to the square of x minus the square of y plus the the original value of x, and y is is set to the product of x, y, and 2, added to the original value of y. This program is very rife for parallelization because the calculation for every single pixel is completely independent. Four threads were created, each of which used the same algorithm, but each only accessed every fourth row of the array representing the image. Because of this, locks did not have to be used, because the different threads never accessed the same data. Using this method, the process of generating the fractal was able to be fully parallelize into four threads. What could not be parallelized was the writing of the array to the image file, which had to be done strictly in order.

About

Utility for generating an image of the mandelbrot set in parallel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published