Basic Mandelbrot render optimization

  • 20 Replies
  • 668 Views

0 Members and 1 Guest are viewing this topic.

Offline hobold

  • *
  • Fractal Phenom
  • ****
  • Posts: 40
« Reply #15 on: June 21, 2018, 11:01:43 AM »
If 128 bits of precision is sufficient, you might have better luck with a "double double" approach, where pairs of double precision floating point numbers are combined to obtain a larger mantissa (more generally, this idea is also called "normalized floating point"). Modern 'x86 processors can do fused multiply-add, therefore you can expect to lose less than a factor of ten performance as compared to native double precision.

Pros: can be inlined, relatively fast

Cons: no larger exponent range, only useful for mildly large precisions (128 - 256 bits)

Random reference: http://web.mit.edu/tabbott/Public/quaddouble-debian/qd-2.3.4-old/docs/qd.pdf

Offline claude

  • *
  • Fractal Freak
  • **
  • Posts: 714
    • mathr.co.uk
« Reply #16 on: June 21, 2018, 12:15:02 PM »
Oh yes, I forgot about that approach!  it's also called "compensated arithmetic" in some circles. I wrote some Haskell bindings to libqd's C API once upon a time, but I think the 'compensated' package in pure Haskell is much better if you want to use that language.  IIRC libqd requires some setup/restore for floating point environment at program (thread?) startup/finish, at least on x86 (32bit).

Offline knighty

  • *
  • Fractal Feline
  • **
  • Posts: 169
« Reply #17 on: June 21, 2018, 04:14:04 PM »
Have anyone tried ISPC ?

Offline zenzero-2001

  • *
  • Fractal Freshman
  • *
  • Posts: 7
« Reply #18 on: July 04, 2018, 04:39:29 PM »
Lots of really interesting and good advice in this thread.

I use MPIR, MPFR, and MPREAL (an MPFR C++ wrapper, http://www.holoborodko.com/pavel/mpfr/, as mentioned earlier in the thread) in my fractal explorer, Fractalscope, https://sourceforge.net/projects/fractalscope/ . MPIR is the Windows compatible version of GMP. In my experience, MPFR is slower than MPIR - probably because of its correct rounding etc.

Fractalscope uses MPREAL for calculating the required precision and precision mode (double or arbitrary) for a particular magnification level, but performs the actual Mandelbrot calculation using MPIR. The C++ operator overloading of MPREAL adds overhead to the calculation compared to the raw C calls of MPFR and MPIR and is therefore slower. Compiling MPIR specifically for your computer should help a bit with the arbitrary precision speed, but yeah using MPIR is like hitting a wall of jelly compared to double precision :-) The new perturbation technique is a huge leap in speed over conventional arbitrary precision, but the mathematics are beyond me!

Fractalscope uses SSE2 intrinsics for the Mandelbrot calculation at double precision (I never did get round to writing the SSE code for the other fractals). This enables four pixels to be calculated simultaneously without orbit detection and two pixels simultaneously with orbit detection. Things have moved on since I wrote that part of the code, new processors have more registers, AVX, etc, which I am not familiar with, so it may be possible to calculate more pixels simultaneously). Bruce Dawson's Fractal eXtreme has very fast arbitrary precision, but I believe that uses very clever and low level optimizations (and is closed source).

Orbit detection can give a very large speed up for areas that feature the inside of the set at high iteration counts, and is well worth including. Solid guessing can also help to speed up calculating  areas which feature the inside of the set. It is not very effective at speeding up the calculation outside of the set at high magnifications because the iteration bands become much narrower (or non-existent).

In addition to the instruction level optimizations of SSE, AVX, thread level optimization is also something to look at. Multi-threading gives a sizeable speed increase. The fact that processors nowadays  are increasing in cores rather than Mhz, means that mult-threading is a no-brainer - especially with something like calculating the Mandelbrot set which lends itself well to parallel computing.

Offline Adam Majewski

  • *
  • Strange Attractor
  • ******
  • Posts: 93
« Reply #19 on: July 04, 2018, 06:13:47 PM »
If 128 bits of precision is sufficient, you might have better luck with a "double double" approach,

https://pl.wikibooks.org/wiki/Programowanie_w_systemie_UNIX/qd

HTH

Offline 3DickUlus

  • *
  • Fractal Frankfurter
  • *
  • Posts: 633
    • Digilantism
« Reply #20 on: July 05, 2018, 02:09:40 AM »
GPU 128bit and arbitrary precision libraries https://code.google.com/archive/p/gpuprec/
Resistance is fertile... you will be illuminated!

https://en.wikibooks.org/wiki/Fractals/fragmentarium


xx
The basic rules of the Mandelbrot-Set

Started by Fraktalist on Fractal Mathematics And New Theories

5 Replies
446 Views
Last post October 12, 2017, 10:04:09 PM
by v
xx
The Candy Vault - Using an Orbit Trap to render the Mandelbrot.

Started by saka on Fractal movie gallery

3 Replies
135 Views
Last post March 22, 2018, 12:02:53 AM
by Spaciane
clip
Basic bulletin board codes - Online Manual

Started by Anon on Board Rules and Guidelines

0 Replies
197 Views
Last post September 02, 2017, 11:00:15 PM
by Anon
xx
How to render only z - buffer

Started by Salol on Mandelbulb3d

3 Replies
180 Views
Last post January 30, 2018, 03:09:48 AM
by Salol
question
Render Farm for Mandelbulb 3d?

Started by muinami on Mandelbulb Maniacs

0 Replies
183 Views
Last post August 11, 2018, 09:41:30 PM
by muinami