comparison Lib/fftw-3.2.1/doc/html/.svn/text-base/Usage-of-Multi_002dthreaded-FFTW.html.svn-base @ 15:585caf503ef5 tip

Tidy up for ROLI
author Geogaddi\David <d.m.ronan@qmul.ac.uk>
date Tue, 17 May 2016 18:50:19 +0100
parents 636c989477e7
children
comparison
equal deleted inserted replaced
14:636c989477e7 15:585caf503ef5
1 <html lang="en">
2 <head>
3 <title>Usage of Multi-threaded FFTW - FFTW 3.2.1</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="FFTW 3.2.1">
6 <meta name="generator" content="makeinfo 4.8">
7 <link title="Top" rel="start" href="index.html#Top">
8 <link rel="up" href="Multi_002dthreaded-FFTW.html#Multi_002dthreaded-FFTW" title="Multi-threaded FFTW">
9 <link rel="prev" href="Installation-and-Supported-Hardware_002fSoftware.html#Installation-and-Supported-Hardware_002fSoftware" title="Installation and Supported Hardware/Software">
10 <link rel="next" href="How-Many-Threads-to-Use_003f.html#How-Many-Threads-to-Use_003f" title="How Many Threads to Use?">
11 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12 <!--
13 This manual is for FFTW
14 (version 3.2.1, 5 February 2009).
15
16 Copyright (C) 2003 Matteo Frigo.
17
18 Copyright (C) 2003 Massachusetts Institute of Technology.
19
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.
23
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.
28
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.
33 -->
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; }
45 --></style>
46 </head>
47 <body>
48 <div class="node">
49 <p>
50 <a name="Usage-of-Multi-threaded-FFTW"></a>
51 <a name="Usage-of-Multi_002dthreaded-FFTW"></a>
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>,
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>,
54 Up:&nbsp;<a rel="up" accesskey="u" href="Multi_002dthreaded-FFTW.html#Multi_002dthreaded-FFTW">Multi-threaded FFTW</a>
55 <hr>
56 </div>
57
58 <h3 class="section">5.2 Usage of Multi-threaded FFTW</h3>
59
60 <p>Here, it is assumed that the reader is already familiar with the usage
61 of the uniprocessor FFTW routines, described elsewhere in this manual.
62 We only describe what one has to change in order to use the
63 multi-threaded routines.
64
65 <p>First, programs using the parallel complex transforms should be linked with
66 <code>-lfftw3_threads -lfftw3 -lm</code> on Unix. You will also need to link
67 with whatever library is responsible for threads on your system
68 (e.g. <code>-lpthread</code> on GNU/Linux).
69 <a name="index-linking-on-Unix-321"></a>
70 Second, before calling <em>any</em> FFTW routines, you should call the
71 function:
72
73 <pre class="example"> int fftw_init_threads(void);
74 </pre>
75 <p><a name="index-fftw_005finit_005fthreads-322"></a>
76 This function, which need only be called once, performs any one-time
77 initialization required to use threads on your system. It returns zero
78 if there was some error (which should not happen under normal
79 circumstances) and a non-zero value otherwise.
80
81 <p>Third, before creating a plan that you want to parallelize, you should
82 call:
83
84 <pre class="example"> void fftw_plan_with_nthreads(int nthreads);
85 </pre>
86 <p><a name="index-fftw_005fplan_005fwith_005fnthreads-323"></a>
87 The <code>nthreads</code> argument indicates the number of threads you want
88 FFTW to use (or actually, the maximum number). All plans subsequently
89 created with any planner routine will use that many threads. You can
90 call <code>fftw_plan_with_nthreads</code>, create some plans, call
91 <code>fftw_plan_with_nthreads</code> again with a different argument, and
92 create some more plans for a new number of threads. Plans already created
93 before a call to <code>fftw_plan_with_nthreads</code> are unaffected. If you
94 pass an <code>nthreads</code> argument of <code>1</code> (the default), threads are
95 disabled for subsequent plans.
96
97 <p>Given a plan, you then execute it as usual with
98 <code>fftw_execute(plan)</code>, and the execution will use the number of
99 threads specified when the plan was created. When done, you destroy it
100 as usual with <code>fftw_destroy_plan</code>.
101
102 <p>There is one additional routine: if you want to get rid of all memory
103 and other resources allocated internally by FFTW, you can call:
104
105 <pre class="example"> void fftw_cleanup_threads(void);
106 </pre>
107 <p><a name="index-fftw_005fcleanup_005fthreads-324"></a>
108 which is much like the <code>fftw_cleanup()</code> function except that it
109 also gets rid of threads-related data. You must <em>not</em> execute any
110 previously created plans after calling this function.
111
112 <p>We should also mention one other restriction: if you save wisdom from a
113 program using the multi-threaded FFTW, that wisdom <em>cannot be used</em>
114 by a program using only the single-threaded FFTW (i.e. not calling
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>.
116
117 <!-- -->
118 </body></html>
119