annotate src/fftw-3.3.5/doc/html/Using-Plans.html @ 42:2cd0e3b3e1fd

Current fftw source
author Chris Cannam
date Tue, 18 Oct 2016 13:40:26 +0100
parents
children
rev   line source
Chris@42 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Chris@42 2 <html>
Chris@42 3 <!-- This manual is for FFTW
Chris@42 4 (version 3.3.5, 30 July 2016).
Chris@42 5
Chris@42 6 Copyright (C) 2003 Matteo Frigo.
Chris@42 7
Chris@42 8 Copyright (C) 2003 Massachusetts Institute of Technology.
Chris@42 9
Chris@42 10 Permission is granted to make and distribute verbatim copies of this
Chris@42 11 manual provided the copyright notice and this permission notice are
Chris@42 12 preserved on all copies.
Chris@42 13
Chris@42 14 Permission is granted to copy and distribute modified versions of this
Chris@42 15 manual under the conditions for verbatim copying, provided that the
Chris@42 16 entire resulting derived work is distributed under the terms of a
Chris@42 17 permission notice identical to this one.
Chris@42 18
Chris@42 19 Permission is granted to copy and distribute translations of this manual
Chris@42 20 into another language, under the above conditions for modified versions,
Chris@42 21 except that this permission notice may be stated in a translation
Chris@42 22 approved by the Free Software Foundation. -->
Chris@42 23 <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
Chris@42 24 <head>
Chris@42 25 <title>FFTW 3.3.5: Using Plans</title>
Chris@42 26
Chris@42 27 <meta name="description" content="FFTW 3.3.5: Using Plans">
Chris@42 28 <meta name="keywords" content="FFTW 3.3.5: Using Plans">
Chris@42 29 <meta name="resource-type" content="document">
Chris@42 30 <meta name="distribution" content="global">
Chris@42 31 <meta name="Generator" content="makeinfo">
Chris@42 32 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Chris@42 33 <link href="index.html#Top" rel="start" title="Top">
Chris@42 34 <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
Chris@42 35 <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
Chris@42 36 <link href="FFTW-Reference.html#FFTW-Reference" rel="up" title="FFTW Reference">
Chris@42 37 <link href="Basic-Interface.html#Basic-Interface" rel="next" title="Basic Interface">
Chris@42 38 <link href="Memory-Allocation.html#Memory-Allocation" rel="prev" title="Memory Allocation">
Chris@42 39 <style type="text/css">
Chris@42 40 <!--
Chris@42 41 a.summary-letter {text-decoration: none}
Chris@42 42 blockquote.smallquotation {font-size: smaller}
Chris@42 43 div.display {margin-left: 3.2em}
Chris@42 44 div.example {margin-left: 3.2em}
Chris@42 45 div.indentedblock {margin-left: 3.2em}
Chris@42 46 div.lisp {margin-left: 3.2em}
Chris@42 47 div.smalldisplay {margin-left: 3.2em}
Chris@42 48 div.smallexample {margin-left: 3.2em}
Chris@42 49 div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
Chris@42 50 div.smalllisp {margin-left: 3.2em}
Chris@42 51 kbd {font-style:oblique}
Chris@42 52 pre.display {font-family: inherit}
Chris@42 53 pre.format {font-family: inherit}
Chris@42 54 pre.menu-comment {font-family: serif}
Chris@42 55 pre.menu-preformatted {font-family: serif}
Chris@42 56 pre.smalldisplay {font-family: inherit; font-size: smaller}
Chris@42 57 pre.smallexample {font-size: smaller}
Chris@42 58 pre.smallformat {font-family: inherit; font-size: smaller}
Chris@42 59 pre.smalllisp {font-size: smaller}
Chris@42 60 span.nocodebreak {white-space:nowrap}
Chris@42 61 span.nolinebreak {white-space:nowrap}
Chris@42 62 span.roman {font-family:serif; font-weight:normal}
Chris@42 63 span.sansserif {font-family:sans-serif; font-weight:normal}
Chris@42 64 ul.no-bullet {list-style: none}
Chris@42 65 -->
Chris@42 66 </style>
Chris@42 67
Chris@42 68
Chris@42 69 </head>
Chris@42 70
Chris@42 71 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
Chris@42 72 <a name="Using-Plans"></a>
Chris@42 73 <div class="header">
Chris@42 74 <p>
Chris@42 75 Next: <a href="Basic-Interface.html#Basic-Interface" accesskey="n" rel="next">Basic Interface</a>, Previous: <a href="Data-Types-and-Files.html#Data-Types-and-Files" accesskey="p" rel="prev">Data Types and Files</a>, Up: <a href="FFTW-Reference.html#FFTW-Reference" accesskey="u" rel="up">FFTW Reference</a> &nbsp; [<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>
Chris@42 76 </div>
Chris@42 77 <hr>
Chris@42 78 <a name="Using-Plans-1"></a>
Chris@42 79 <h3 class="section">4.2 Using Plans</h3>
Chris@42 80
Chris@42 81 <p>Plans for all transform types in FFTW are stored as type
Chris@42 82 <code>fftw_plan</code> (an opaque pointer type), and are created by one of the
Chris@42 83 various planning routines described in the following sections.
Chris@42 84 <a name="index-fftw_005fplan-1"></a>
Chris@42 85 An <code>fftw_plan</code> contains all information necessary to compute the
Chris@42 86 transform, including the pointers to the input and output arrays.
Chris@42 87 </p>
Chris@42 88 <div class="example">
Chris@42 89 <pre class="example">void fftw_execute(const fftw_plan plan);
Chris@42 90 </pre></div>
Chris@42 91 <a name="index-fftw_005fexecute-1"></a>
Chris@42 92
Chris@42 93 <p>This executes the <code>plan</code>, to compute the corresponding transform on
Chris@42 94 the arrays for which it was planned (which must still exist). The plan
Chris@42 95 is not modified, and <code>fftw_execute</code> can be called as many times as
Chris@42 96 desired.
Chris@42 97 </p>
Chris@42 98 <p>To apply a given plan to a different array, you can use the new-array execute
Chris@42 99 interface. See <a href="New_002darray-Execute-Functions.html#New_002darray-Execute-Functions">New-array Execute Functions</a>.
Chris@42 100 </p>
Chris@42 101 <p><code>fftw_execute</code> (and equivalents) is the only function in FFTW
Chris@42 102 guaranteed to be thread-safe; see <a href="Thread-safety.html#Thread-safety">Thread safety</a>.
Chris@42 103 </p>
Chris@42 104 <p>This function:
Chris@42 105 </p><div class="example">
Chris@42 106 <pre class="example">void fftw_destroy_plan(fftw_plan plan);
Chris@42 107 </pre></div>
Chris@42 108 <a name="index-fftw_005fdestroy_005fplan-1"></a>
Chris@42 109 <p>deallocates the <code>plan</code> and all its associated data.
Chris@42 110 </p>
Chris@42 111 <p>FFTW&rsquo;s planner saves some other persistent data, such as the
Chris@42 112 accumulated wisdom and a list of algorithms available in the current
Chris@42 113 configuration. If you want to deallocate all of that and reset FFTW
Chris@42 114 to the pristine state it was in when you started your program, you can
Chris@42 115 call:
Chris@42 116 </p>
Chris@42 117 <div class="example">
Chris@42 118 <pre class="example">void fftw_cleanup(void);
Chris@42 119 </pre></div>
Chris@42 120 <a name="index-fftw_005fcleanup"></a>
Chris@42 121
Chris@42 122 <p>After calling <code>fftw_cleanup</code>, all existing plans become undefined,
Chris@42 123 and you should not attempt to execute them nor to destroy them. You can
Chris@42 124 however create and execute/destroy new plans, in which case FFTW starts
Chris@42 125 accumulating wisdom information again.
Chris@42 126 </p>
Chris@42 127 <p><code>fftw_cleanup</code> does not deallocate your plans, however. To prevent
Chris@42 128 memory leaks, you must still call <code>fftw_destroy_plan</code> before
Chris@42 129 executing <code>fftw_cleanup</code>.
Chris@42 130 </p>
Chris@42 131 <p>Occasionally, it may useful to know FFTW&rsquo;s internal &ldquo;cost&rdquo; metric
Chris@42 132 that it uses to compare plans to one another; this cost is
Chris@42 133 proportional to an execution time of the plan, in undocumented units,
Chris@42 134 if the plan was created with the <code>FFTW_MEASURE</code> or other
Chris@42 135 timing-based options, or alternatively is a heuristic cost function
Chris@42 136 for <code>FFTW_ESTIMATE</code> plans. (The cost values of measured and
Chris@42 137 estimated plans are not comparable, being in different units. Also,
Chris@42 138 costs from different FFTW versions or the same version compiled
Chris@42 139 differently may not be in the same units. Plans created from wisdom
Chris@42 140 have a cost of 0 since no timing measurement is performed for them.
Chris@42 141 Finally, certain problems for which only one top-level algorithm was
Chris@42 142 possible may have required no measurements of the cost of the whole
Chris@42 143 plan, in which case <code>fftw_cost</code> will also return 0.) The cost
Chris@42 144 metric for a given plan is returned by:
Chris@42 145 </p>
Chris@42 146 <div class="example">
Chris@42 147 <pre class="example">double fftw_cost(const fftw_plan plan);
Chris@42 148 </pre></div>
Chris@42 149 <a name="index-fftw_005fcost"></a>
Chris@42 150
Chris@42 151 <p>The following two routines are provided purely for academic purposes
Chris@42 152 (that is, for entertainment).
Chris@42 153 </p>
Chris@42 154 <div class="example">
Chris@42 155 <pre class="example">void fftw_flops(const fftw_plan plan,
Chris@42 156 double *add, double *mul, double *fma);
Chris@42 157 </pre></div>
Chris@42 158 <a name="index-fftw_005fflops"></a>
Chris@42 159
Chris@42 160 <p>Given a <code>plan</code>, set <code>add</code>, <code>mul</code>, and <code>fma</code> to an
Chris@42 161 exact count of the number of floating-point additions, multiplications,
Chris@42 162 and fused multiply-add operations involved in the plan&rsquo;s execution. The
Chris@42 163 total number of floating-point operations (flops) is <code>add + mul +
Chris@42 164 2*fma</code>, or <code>add + mul + fma</code> if the hardware supports fused
Chris@42 165 multiply-add instructions (although the number of FMA operations is only
Chris@42 166 approximate because of compiler voodoo). (The number of operations
Chris@42 167 should be an integer, but we use <code>double</code> to avoid overflowing
Chris@42 168 <code>int</code> for large transforms; the arguments are of type <code>double</code>
Chris@42 169 even for single and long-double precision versions of FFTW.)
Chris@42 170 </p>
Chris@42 171 <div class="example">
Chris@42 172 <pre class="example">void fftw_fprint_plan(const fftw_plan plan, FILE *output_file);
Chris@42 173 void fftw_print_plan(const fftw_plan plan);
Chris@42 174 char *fftw_sprint_plan(const fftw_plan plan);
Chris@42 175 </pre></div>
Chris@42 176 <a name="index-fftw_005ffprint_005fplan"></a>
Chris@42 177 <a name="index-fftw_005fprint_005fplan"></a>
Chris@42 178
Chris@42 179 <p>This outputs a &ldquo;nerd-readable&rdquo; representation of the <code>plan</code> to
Chris@42 180 the given file, to <code>stdout</code>, or two a newly allocated
Chris@42 181 NUL-terminated string (which the caller is responsible for deallocating
Chris@42 182 with <code>free</code>), respectively.
Chris@42 183 </p>
Chris@42 184 <hr>
Chris@42 185 <div class="header">
Chris@42 186 <p>
Chris@42 187 Next: <a href="Basic-Interface.html#Basic-Interface" accesskey="n" rel="next">Basic Interface</a>, Previous: <a href="Data-Types-and-Files.html#Data-Types-and-Files" accesskey="p" rel="prev">Data Types and Files</a>, Up: <a href="FFTW-Reference.html#FFTW-Reference" accesskey="u" rel="up">FFTW Reference</a> &nbsp; [<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>
Chris@42 188 </div>
Chris@42 189
Chris@42 190
Chris@42 191
Chris@42 192 </body>
Chris@42 193 </html>