Title: Multithreaded reference orbit calculation? Post by: Botond Kósa on August 28, 2014, 03:09:04 PM I have recently noticed that when KFR is calculating a reference orbit, the CPU utilization of my 4-core machine jumps to 50%, so apparently it is doing the calculation on 2 threads. Kalle, how did you split the job between these two threads? Do you calculate the bignum arithmetics on both threads, or does the second thread calculate the SA coefficients only while the first one is calculating the next iteration?
I have not yet tried to make reference orbit calculation parallel, and it seems quite a hard problem considering the very fine granularity of the algorithm. In each iteration, squaring the re and im parts could be done concurrently, but the threads would have to be synchronized after that. Maybe busy waiting would be a viable solution. Reference orbit calculation is one of the ultimate bottlenecks in Mandelbrot rendering, especially on computers with many cores. It would be nice if we could make it multithreaded. Title: Re: Multithreaded reference orbit calculation? Post by: Kalles Fraktaler on August 28, 2014, 10:27:56 PM Yes, when going deeper than e600 I split up the reference calculation in first 3 threads. One is squaring xr, one is squaring xi and one is doing the square of (xr+xi). Next step is split up in 2 threads, that are using the result from the above and apply them on the real and imaginary parts. So there are a lot of synchronizations needed for these 5 threads and it will actually slow down the reference calculation significantly for shallow locations. My ap class is slow anyway compared with yours and FX's. |