Skip to content

About

We deduce the factorial mandelbrot accelerated by intrinsiks

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

17 Commits

Folders and files

Repository files navigation

Mandelbrot

As part of this project, I wrote code that shows the Mandelbrot factorial set. You can press:

  • ↑ to raise the picture;
  • ↓ to lower the picture;
  • → to move the picture to the right;
  • ← to move the picture to the left;
  • F1 to zoom in;
  • F2 to zoom out.

On your device, you can reproduce the picture below: Mandelbrot

To do this, you need to compile the project by typing make in the console when you clone the repository to your computer. If you want to remove the optimization flags, then remove the corresponding flag in the makefile; to disable rendering remove the -DDRAW flag; to disable AVX2 optimization, remove the -DAVX_ON flag. Initially, the optimization, rendering and AVX2 flags are enabled.

AVX or not AVX...

in FPS AVX2 Without AVX2
none 9 4
-O3 15 10
-Ofast 15 10

Hmm, but this is not the acceleration that was expected. Let's go figure out what the error is. To do this, I used perf, as well as the FlameGraph graphical interpreter.

My error

SFML libraries take up about 90%! Terrible measurements. It turns out that I haven't completely disabled SFML instructions in my loop. Let's fix this and re-measure the speed of the algorithm with and without AVX2 optimization. By the way, I specifically switched to a different calculation algorithm: I began to go not by an imaginary physical coordinate system (this is the one for which the BORDER variable is needed), but by pixels on the screen (WINDOW_SIZE_X and WINDOW_SIZE_Y). This allows you to speed up the algorithm, since now I am updating only the image, and not redrawing the window pixel by pixel.

With AVX2: AVX2

Without AVX2: WITHOUT_AVX2

Accuracy of measurements: Percentages See, the parts from the SFML library now take up less than 1.5% of the total cycle work, which is a negligible error, so the data in the table below is now correct.

in FPS AVX2 Without AVX2
none 16 7
-O1 65 19
-O2 65 19
-O3 64 19
-Ofast 66 21

Conclusion: of course, you need to use AVX2 optimization :)

About

We deduce the factorial mandelbrot accelerated by intrinsiks

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages