comparison Lib/fftw-3.2.1/doc/html/.svn/text-base/Thread-safety.html.svn-base @ 0:25bf17994ef1

First commit. VS2013, Codeblocks and Mac OSX configuration
author Geogaddi\David <d.m.ronan@qmul.ac.uk>
date Thu, 09 Jul 2015 01:12:16 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:25bf17994ef1
1 <html lang="en">
2 <head>
3 <title>Thread safety - 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="How-Many-Threads-to-Use_003f.html#How-Many-Threads-to-Use_003f" title="How Many Threads to Use?">
10 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11 <!--
12 This manual is for FFTW
13 (version 3.2.1, 5 February 2009).
14
15 Copyright (C) 2003 Matteo Frigo.
16
17 Copyright (C) 2003 Massachusetts Institute of Technology.
18
19 Permission is granted to make and distribute verbatim copies of
20 this manual provided the copyright notice and this permission
21 notice are preserved on all copies.
22
23 Permission is granted to copy and distribute modified versions of
24 this manual under the conditions for verbatim copying, provided
25 that the entire resulting derived work is distributed under the
26 terms of a permission notice identical to this one.
27
28 Permission is granted to copy and distribute translations of this
29 manual into another language, under the above conditions for
30 modified versions, except that this permission notice may be
31 stated in a translation approved by the Free Software Foundation.
32 -->
33 <meta http-equiv="Content-Style-Type" content="text/css">
34 <style type="text/css"><!--
35 pre.display { font-family:inherit }
36 pre.format { font-family:inherit }
37 pre.smalldisplay { font-family:inherit; font-size:smaller }
38 pre.smallformat { font-family:inherit; font-size:smaller }
39 pre.smallexample { font-size:smaller }
40 pre.smalllisp { font-size:smaller }
41 span.sc { font-variant:small-caps }
42 span.roman { font-family:serif; font-weight:normal; }
43 span.sansserif { font-family:sans-serif; font-weight:normal; }
44 --></style>
45 </head>
46 <body>
47 <div class="node">
48 <p>
49 <a name="Thread-safety"></a>
50 Previous:&nbsp;<a rel="previous" accesskey="p" href="How-Many-Threads-to-Use_003f.html#How-Many-Threads-to-Use_003f">How Many Threads to Use?</a>,
51 Up:&nbsp;<a rel="up" accesskey="u" href="Multi_002dthreaded-FFTW.html#Multi_002dthreaded-FFTW">Multi-threaded FFTW</a>
52 <hr>
53 </div>
54
55 <h3 class="section">5.4 Thread safety</h3>
56
57 <p><a name="index-threads-327"></a><a name="index-thread-safety-328"></a>Users writing multi-threaded programs must concern themselves with the
58 <dfn>thread safety</dfn> of the libraries they use&mdash;that is, whether it is
59 safe to call routines in parallel from multiple threads. FFTW can be
60 used in such an environment, but some care must be taken because the
61 planner routines share data (e.g. wisdom and trigonometric tables)
62 between calls and plans.
63
64 <p>The upshot is that the only thread-safe (re-entrant) routine in FFTW is
65 <code>fftw_execute</code> (and the new-array variants thereof). All other routines
66 (e.g. the planner) should only be called from one thread at a time. So,
67 for example, you can wrap a semaphore lock around any calls to the
68 planner; even more simply, you can just create all of your plans from
69 one thread. We do not think this should be an important restriction
70 (FFTW is designed for the situation where the only performance-sensitive
71 code is the actual execution of the transform), and the benefits of
72 shared data between plans are great.
73
74 <p>Note also that, since the plan is not modified by <code>fftw_execute</code>,
75 it is safe to execute the <em>same plan</em> in parallel by multiple
76 threads. However, since a given plan operates by default on a fixed
77 array, you need to use one of the new-array execute functions (see <a href="New_002darray-Execute-Functions.html#New_002darray-Execute-Functions">New-array Execute Functions</a>) so that different threads compute the transform of different data.
78
79 <p>(Users should note that these comments only apply to programs using
80 shared-memory threads. Parallelism using MPI or forked processes
81 involves a separate address-space and global variables for each process,
82 and is not susceptible to problems of this sort.)
83
84 <!-- ************************************************************ -->
85 </body></html>
86