annotate Lib/fftw-3.2.1/doc/html/.svn/text-base/Usage-of-Multi_002dthreaded-FFTW.html.svn-base @ 9:262e084a15a9

Vectorised everything and made use of unique_ptr so there should be no more memory leaks. Hurrah for RAII
author Geogaddi\David <d.m.ronan@qmul.ac.uk>
date Wed, 12 Aug 2015 22:25:06 +0100
parents 25bf17994ef1
children
rev   line source
d@0 1 <html lang="en">
d@0 2 <head>
d@0 3 <title>Usage of Multi-threaded FFTW - FFTW 3.2.1</title>
d@0 4 <meta http-equiv="Content-Type" content="text/html">
d@0 5 <meta name="description" content="FFTW 3.2.1">
d@0 6 <meta name="generator" content="makeinfo 4.8">
d@0 7 <link title="Top" rel="start" href="index.html#Top">
d@0 8 <link rel="up" href="Multi_002dthreaded-FFTW.html#Multi_002dthreaded-FFTW" title="Multi-threaded FFTW">
d@0 9 <link rel="prev" href="Installation-and-Supported-Hardware_002fSoftware.html#Installation-and-Supported-Hardware_002fSoftware" title="Installation and Supported Hardware/Software">
d@0 10 <link rel="next" href="How-Many-Threads-to-Use_003f.html#How-Many-Threads-to-Use_003f" title="How Many Threads to Use?">
d@0 11 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
d@0 12 <!--
d@0 13 This manual is for FFTW
d@0 14 (version 3.2.1, 5 February 2009).
d@0 15
d@0 16 Copyright (C) 2003 Matteo Frigo.
d@0 17
d@0 18 Copyright (C) 2003 Massachusetts Institute of Technology.
d@0 19
d@0 20 Permission is granted to make and distribute verbatim copies of
d@0 21 this manual provided the copyright notice and this permission
d@0 22 notice are preserved on all copies.
d@0 23
d@0 24 Permission is granted to copy and distribute modified versions of
d@0 25 this manual under the conditions for verbatim copying, provided
d@0 26 that the entire resulting derived work is distributed under the
d@0 27 terms of a permission notice identical to this one.
d@0 28
d@0 29 Permission is granted to copy and distribute translations of this
d@0 30 manual into another language, under the above conditions for
d@0 31 modified versions, except that this permission notice may be
d@0 32 stated in a translation approved by the Free Software Foundation.
d@0 33 -->
d@0 34 <meta http-equiv="Content-Style-Type" content="text/css">
d@0 35 <style type="text/css"><!--
d@0 36 pre.display { font-family:inherit }
d@0 37 pre.format { font-family:inherit }
d@0 38 pre.smalldisplay { font-family:inherit; font-size:smaller }
d@0 39 pre.smallformat { font-family:inherit; font-size:smaller }
d@0 40 pre.smallexample { font-size:smaller }
d@0 41 pre.smalllisp { font-size:smaller }
d@0 42 span.sc { font-variant:small-caps }
d@0 43 span.roman { font-family:serif; font-weight:normal; }
d@0 44 span.sansserif { font-family:sans-serif; font-weight:normal; }
d@0 45 --></style>
d@0 46 </head>
d@0 47 <body>
d@0 48 <div class="node">
d@0 49 <p>
d@0 50 <a name="Usage-of-Multi-threaded-FFTW"></a>
d@0 51 <a name="Usage-of-Multi_002dthreaded-FFTW"></a>
d@0 52 Next:&nbsp;<a rel="next" accesskey="n" href="How-Many-Threads-to-Use_003f.html#How-Many-Threads-to-Use_003f">How Many Threads to Use?</a>,
d@0 53 Previous:&nbsp;<a rel="previous" accesskey="p" href="Installation-and-Supported-Hardware_002fSoftware.html#Installation-and-Supported-Hardware_002fSoftware">Installation and Supported Hardware/Software</a>,
d@0 54 Up:&nbsp;<a rel="up" accesskey="u" href="Multi_002dthreaded-FFTW.html#Multi_002dthreaded-FFTW">Multi-threaded FFTW</a>
d@0 55 <hr>
d@0 56 </div>
d@0 57
d@0 58 <h3 class="section">5.2 Usage of Multi-threaded FFTW</h3>
d@0 59
d@0 60 <p>Here, it is assumed that the reader is already familiar with the usage
d@0 61 of the uniprocessor FFTW routines, described elsewhere in this manual.
d@0 62 We only describe what one has to change in order to use the
d@0 63 multi-threaded routines.
d@0 64
d@0 65 <p>First, programs using the parallel complex transforms should be linked with
d@0 66 <code>-lfftw3_threads -lfftw3 -lm</code> on Unix. You will also need to link
d@0 67 with whatever library is responsible for threads on your system
d@0 68 (e.g. <code>-lpthread</code> on GNU/Linux).
d@0 69 <a name="index-linking-on-Unix-321"></a>
d@0 70 Second, before calling <em>any</em> FFTW routines, you should call the
d@0 71 function:
d@0 72
d@0 73 <pre class="example"> int fftw_init_threads(void);
d@0 74 </pre>
d@0 75 <p><a name="index-fftw_005finit_005fthreads-322"></a>
d@0 76 This function, which need only be called once, performs any one-time
d@0 77 initialization required to use threads on your system. It returns zero
d@0 78 if there was some error (which should not happen under normal
d@0 79 circumstances) and a non-zero value otherwise.
d@0 80
d@0 81 <p>Third, before creating a plan that you want to parallelize, you should
d@0 82 call:
d@0 83
d@0 84 <pre class="example"> void fftw_plan_with_nthreads(int nthreads);
d@0 85 </pre>
d@0 86 <p><a name="index-fftw_005fplan_005fwith_005fnthreads-323"></a>
d@0 87 The <code>nthreads</code> argument indicates the number of threads you want
d@0 88 FFTW to use (or actually, the maximum number). All plans subsequently
d@0 89 created with any planner routine will use that many threads. You can
d@0 90 call <code>fftw_plan_with_nthreads</code>, create some plans, call
d@0 91 <code>fftw_plan_with_nthreads</code> again with a different argument, and
d@0 92 create some more plans for a new number of threads. Plans already created
d@0 93 before a call to <code>fftw_plan_with_nthreads</code> are unaffected. If you
d@0 94 pass an <code>nthreads</code> argument of <code>1</code> (the default), threads are
d@0 95 disabled for subsequent plans.
d@0 96
d@0 97 <p>Given a plan, you then execute it as usual with
d@0 98 <code>fftw_execute(plan)</code>, and the execution will use the number of
d@0 99 threads specified when the plan was created. When done, you destroy it
d@0 100 as usual with <code>fftw_destroy_plan</code>.
d@0 101
d@0 102 <p>There is one additional routine: if you want to get rid of all memory
d@0 103 and other resources allocated internally by FFTW, you can call:
d@0 104
d@0 105 <pre class="example"> void fftw_cleanup_threads(void);
d@0 106 </pre>
d@0 107 <p><a name="index-fftw_005fcleanup_005fthreads-324"></a>
d@0 108 which is much like the <code>fftw_cleanup()</code> function except that it
d@0 109 also gets rid of threads-related data. You must <em>not</em> execute any
d@0 110 previously created plans after calling this function.
d@0 111
d@0 112 <p>We should also mention one other restriction: if you save wisdom from a
d@0 113 program using the multi-threaded FFTW, that wisdom <em>cannot be used</em>
d@0 114 by a program using only the single-threaded FFTW (i.e. not calling
d@0 115 <code>fftw_init_threads</code>). See <a href="Words-of-Wisdom_002dSaving-Plans.html#Words-of-Wisdom_002dSaving-Plans">Words of Wisdom-Saving Plans</a>.
d@0 116
d@0 117 <!-- -->
d@0 118 </body></html>
d@0 119