cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: FFTW 3.3.5: Words of Wisdom-Saving Plans cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127:
cannam@127:

cannam@127: Next: , Previous: , Up: Other Important Topics   [Contents][Index]

cannam@127:
cannam@127:
cannam@127: cannam@127:

3.3 Words of Wisdom—Saving Plans

cannam@127: cannam@127: cannam@127: cannam@127:

FFTW implements a method for saving plans to disk and restoring them. cannam@127: In fact, what FFTW does is more general than just saving and loading cannam@127: plans. The mechanism is called wisdom. Here, we describe cannam@127: this feature at a high level. See FFTW Reference, for a less casual cannam@127: but more complete discussion of how to use wisdom in FFTW. cannam@127:

cannam@127:

Plans created with the FFTW_MEASURE, FFTW_PATIENT, or cannam@127: FFTW_EXHAUSTIVE options produce near-optimal FFT performance, cannam@127: but may require a long time to compute because FFTW must measure the cannam@127: runtime of many possible plans and select the best one. This setup is cannam@127: designed for the situations where so many transforms of the same size cannam@127: must be computed that the start-up time is irrelevant. For short cannam@127: initialization times, but slower transforms, we have provided cannam@127: FFTW_ESTIMATE. The wisdom mechanism is a way to get the cannam@127: best of both worlds: you compute a good plan once, save it to cannam@127: disk, and later reload it as many times as necessary. The wisdom cannam@127: mechanism can actually save and reload many plans at once, not just cannam@127: one. cannam@127: cannam@127: cannam@127: cannam@127: cannam@127:

cannam@127: cannam@127:

Whenever you create a plan, the FFTW planner accumulates wisdom, which cannam@127: is information sufficient to reconstruct the plan. After planning, cannam@127: you can save this information to disk by means of the function: cannam@127:

cannam@127:
int fftw_export_wisdom_to_filename(const char *filename);
cannam@127: 
cannam@127: cannam@127:

(This function returns non-zero on success.) cannam@127:

cannam@127:

The next time you run the program, you can restore the wisdom with cannam@127: fftw_import_wisdom_from_filename (which also returns non-zero on success), cannam@127: and then recreate the plan using the same flags as before. cannam@127:

cannam@127:
int fftw_import_wisdom_from_filename(const char *filename);
cannam@127: 
cannam@127: cannam@127: cannam@127:

Wisdom is automatically used for any size to which it is applicable, as cannam@127: long as the planner flags are not more “patient” than those with which cannam@127: the wisdom was created. For example, wisdom created with cannam@127: FFTW_MEASURE can be used if you later plan with cannam@127: FFTW_ESTIMATE or FFTW_MEASURE, but not with cannam@127: FFTW_PATIENT. cannam@127:

cannam@127:

The wisdom is cumulative, and is stored in a global, private cannam@127: data structure managed internally by FFTW. The storage space required cannam@127: is minimal, proportional to the logarithm of the sizes the wisdom was cannam@127: generated from. If memory usage is a concern, however, the wisdom can cannam@127: be forgotten and its associated memory freed by calling: cannam@127:

cannam@127:
void fftw_forget_wisdom(void);
cannam@127: 
cannam@127: cannam@127: cannam@127:

Wisdom can be exported to a file, a string, or any other medium. cannam@127: For details, see Wisdom. cannam@127:

cannam@127:
cannam@127:
cannam@127:

cannam@127: Next: , Previous: , Up: Other Important Topics   [Contents][Index]

cannam@127:
cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: