| cannam@127 | 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | 
| cannam@127 | 2 <html> | 
| cannam@127 | 3 <!-- This manual is for FFTW | 
| cannam@127 | 4 (version 3.3.5, 30 July 2016). | 
| cannam@127 | 5 | 
| cannam@127 | 6 Copyright (C) 2003 Matteo Frigo. | 
| cannam@127 | 7 | 
| cannam@127 | 8 Copyright (C) 2003 Massachusetts Institute of Technology. | 
| cannam@127 | 9 | 
| cannam@127 | 10 Permission is granted to make and distribute verbatim copies of this | 
| cannam@127 | 11 manual provided the copyright notice and this permission notice are | 
| cannam@127 | 12 preserved on all copies. | 
| cannam@127 | 13 | 
| cannam@127 | 14 Permission is granted to copy and distribute modified versions of this | 
| cannam@127 | 15 manual under the conditions for verbatim copying, provided that the | 
| cannam@127 | 16 entire resulting derived work is distributed under the terms of a | 
| cannam@127 | 17 permission notice identical to this one. | 
| cannam@127 | 18 | 
| cannam@127 | 19 Permission is granted to copy and distribute translations of this manual | 
| cannam@127 | 20 into another language, under the above conditions for modified versions, | 
| cannam@127 | 21 except that this permission notice may be stated in a translation | 
| cannam@127 | 22 approved by the Free Software Foundation. --> | 
| cannam@127 | 23 <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ --> | 
| cannam@127 | 24 <head> | 
| cannam@127 | 25 <title>FFTW 3.3.5: Words of Wisdom-Saving Plans</title> | 
| cannam@127 | 26 | 
| cannam@127 | 27 <meta name="description" content="FFTW 3.3.5: Words of Wisdom-Saving Plans"> | 
| cannam@127 | 28 <meta name="keywords" content="FFTW 3.3.5: Words of Wisdom-Saving Plans"> | 
| cannam@127 | 29 <meta name="resource-type" content="document"> | 
| cannam@127 | 30 <meta name="distribution" content="global"> | 
| cannam@127 | 31 <meta name="Generator" content="makeinfo"> | 
| cannam@127 | 32 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 
| cannam@127 | 33 <link href="index.html#Top" rel="start" title="Top"> | 
| cannam@127 | 34 <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> | 
| cannam@127 | 35 <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> | 
| cannam@127 | 36 <link href="Other-Important-Topics.html#Other-Important-Topics" rel="up" title="Other Important Topics"> | 
| cannam@127 | 37 <link href="Caveats-in-Using-Wisdom.html#Caveats-in-Using-Wisdom" rel="next" title="Caveats in Using Wisdom"> | 
| cannam@127 | 38 <link href="Dynamic-Arrays-in-C_002dThe-Wrong-Way.html#Dynamic-Arrays-in-C_002dThe-Wrong-Way" rel="prev" title="Dynamic Arrays in C-The Wrong Way"> | 
| cannam@127 | 39 <style type="text/css"> | 
| cannam@127 | 40 <!-- | 
| cannam@127 | 41 a.summary-letter {text-decoration: none} | 
| cannam@127 | 42 blockquote.smallquotation {font-size: smaller} | 
| cannam@127 | 43 div.display {margin-left: 3.2em} | 
| cannam@127 | 44 div.example {margin-left: 3.2em} | 
| cannam@127 | 45 div.indentedblock {margin-left: 3.2em} | 
| cannam@127 | 46 div.lisp {margin-left: 3.2em} | 
| cannam@127 | 47 div.smalldisplay {margin-left: 3.2em} | 
| cannam@127 | 48 div.smallexample {margin-left: 3.2em} | 
| cannam@127 | 49 div.smallindentedblock {margin-left: 3.2em; font-size: smaller} | 
| cannam@127 | 50 div.smalllisp {margin-left: 3.2em} | 
| cannam@127 | 51 kbd {font-style:oblique} | 
| cannam@127 | 52 pre.display {font-family: inherit} | 
| cannam@127 | 53 pre.format {font-family: inherit} | 
| cannam@127 | 54 pre.menu-comment {font-family: serif} | 
| cannam@127 | 55 pre.menu-preformatted {font-family: serif} | 
| cannam@127 | 56 pre.smalldisplay {font-family: inherit; font-size: smaller} | 
| cannam@127 | 57 pre.smallexample {font-size: smaller} | 
| cannam@127 | 58 pre.smallformat {font-family: inherit; font-size: smaller} | 
| cannam@127 | 59 pre.smalllisp {font-size: smaller} | 
| cannam@127 | 60 span.nocodebreak {white-space:nowrap} | 
| cannam@127 | 61 span.nolinebreak {white-space:nowrap} | 
| cannam@127 | 62 span.roman {font-family:serif; font-weight:normal} | 
| cannam@127 | 63 span.sansserif {font-family:sans-serif; font-weight:normal} | 
| cannam@127 | 64 ul.no-bullet {list-style: none} | 
| cannam@127 | 65 --> | 
| cannam@127 | 66 </style> | 
| cannam@127 | 67 | 
| cannam@127 | 68 | 
| cannam@127 | 69 </head> | 
| cannam@127 | 70 | 
| cannam@127 | 71 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> | 
| cannam@127 | 72 <a name="Words-of-Wisdom_002dSaving-Plans"></a> | 
| cannam@127 | 73 <div class="header"> | 
| cannam@127 | 74 <p> | 
| cannam@127 | 75 Next: <a href="Caveats-in-Using-Wisdom.html#Caveats-in-Using-Wisdom" accesskey="n" rel="next">Caveats in Using Wisdom</a>, Previous: <a href="Multi_002ddimensional-Array-Format.html#Multi_002ddimensional-Array-Format" accesskey="p" rel="prev">Multi-dimensional Array Format</a>, Up: <a href="Other-Important-Topics.html#Other-Important-Topics" accesskey="u" rel="up">Other Important Topics</a>   [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> | 
| cannam@127 | 76 </div> | 
| cannam@127 | 77 <hr> | 
| cannam@127 | 78 <a name="Words-of-Wisdom_002d_002d_002dSaving-Plans"></a> | 
| cannam@127 | 79 <h3 class="section">3.3 Words of Wisdom—Saving Plans</h3> | 
| cannam@127 | 80 <a name="index-wisdom"></a> | 
| cannam@127 | 81 <a name="index-saving-plans-to-disk"></a> | 
| cannam@127 | 82 | 
| cannam@127 | 83 <p>FFTW implements a method for saving plans to disk and restoring them. | 
| cannam@127 | 84 In fact, what FFTW does is more general than just saving and loading | 
| cannam@127 | 85 plans.  The mechanism is called <em>wisdom</em>.  Here, we describe | 
| cannam@127 | 86 this feature at a high level. See <a href="FFTW-Reference.html#FFTW-Reference">FFTW Reference</a>, for a less casual | 
| cannam@127 | 87 but more complete discussion of how to use wisdom in FFTW. | 
| cannam@127 | 88 </p> | 
| cannam@127 | 89 <p>Plans created with the <code>FFTW_MEASURE</code>, <code>FFTW_PATIENT</code>, or | 
| cannam@127 | 90 <code>FFTW_EXHAUSTIVE</code> options produce near-optimal FFT performance, | 
| cannam@127 | 91 but may require a long time to compute because FFTW must measure the | 
| cannam@127 | 92 runtime of many possible plans and select the best one.  This setup is | 
| cannam@127 | 93 designed for the situations where so many transforms of the same size | 
| cannam@127 | 94 must be computed that the start-up time is irrelevant.  For short | 
| cannam@127 | 95 initialization times, but slower transforms, we have provided | 
| cannam@127 | 96 <code>FFTW_ESTIMATE</code>.  The <code>wisdom</code> mechanism is a way to get the | 
| cannam@127 | 97 best of both worlds: you compute a good plan once, save it to | 
| cannam@127 | 98 disk, and later reload it as many times as necessary.  The wisdom | 
| cannam@127 | 99 mechanism can actually save and reload many plans at once, not just | 
| cannam@127 | 100 one. | 
| cannam@127 | 101 <a name="index-FFTW_005fMEASURE-1"></a> | 
| cannam@127 | 102 <a name="index-FFTW_005fPATIENT-1"></a> | 
| cannam@127 | 103 <a name="index-FFTW_005fEXHAUSTIVE"></a> | 
| cannam@127 | 104 <a name="index-FFTW_005fESTIMATE-1"></a> | 
| cannam@127 | 105 </p> | 
| cannam@127 | 106 | 
| cannam@127 | 107 <p>Whenever you create a plan, the FFTW planner accumulates wisdom, which | 
| cannam@127 | 108 is information sufficient to reconstruct the plan.  After planning, | 
| cannam@127 | 109 you can save this information to disk by means of the function: | 
| cannam@127 | 110 </p><div class="example"> | 
| cannam@127 | 111 <pre class="example">int fftw_export_wisdom_to_filename(const char *filename); | 
| cannam@127 | 112 </pre></div> | 
| cannam@127 | 113 <a name="index-fftw_005fexport_005fwisdom_005fto_005ffilename"></a> | 
| cannam@127 | 114 <p>(This function returns non-zero on success.) | 
| cannam@127 | 115 </p> | 
| cannam@127 | 116 <p>The next time you run the program, you can restore the wisdom with | 
| cannam@127 | 117 <code>fftw_import_wisdom_from_filename</code> (which also returns non-zero on success), | 
| cannam@127 | 118 and then recreate the plan using the same flags as before. | 
| cannam@127 | 119 </p><div class="example"> | 
| cannam@127 | 120 <pre class="example">int fftw_import_wisdom_from_filename(const char *filename); | 
| cannam@127 | 121 </pre></div> | 
| cannam@127 | 122 <a name="index-fftw_005fimport_005fwisdom_005ffrom_005ffilename"></a> | 
| cannam@127 | 123 | 
| cannam@127 | 124 <p>Wisdom is automatically used for any size to which it is applicable, as | 
| cannam@127 | 125 long as the planner flags are not more “patient” than those with which | 
| cannam@127 | 126 the wisdom was created.  For example, wisdom created with | 
| cannam@127 | 127 <code>FFTW_MEASURE</code> can be used if you later plan with | 
| cannam@127 | 128 <code>FFTW_ESTIMATE</code> or <code>FFTW_MEASURE</code>, but not with | 
| cannam@127 | 129 <code>FFTW_PATIENT</code>. | 
| cannam@127 | 130 </p> | 
| cannam@127 | 131 <p>The <code>wisdom</code> is cumulative, and is stored in a global, private | 
| cannam@127 | 132 data structure managed internally by FFTW.  The storage space required | 
| cannam@127 | 133 is minimal, proportional to the logarithm of the sizes the wisdom was | 
| cannam@127 | 134 generated from.  If memory usage is a concern, however, the wisdom can | 
| cannam@127 | 135 be forgotten and its associated memory freed by calling: | 
| cannam@127 | 136 </p><div class="example"> | 
| cannam@127 | 137 <pre class="example">void fftw_forget_wisdom(void); | 
| cannam@127 | 138 </pre></div> | 
| cannam@127 | 139 <a name="index-fftw_005fforget_005fwisdom"></a> | 
| cannam@127 | 140 | 
| cannam@127 | 141 <p>Wisdom can be exported to a file, a string, or any other medium. | 
| cannam@127 | 142 For details, see <a href="Wisdom.html#Wisdom">Wisdom</a>. | 
| cannam@127 | 143 </p> | 
| cannam@127 | 144 <hr> | 
| cannam@127 | 145 <div class="header"> | 
| cannam@127 | 146 <p> | 
| cannam@127 | 147 Next: <a href="Caveats-in-Using-Wisdom.html#Caveats-in-Using-Wisdom" accesskey="n" rel="next">Caveats in Using Wisdom</a>, Previous: <a href="Multi_002ddimensional-Array-Format.html#Multi_002ddimensional-Array-Format" accesskey="p" rel="prev">Multi-dimensional Array Format</a>, Up: <a href="Other-Important-Topics.html#Other-Important-Topics" accesskey="u" rel="up">Other Important Topics</a>   [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> | 
| cannam@127 | 148 </div> | 
| cannam@127 | 149 | 
| cannam@127 | 150 | 
| cannam@127 | 151 | 
| cannam@127 | 152 </body> | 
| cannam@127 | 153 </html> |