annotate Lib/fftw-3.2.1/doc/html/.svn/text-base/FFTW-MPI-Wisdom.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
rev   line source
d@0 1 <html lang="en">
d@0 2 <head>
d@0 3 <title>FFTW MPI Wisdom - FFTW 3.2alpha3</title>
d@0 4 <meta http-equiv="Content-Type" content="text/html">
d@0 5 <meta name="description" content="FFTW 3.2alpha3">
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="Distributed_002dmemory-FFTW-with-MPI.html#Distributed_002dmemory-FFTW-with-MPI" title="Distributed-memory FFTW with MPI">
d@0 9 <link rel="prev" href="FFTW-MPI-Transposes.html#FFTW-MPI-Transposes" title="FFTW MPI Transposes">
d@0 10 <link rel="next" href="Avoiding-MPI-Deadlocks.html#Avoiding-MPI-Deadlocks" title="Avoiding MPI Deadlocks">
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.2alpha3, 14 August 2007).
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="FFTW-MPI-Wisdom"></a>
d@0 51 Next:&nbsp;<a rel="next" accesskey="n" href="Avoiding-MPI-Deadlocks.html#Avoiding-MPI-Deadlocks">Avoiding MPI Deadlocks</a>,
d@0 52 Previous:&nbsp;<a rel="previous" accesskey="p" href="FFTW-MPI-Transposes.html#FFTW-MPI-Transposes">FFTW MPI Transposes</a>,
d@0 53 Up:&nbsp;<a rel="up" accesskey="u" href="Distributed_002dmemory-FFTW-with-MPI.html#Distributed_002dmemory-FFTW-with-MPI">Distributed-memory FFTW with MPI</a>
d@0 54 <hr>
d@0 55 </div>
d@0 56
d@0 57 <h3 class="section">6.8 FFTW MPI Wisdom</h3>
d@0 58
d@0 59 <p><a name="index-wisdom-380"></a><a name="index-saving-plans-to-disk-381"></a>
d@0 60 FFTW's &ldquo;wisdom&rdquo; facility (see <a href="Words-of-Wisdom_002dSaving-Plans.html#Words-of-Wisdom_002dSaving-Plans">Words of Wisdom-Saving Plans</a>) can
d@0 61 be used to save MPI plans as well as to save uniprocessor plans.
d@0 62 However, for MPI there are several unavoidable complications.
d@0 63
d@0 64 <p>First, the MPI standard does not guarantee that every process can
d@0 65 perform file I/O (at least, not using C stdio routines)&mdash;only the
d@0 66 process of rank <code>MPI_IO</code> can in general (unless <code>MPI_IO ==
d@0 67 MPI_ANY_SOURCE</code>). (In practice, <code>MPI_IO</code> is commonly assumed to
d@0 68 be zero, i.e. at least process 0 can perform I/O, since otherwise a
d@0 69 single-process run could not perform I/O.) So, if we want to export
d@0 70 the wisdom from a single process to a file, we must first export the
d@0 71 wisdom to a string, then send it to process 0, then write it to a
d@0 72 file.
d@0 73 <a name="index-MPI_005fIO-382"></a><a name="index-MPI_005fANY_005fSOURCE-383"></a>
d@0 74 Second, in principle we may want to have separate wisdom for every
d@0 75 process, since in general the processes may run on different hardware
d@0 76 even for a single MPI program. However, in practice FFTW's MPI code
d@0 77 is designed for the case of homogeneous hardware (see <a href="Load-balancing.html#Load-balancing">Load balancing</a>), and in this case it is convenient to use the same wisdom
d@0 78 for every process. Thus, we need a mechanism to synchronize the wisdom.
d@0 79
d@0 80 <p>To address both of these problems, FFTW provides the following two
d@0 81 functions:
d@0 82
d@0 83 <pre class="example"> void fftw_mpi_broadcast_wisdom(MPI_Comm comm);
d@0 84 void fftw_mpi_gather_wisdom(MPI_Comm comm);
d@0 85 </pre>
d@0 86 <p><a name="index-fftw_005fmpi_005fgather_005fwisdom-384"></a><a name="index-fftw_005fmpi_005fbroadcast_005fwisdom-385"></a>
d@0 87 Given a communicator <code>comm</code>, <code>fftw_mpi_broadcast_wisdom</code>
d@0 88 will broadcast the wisdom from process 0 to all other processes.
d@0 89 Conversely, <code>fftw_mpi_gather_wisdom</code> will collect wisdom from all
d@0 90 processes onto process 0. (If the plans created for the same problem
d@0 91 by different processes are not the same, <code>fftw_mpi_gather_wisdom</code>
d@0 92 will arbitrarily choose one of the plans.) Both of these functions
d@0 93 may result in suboptimal plans for different processes if the
d@0 94 processes are running on non-identical hardware. Both of these
d@0 95 functions are <em>collective</em> calls, which means that they must be
d@0 96 executed by all processes in the communicator.
d@0 97 <a name="index-collective-function-386"></a>
d@0 98 So, for example, a typical code snippet to import wisdom from a file
d@0 99 and use it on all processes would be:
d@0 100
d@0 101 <pre class="example"> {
d@0 102 int rank;
d@0 103 FILE *f;
d@0 104
d@0 105 fftw_mpi_init();
d@0 106 MPI_Comm_rank(MPI_COMM_WORLD, &amp;rank);
d@0 107 if (rank == 0 &amp;&amp; (f = fopen("mywisdom", "r"))) {
d@0 108 fftw_import_wisdom_from_file(f);
d@0 109 fclose(f);
d@0 110 }
d@0 111 fftw_mpi_broadcast_wisdom(MPI_COMM_WORLD);
d@0 112 }
d@0 113 </pre>
d@0 114 <p>(Note that we must call <code>fftw_mpi_init</code> before importing any
d@0 115 wisdom that might contain MPI plans.) Similarly, a typical code
d@0 116 snippet to export wisdom from all processes to a file is:
d@0 117 <a name="index-fftw_005fmpi_005finit-387"></a>
d@0 118 <pre class="example"> {
d@0 119 int rank;
d@0 120 FILE *f;
d@0 121
d@0 122 fftw_mpi_gather_wisdom(MPI_COMM_WORLD);
d@0 123 MPI_Comm_rank(MPI_COMM_WORLD, &amp;rank);
d@0 124 if (rank == 0 &amp;&amp; (f = fopen("mywisdom", "w"))) {
d@0 125 fftw_export_wisdom_to_file(f);
d@0 126 fclose(f);
d@0 127 }
d@0 128 }
d@0 129 </pre>
d@0 130 <!-- -->
d@0 131 </body></html>
d@0 132