Polyplots 5 – speed

complex

It’s been some time since I last mentioned these, so here’s another post about them

This all started around the time of this post of when I started to move the computation part of the polyplot code into Fortran. This continued into 2018 when I worked out how to use a part of numpy to compile the Fortran code into a Python module, allowing easy access to the rest of the code I had. Only now have I actually measured the speed of them and boy does it fly!

So for comparison, here are two pictures – the first one made with the older Python code, the second one with the newer Fortran code:

d5-test-old

d5-test-new

Both methods were centered on the same spot (0.441135-0.894522i) with the same width(0.0271875)/height(0.01529296875) scale, of quantic (degree 5) roots. The coefficients a, b, c, d, e, f were cycled through -22 to 22 in steps of 1 (with a skipping 0) resulting in some eight billion equations to solve.

The older method, which used numpy for computing, took a total of 43.75 hours to complete.
The newer method, using this work for computing, took a total of 1.16 hours to complete.
The Fortran version is 97% faster; the old way was 36 times slower! If I extrapolate this backwards to how slow my very first version was, this would’ve been about 312 hours to do.

              polynomial solving speeds (degree 5)
  unit        +---- new ----+---- old ----++- difference/old%
polys/sec     : 1,939,231.3 |  51,546.702 ||  3662.09%
polys/sec/cpu :   279,291.4 |   7,363.815 ||  3692.75%
roots/sec     : 9,696,156.4 | 257,733.510 ||  3662.09%
roots/sec/cpu : 1,396,456.9 |  36,819.073 ||  3692.75%

Cutting out the great work of numpy and J. Skowron & A. Gould’s Fortran work, and trying the same thing again using just quadratic equations which can be solved directly, there’s a similar increase in speed: The old method to solve a billion quadratics took 8 minutes and 40 seconds; the new method took 10 seconds.

                polynomial solving speeds (degree 2)
  unit        +----- new -----+----- old -----++- difference/old%
polys/sec     :  96,833,543.1 | 1,923,146.003 ||  4935.16%
polys/sec/cpu :  13,977,791.9 |   274,735.143 ||  4987.73%
roots/sec     : 193,667,086.3 | 3,846,292.005 ||  4935.16%
roots/sec/cpu :  27,955,583.8 |   549,470.286 ||  4987.73%

But there’s more than just the speed difference, there’s a minor change (issue?) between the two pictures above. Here below are crops from the quadratic speed test where the difference is more apparent:

d2-old-crop

d2-new-crop

 

Can you see the difference? No? The newer method is shifted by two pixels! I’m pretty sure where that issue is (a less than vs a less than or equal sign) but it’s such a minor thing that I’m just not going to bother with it.

Both methods ran on a computer I built in 2012 (which I’m still using) using an Intel Core i7 3770 @ 3.40GHz (4 Cores, 8 threads) CPU with 16.0GB Dual-Channel DDR3 @ 666MHz (9-9-9-24) RAM. I ran them using 7 of the 8 threads so I could still use the computer while it ran.

Going back to the original post that inspired me to start doing these things in the first place, it took them 4 days to compute in 2009. Using 2012 computer equipment, I can reproduce their picture in five minutes.

 

 

 

 


Even with the great speed up, the amount of time these polyplots can take can spin wildly into madness. For a polynomial of degree 24, permutations of all its coefficients from between -1 and 1 gives 33.554 million different polynomials – which I can do in five minutes – but adding just one more value to that, so it permutes through say -1, 1 and 2, results in 847.289 billion polynomials to do; estimated time is three months. The only way to really go faster at this point is to build a new computer.

More polyplot pictures
More polyplot posts

Tagged with: ,
Posted in PolyPlots

Leave a comment

In Archive
Design a site like this with WordPress.com
Get started