d@0: d@0:
d@0:d@0: d@0: d@0: Next: Caveats in Using Wisdom, d@0: Previous: Multi-dimensional Array Format, d@0: Up: Other Important Topics d@0:
d@0: FFTW implements a method for saving plans to disk and restoring them. d@0: In fact, what FFTW does is more general than just saving and loading d@0: plans. The mechanism is called wisdom. Here, we describe d@0: this feature at a high level. See FFTW Reference, for a less casual d@0: but more complete discussion of how to use wisdom in FFTW. d@0: d@0:
Plans created with the FFTW_MEASURE
, FFTW_PATIENT
, or
d@0: FFTW_EXHAUSTIVE
options produce near-optimal FFT performance,
d@0: but may require a long time to compute because FFTW must measure the
d@0: runtime of many possible plans and select the best one. This setup is
d@0: designed for the situations where so many transforms of the same size
d@0: must be computed that the start-up time is irrelevant. For short
d@0: initialization times, but slower transforms, we have provided
d@0: FFTW_ESTIMATE
. The wisdom
mechanism is a way to get the
d@0: best of both worlds: you compute a good plan once, save it to
d@0: disk, and later reload it as many times as necessary. The wisdom
d@0: mechanism can actually save and reload many plans at once, not just
d@0: one.
d@0:
d@0: Whenever you create a plan, the FFTW planner accumulates wisdom, which
d@0: is information sufficient to reconstruct the plan. After planning,
d@0: you can save this information to disk by means of the function:
d@0:
void fftw_export_wisdom_to_file(FILE *output_file); d@0:d@0:
d@0: The next time you run the program, you can restore the wisdom with
d@0: fftw_import_wisdom_from_file
(which returns non-zero on success),
d@0: and then recreate the plan using the same flags as before.
d@0:
int fftw_import_wisdom_from_file(FILE *input_file); d@0:d@0:
d@0: Wisdom is automatically used for any size to which it is applicable, as
d@0: long as the planner flags are not more “patient” than those with which
d@0: the wisdom was created. For example, wisdom created with
d@0: FFTW_MEASURE
can be used if you later plan with
d@0: FFTW_ESTIMATE
or FFTW_MEASURE
, but not with
d@0: FFTW_PATIENT
.
d@0:
d@0:
The wisdom
is cumulative, and is stored in a global, private
d@0: data structure managed internally by FFTW. The storage space required
d@0: is minimal, proportional to the logarithm of the sizes the wisdom was
d@0: generated from. If memory usage is a concern, however, the wisdom can
d@0: be forgotten and its associated memory freed by calling:
d@0:
void fftw_forget_wisdom(void); d@0:d@0:
d@0: Wisdom can be exported to a file, a string, or any other medium. d@0: For details, see Wisdom. d@0: d@0: d@0: