fftconvolve icon indicating copy to clipboard operation
fftconvolve copied to clipboard

Choosing optimal arrays size

Open HVisMyLife opened this issue 2 years ago • 3 comments

What array size to choose? I understand, that it should be a power of 2, but it seems otherwise, eg. somewhat random, with huge fps drops across values...

HVisMyLife avatar Dec 18 '22 21:12 HVisMyLife

Hey!

My understanding is that powers of 2 should be the most efficient as well, but maybe that isn't quite the case. Could you send through some examples, please?

Cheers, Rhys

rhysnewell avatar Dec 18 '22 21:12 rhysnewell

I think the padding that happens internally in the fftconvolve function should probably pad to a power of 2, and that isn't happening correctly. It would still be helpful if you send me through some examples, and I'll benchmark them and see if I can speed it up with proper padding

rhysnewell avatar Dec 18 '22 22:12 rhysnewell

Ok, I'm creating lenia program ( floating point version of "game of life" ). Because of that, one array is big, and one is small, so here are exaples: in1, in2; time[ms]

  • 1048_576, 1681; 54
  • 1048_576, 1521; 69
  • 1048_576, 1369; 65 At first sorry, after deeper investigation it seem, like power of 2 is in fact better ( in1 ). However, why in2 size changes have such big influence on overall time? I can't make it array a power of 2 ( there must be center point ), but I just don't understand why making it smaller could make calculations longer...

Ps. code is on my github (lenia), if you want look at it.

HVisMyLife avatar Dec 18 '22 22:12 HVisMyLife