npadmana / DistributedFFT

6 stars 2 forks source link

Optimize plan creation when wisdom already exists #56

Closed ronawho closed 4 years ago

ronawho commented 4 years ago

FFTW caches wisdom for plans it has already seen. When wisdom is already available for a plan, FFTW doesn't touch the input/output arrays so we can avoid an array allocation (which is relatively cheap, but not free.) This eliminates any overhead from getting plans after the initial wisdom has been created.

From the FFTW docs:

FFTW_WISDOM_ONLY is a special planning mode in which the plan is only
created if wisdom is available for the given problem, and otherwise a
NULL plan is returned. This can be combined with other flags, e.g.
‘FFTW_WISDOM_ONLY | FFTW_PATIENT’ creates a plan only if wisdom is
available that was created in FFTW_PATIENT or FFTW_EXHAUSTIVE mode. The
FFTW_WISDOM_ONLY flag is intended for users who need to detect whether
wisdom is available; for example, if wisdom is not available one may
wish to allocate new arrays for planning so that user data is not
overwritten.

This has minor performance improvements for NPB-FT

Results at 256 nodes:

size before after
D 2.27 s 1.82 s
E 16.98 s 16.31 s
F 139.29 s 136.19 s