Mercurial > hg > batch-feature-extraction-tool
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/fftw-3.2.1/doc/html/.svn/text-base/FFTW-MPI-Wisdom.html.svn-base Thu Jul 09 01:12:16 2015 +0100 @@ -0,0 +1,132 @@ +<html lang="en"> +<head> +<title>FFTW MPI Wisdom - FFTW 3.2alpha3</title> +<meta http-equiv="Content-Type" content="text/html"> +<meta name="description" content="FFTW 3.2alpha3"> +<meta name="generator" content="makeinfo 4.8"> +<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.2alpha3, 14 August 2007). + +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"> +<p> +<a name="FFTW-MPI-Wisdom"></a> +Next: <a rel="next" accesskey="n" href="Avoiding-MPI-Deadlocks.html#Avoiding-MPI-Deadlocks">Avoiding MPI Deadlocks</a>, +Previous: <a rel="previous" accesskey="p" href="FFTW-MPI-Transposes.html#FFTW-MPI-Transposes">FFTW MPI Transposes</a>, +Up: <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-380"></a><a name="index-saving-plans-to-disk-381"></a> +FFTW's “wisdom” 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>First, the MPI standard does not guarantee that every process can +perform file I/O (at least, not using C stdio routines)—only the +process of rank <code>MPI_IO</code> can in general (unless <code>MPI_IO == +MPI_ANY_SOURCE</code>). (In practice, <code>MPI_IO</code> is commonly assumed to +be zero, i.e. at least process 0 can perform I/O, since otherwise a +single-process run could not perform I/O.) 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. +<a name="index-MPI_005fIO-382"></a><a name="index-MPI_005fANY_005fSOURCE-383"></a> +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-384"></a><a name="index-fftw_005fmpi_005fbroadcast_005fwisdom-385"></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-386"></a> +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; + FILE *f; + + fftw_mpi_init(); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + if (rank == 0 && (f = fopen("mywisdom", "r"))) { + fftw_import_wisdom_from_file(f); + fclose(f); + } + 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-387"></a> +<pre class="example"> { + int rank; + FILE *f; + + fftw_mpi_gather_wisdom(MPI_COMM_WORLD); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + if (rank == 0 && (f = fopen("mywisdom", "w"))) { + fftw_export_wisdom_to_file(f); + fclose(f); + } + } +</pre> + <!-- --> +</body></html> +