3
<title>Words of Wisdom-Saving Plans - FFTW 3.1.2</title>
4
<meta http-equiv="Content-Type" content="text/html">
5
<meta name="description" content="FFTW 3.1.2">
6
<meta name="generator" content="makeinfo 4.8">
7
<link title="Top" rel="start" href="index.html#Top">
8
<link rel="up" href="Other-Important-Topics.html#Other-Important-Topics" title="Other Important Topics">
9
<link rel="prev" href="Multi_002ddimensional-Array-Format.html#Multi_002ddimensional-Array-Format" title="Multi-dimensional Array Format">
10
<link rel="next" href="Caveats-in-Using-Wisdom.html#Caveats-in-Using-Wisdom" title="Caveats in Using Wisdom">
11
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
13
This manual is for FFTW
14
(version 3.1.2, 23 June 2006).
16
Copyright (C) 2003 Matteo Frigo.
18
Copyright (C) 2003 Massachusetts Institute of Technology.
20
Permission is granted to make and distribute verbatim copies of
21
this manual provided the copyright notice and this permission
22
notice are preserved on all copies.
24
Permission is granted to copy and distribute modified versions of
25
this manual under the conditions for verbatim copying, provided
26
that the entire resulting derived work is distributed under the
27
terms of a permission notice identical to this one.
29
Permission is granted to copy and distribute translations of this
30
manual into another language, under the above conditions for
31
modified versions, except that this permission notice may be
32
stated in a translation approved by the Free Software Foundation.
34
<meta http-equiv="Content-Style-Type" content="text/css">
35
<style type="text/css"><!--
36
pre.display { font-family:inherit }
37
pre.format { font-family:inherit }
38
pre.smalldisplay { font-family:inherit; font-size:smaller }
39
pre.smallformat { font-family:inherit; font-size:smaller }
40
pre.smallexample { font-size:smaller }
41
pre.smalllisp { font-size:smaller }
42
span.sc { font-variant:small-caps }
43
span.roman { font-family:serif; font-weight:normal; }
44
span.sansserif { font-family:sans-serif; font-weight:normal; }
50
<a name="Words-of-Wisdom-Saving-Plans"></a>
51
<a name="Words-of-Wisdom_002dSaving-Plans"></a>
52
Next: <a rel="next" accesskey="n" href="Caveats-in-Using-Wisdom.html#Caveats-in-Using-Wisdom">Caveats in Using Wisdom</a>,
53
Previous: <a rel="previous" accesskey="p" href="Multi_002ddimensional-Array-Format.html#Multi_002ddimensional-Array-Format">Multi-dimensional Array Format</a>,
54
Up: <a rel="up" accesskey="u" href="Other-Important-Topics.html#Other-Important-Topics">Other Important Topics</a>
58
<h3 class="section">3.3 Words of Wisdom—Saving Plans</h3>
60
<p><a name="index-wisdom-121"></a><a name="index-saving-plans-to-disk-122"></a>
61
FFTW implements a method for saving plans to disk and restoring them.
62
In fact, what FFTW does is more general than just saving and loading
63
plans. The mechanism is called <dfn>wisdom</dfn>. Here, we describe
64
this feature at a high level. See <a href="FFTW-Reference.html#FFTW-Reference">FFTW Reference</a>, for a less casual
65
but more complete discussion of how to use wisdom in FFTW.
67
<p>Plans created with the <code>FFTW_MEASURE</code>, <code>FFTW_PATIENT</code>, or
68
<code>FFTW_EXHAUSTIVE</code> options produce near-optimal FFT performance,
69
but may require a long time to compute because FFTW must measure the
70
runtime of many possible plans and select the best one. This setup is
71
designed for the situations where so many transforms of the same size
72
must be computed that the start-up time is irrelevant. For short
73
initialization times, but slower transforms, we have provided
74
<code>FFTW_ESTIMATE</code>. The <code>wisdom</code> mechanism is a way to get the
75
best of both worlds: you compute a good plan once, save it to
76
disk, and later reload it as many times as necessary. The wisdom
77
mechanism can actually save and reload many plans at once, not just
79
<a name="index-FFTW_005fMEASURE-123"></a><a name="index-FFTW_005fPATIENT-124"></a><a name="index-FFTW_005fEXHAUSTIVE-125"></a><a name="index-FFTW_005fESTIMATE-126"></a>
80
Whenever you create a plan, the FFTW planner accumulates wisdom, which
81
is information sufficient to reconstruct the plan. After planning,
82
you can save this information to disk by means of the function:
83
<pre class="example"> void fftw_export_wisdom_to_file(FILE *output_file);
85
<p><a name="index-fftw_005fexport_005fwisdom_005fto_005ffile-127"></a>
86
The next time you run the program, you can restore the wisdom with
87
<code>fftw_import_wisdom_from_file</code> (which returns non-zero on success),
88
and then recreate the plan using the same flags as before.
89
<pre class="example"> int fftw_import_wisdom_from_file(FILE *input_file);
91
<p><a name="index-fftw_005fimport_005fwisdom_005ffrom_005ffile-128"></a>
92
Wisdom is automatically used for any size to which it is applicable, as
93
long as the planner flags are not more “patient” than those with which
94
the wisdom was created. For example, wisdom created with
95
<code>FFTW_MEASURE</code> can be used if you later plan with
96
<code>FFTW_ESTIMATE</code> or <code>FFTW_MEASURE</code>, but not with
97
<code>FFTW_PATIENT</code>.
99
<p>The <code>wisdom</code> is cumulative, and is stored in a global, private
100
data structure managed internally by FFTW. The storage space required
101
is minimal, proportional to the logarithm of the sizes the wisdom was
102
generated from. If memory usage is a concern, however, the wisdom can
103
be forgotten and its associated memory freed by calling:
104
<pre class="example"> void fftw_forget_wisdom(void);
106
<p><a name="index-fftw_005fforget_005fwisdom-129"></a>
107
Wisdom can be exported to a file, a string, or any other medium.
108
For details, see <a href="Wisdom.html#Wisdom">Wisdom</a>.