diff src/fftw-3.3.3/doc/html/FFTW-MPI-Wisdom.html @ 10:37bf6b4a2645

Add FFTW3
author Chris Cannam
date Wed, 20 Mar 2013 15:35:50 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/fftw-3.3.3/doc/html/FFTW-MPI-Wisdom.html	Wed Mar 20 15:35:50 2013 +0000
@@ -0,0 +1,142 @@
+<html lang="en">
+<head>
+<title>FFTW MPI Wisdom - FFTW 3.3.3</title>
+<meta http-equiv="Content-Type" content="text/html">
+<meta name="description" content="FFTW 3.3.3">
+<meta name="generator" content="makeinfo 4.13">
+<link title="Top" rel="start" href="index.html#Top">
+<link rel="up" href="Distributed_002dmemory-FFTW-with-MPI.html#Distributed_002dmemory-FFTW-with-MPI" title="Distributed-memory FFTW with MPI">
+<link rel="prev" href="FFTW-MPI-Transposes.html#FFTW-MPI-Transposes" title="FFTW MPI Transposes">
+<link rel="next" href="Avoiding-MPI-Deadlocks.html#Avoiding-MPI-Deadlocks" title="Avoiding MPI Deadlocks">
+<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
+<!--
+This manual is for FFTW
+(version 3.3.3, 25 November 2012).
+
+Copyright (C) 2003 Matteo Frigo.
+
+Copyright (C) 2003 Massachusetts Institute of Technology.
+
+     Permission is granted to make and distribute verbatim copies of
+     this manual provided the copyright notice and this permission
+     notice are preserved on all copies.
+
+     Permission is granted to copy and distribute modified versions of
+     this manual under the conditions for verbatim copying, provided
+     that the entire resulting derived work is distributed under the
+     terms of a permission notice identical to this one.
+
+     Permission is granted to copy and distribute translations of this
+     manual into another language, under the above conditions for
+     modified versions, except that this permission notice may be
+     stated in a translation approved by the Free Software Foundation.
+   -->
+<meta http-equiv="Content-Style-Type" content="text/css">
+<style type="text/css"><!--
+  pre.display { font-family:inherit }
+  pre.format  { font-family:inherit }
+  pre.smalldisplay { font-family:inherit; font-size:smaller }
+  pre.smallformat  { font-family:inherit; font-size:smaller }
+  pre.smallexample { font-size:smaller }
+  pre.smalllisp    { font-size:smaller }
+  span.sc    { font-variant:small-caps }
+  span.roman { font-family:serif; font-weight:normal; } 
+  span.sansserif { font-family:sans-serif; font-weight:normal; } 
+--></style>
+</head>
+<body>
+<div class="node">
+<a name="FFTW-MPI-Wisdom"></a>
+<p>
+Next:&nbsp;<a rel="next" accesskey="n" href="Avoiding-MPI-Deadlocks.html#Avoiding-MPI-Deadlocks">Avoiding MPI Deadlocks</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="FFTW-MPI-Transposes.html#FFTW-MPI-Transposes">FFTW MPI Transposes</a>,
+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>
+<hr>
+</div>
+
+<h3 class="section">6.8 FFTW MPI Wisdom</h3>
+
+<p><a name="index-wisdom-410"></a><a name="index-saving-plans-to-disk-411"></a>
+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
+be used to save MPI plans as well as to save uniprocessor plans. 
+However, for MPI there are several unavoidable complications.
+
+   <p><a name="index-MPI-I_002fO-412"></a>First, the MPI standard does not guarantee that every process can
+perform file I/O (at least, not using C stdio routines)&mdash;in general,
+we may only assume that process 0 is capable of I/O.<a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a> So, if we
+want to export the wisdom from a single process to a file, we must
+first export the wisdom to a string, then send it to process 0, then
+write it to a file.
+
+   <p>Second, in principle we may want to have separate wisdom for every
+process, since in general the processes may run on different hardware
+even for a single MPI program.  However, in practice FFTW's MPI code
+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
+for every process.  Thus, we need a mechanism to synchronize the wisdom.
+
+   <p>To address both of these problems, FFTW provides the following two
+functions:
+
+<pre class="example">     void fftw_mpi_broadcast_wisdom(MPI_Comm comm);
+     void fftw_mpi_gather_wisdom(MPI_Comm comm);
+</pre>
+   <p><a name="index-fftw_005fmpi_005fgather_005fwisdom-413"></a><a name="index-fftw_005fmpi_005fbroadcast_005fwisdom-414"></a>
+Given a communicator <code>comm</code>, <code>fftw_mpi_broadcast_wisdom</code>
+will broadcast the wisdom from process 0 to all other processes. 
+Conversely, <code>fftw_mpi_gather_wisdom</code> will collect wisdom from all
+processes onto process 0.  (If the plans created for the same problem
+by different processes are not the same, <code>fftw_mpi_gather_wisdom</code>
+will arbitrarily choose one of the plans.)  Both of these functions
+may result in suboptimal plans for different processes if the
+processes are running on non-identical hardware.  Both of these
+functions are <em>collective</em> calls, which means that they must be
+executed by all processes in the communicator. 
+<a name="index-collective-function-415"></a>
+
+   <p>So, for example, a typical code snippet to import wisdom from a file
+and use it on all processes would be:
+
+<pre class="example">     {
+         int rank;
+     
+         fftw_mpi_init();
+         MPI_Comm_rank(MPI_COMM_WORLD, &amp;rank);
+         if (rank == 0) fftw_import_wisdom_from_filename("mywisdom");
+         fftw_mpi_broadcast_wisdom(MPI_COMM_WORLD);
+     }
+</pre>
+   <p>(Note that we must call <code>fftw_mpi_init</code> before importing any
+wisdom that might contain MPI plans.)  Similarly, a typical code
+snippet to export wisdom from all processes to a file is:
+<a name="index-fftw_005fmpi_005finit-416"></a>
+<pre class="example">     {
+         int rank;
+     
+         fftw_mpi_gather_wisdom(MPI_COMM_WORLD);
+         MPI_Comm_rank(MPI_COMM_WORLD, &amp;rank);
+         if (rank == 0) fftw_export_wisdom_to_filename("mywisdom");
+     }
+</pre>
+   <!--  -->
+   <div class="footnote">
+<hr>
+<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> In fact,
+even this assumption is not technically guaranteed by the standard,
+although it seems to be universal in actual MPI implementations and is
+widely assumed by MPI-using software.  Technically, you need to query
+the <code>MPI_IO</code> attribute of <code>MPI_COMM_WORLD</code> with
+<code>MPI_Attr_get</code>.  If this attribute is <code>MPI_PROC_NULL</code>, no
+I/O is possible.  If it is <code>MPI_ANY_SOURCE</code>, any process can
+perform I/O.  Otherwise, it is the rank of a process that can perform
+I/O ... but since it is not guaranteed to yield the <em>same</em> rank
+on all processes, you have to do an <code>MPI_Allreduce</code> of some kind
+if you want all processes to agree about which is going to do I/O. 
+And even then, the standard only guarantees that this process can
+perform output, but not input. See e.g. <cite>Parallel Programming
+with MPI</cite> by P. S. Pacheco, section 8.1.3.  Needless to say, in our
+experience virtually no MPI programmers worry about this.</p>
+
+   <hr></div>
+
+   </body></html>
+