📄 fftw_6.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD><!-- This HTML file has been created by texi2html 1.52 from fftw.texi on 24 March 2003 --><TITLE>FFTW - Installation and Customization</TITLE></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF">Go to the <A HREF="fftw_1.html">first</A>, <A HREF="fftw_5.html">previous</A>, <A HREF="fftw_7.html">next</A>, <A HREF="fftw_10.html">last</A> section, <A HREF="fftw_toc.html">table of contents</A>.<P><HR><P><H1><A NAME="SEC66">Installation and Customization</A></H1><P>This chapter describes the installation and customization of FFTW, thelatest version of which may be downloaded from<A HREF="http://www.fftw.org">the FFTW home page</A>.<P>As distributed, FFTW makes very few assumptions about your system. Allyou need is an ANSI C compiler (<CODE>gcc</CODE> is fine, althoughvendor-provided compilers often produce faster code).<A NAME="IDX313"></A>However, installation of FFTW is somewhat simpler if you have a Unix ora GNU system, such as Linux. In this chapter, we first describe theinstallation of FFTW on Unix and non-Unix systems. We then describe howyou can customize FFTW to achieve better performance. Specifically, youcan I) enable <CODE>gcc</CODE>/x86-specific hacks that improve performance onPentia and PentiumPro's; II) adapt FFTW to use the high-resolution clockof your machine, if any; III) produce code (<EM>codelets</EM>) to supportfast transforms of sizes that are not supported efficiently by thestandard FFTW distribution.<A NAME="IDX314"></A><H2><A NAME="SEC67">Installation on Unix</A></H2><P>FFTW comes with a <CODE>configure</CODE> program in the GNU style.Installation can be as simple as:<A NAME="IDX315"></A><PRE>./configuremakemake install</PRE><P>This will build the uniprocessor complex and real transform librariesalong with the test programs. We strongly recommend that you use GNU<CODE>make</CODE> if it is available; on some systems it is called<CODE>gmake</CODE>. The "<CODE>make install</CODE>" command installs the fftw andrfftw libraries in standard places, and typically requires rootprivileges (unless you specify a different install directory with the<CODE>--prefix</CODE> flag to <CODE>configure</CODE>). You can also type"<CODE>make check</CODE>" to put the FFTW test programs through their paces.If you have problems during configuration or compilation, you may wantto run "<CODE>make distclean</CODE>" before trying again; this ensures thatyou don't have any stale files left over from previous compilationattempts.<P>The <CODE>configure</CODE> script knows good <CODE>CFLAGS</CODE> (C compiler flags)<A NAME="IDX316"></A>for a few systems. If your system is not known, the <CODE>configure</CODE>script will print out a warning. <A NAME="DOCF9" HREF="fftw_foot.html#FOOT9">(9)</A> In this case, you can compileFFTW with the command<PRE>make CFLAGS="<write your CFLAGS here>"</PRE><P>If you do find an optimal set of <CODE>CFLAGS</CODE> for your system, pleaselet us know what they are (along with the output of <CODE>config.guess</CODE>)so that we can include them in future releases.<P>The <CODE>configure</CODE> program supports all the standard flags defined bythe GNU Coding Standards; see the <CODE>INSTALL</CODE> file in FFTW or<A HREF="http://www.gnu.org/prep/standards_toc.html">the GNU web page</A>.Note especially <CODE>--help</CODE> to list all flags and<CODE>--enable-shared</CODE> to create shared, rather than static, libraries.<CODE>configure</CODE> also accepts a few FFTW-specific flags, particularly:<UL><LI><A NAME="IDX317"></A><CODE>--enable-float</CODE> Produces a single-precision version of FFTW(<CODE>float</CODE>) instead of the default double-precision (<CODE>double</CODE>).See Section <A HREF="fftw_6.html#SEC69">Installing FFTW in both single and double precision</A>.<LI><CODE>--enable-type-prefix</CODE> Adds a <SAMP>`d'</SAMP> or <SAMP>`s'</SAMP> prefix to allinstalled libraries and header files to indicate the floating-pointprecision. See Section <A HREF="fftw_6.html#SEC69">Installing FFTW in both single and double precision</A>. (<CODE>--enable-type-prefix=<prefix></CODE> lets you add anarbitrary prefix.) By default, no prefix is used.<LI><A NAME="IDX318"></A><CODE>--enable-threads</CODE> Enables compilation and installation of the FFTWthreads library (see Section <A HREF="fftw_4.html#SEC48">Multi-threaded FFTW</A>), which provides asimple interface to parallel transforms for SMP systems. (By default,the threads routines are not compiled.)<LI><CODE>--with-openmp</CODE>, <CODE>--with-sgimp</CODE>In conjunction with <CODE>--enable-threads</CODE>, causes the multi-threadedFFTW library to use OpenMP or SGI MP compiler directives in order toinduce parallelism, rather than spawning its own threads directly.(Useful especially for programs already employing such directives, inorder to minimize conflicts between different parallelizationmechanisms.)<LI><A NAME="IDX319"></A><CODE>--enable-mpi</CODE> Enables compilation and installation of the FFTW MPIlibrary (see Section <A HREF="fftw_4.html#SEC55">MPI FFTW</A>), which provides parallel transforms fordistributed-memory systems with MPI. (By default, the MPI routines arenot compiled.)<LI><A NAME="IDX320"></A><CODE>--disable-fortran</CODE> Disables inclusion of Fortran-callable wrapperroutines (see Section <A HREF="fftw_5.html#SEC62">Calling FFTW from Fortran</A>) in the standard FFTWlibraries. These wrapper routines increase the library size by only anegligible amount, so they are included by default as long as the<CODE>configure</CODE> script finds a Fortran compiler on your system.<LI><CODE>--with-gcc</CODE> Enables the use of <CODE>gcc</CODE>. By default, FFTW usesthe vendor-supplied <CODE>cc</CODE> compiler if present. Unfortunately,<CODE>gcc</CODE> produces slower code than <CODE>cc</CODE> on many systems.<LI><CODE>--enable-i386-hacks</CODE> See Section <A HREF="fftw_6.html#SEC70"><CODE>gcc</CODE> and Pentium hacks</A>, below.<LI><CODE>--enable-pentium-timer</CODE> See Section <A HREF="fftw_6.html#SEC70"><CODE>gcc</CODE> and Pentium hacks</A>, below.</UL><P>To force <CODE>configure</CODE> to use a particular C compiler (instead of the<A NAME="IDX321"></A>default, usually <CODE>cc</CODE>), set the environment variable <CODE>CC</CODE> tothe name of the desired compiler before running <CODE>configure</CODE>; youmay also need to set the flags via the variable <CODE>CFLAGS</CODE>.<A NAME="IDX322"></A><H2><A NAME="SEC68">Installation on non-Unix Systems</A></H2><P>It is quite straightforward to install FFTW even on non-Unix systemslacking the niceties of the <CODE>configure</CODE> script. The FFTW Home Pagemay include some FFTW packages preconfigured for particularsystems/compilers, and also contains installation notes sent in by<A NAME="IDX323"></A>users. All you really need to do, though, is to compile all of the<CODE>.c</CODE> files in the appropriate directories of the FFTW package.(You needn't worry about the many extraneous files lying around.)<P>For the complex transforms, compile all of the <CODE>.c</CODE> files in the<CODE>fftw</CODE> directory and link them into a library. Similarly, for thereal transforms, compile all of the <CODE>.c</CODE> files in the <CODE>rfftw</CODE>directory into a library. Note that these sources <CODE>#include</CODE>various files in the <CODE>fftw</CODE> and <CODE>rfftw</CODE> directories, so youmay need to set up the <CODE>#include</CODE> paths for your compilerappropriately. Be sure to enable the highest-possible level ofoptimization in your compiler.<P><A NAME="IDX324"></A>By default, FFTW is compiled for double-precision transforms. To workin single precision rather than double precision, <CODE>#define</CODE> thesymbol <CODE>FFTW_ENABLE_FLOAT</CODE> in <CODE>fftw.h</CODE> (in the <CODE>fftw</CODE>directory) and (re)compile FFTW.<P>These libraries should be linked with any program that uses thecorresponding transforms. The required header files, <CODE>fftw.h</CODE> and<CODE>rfftw.h</CODE>, are located in the <CODE>fftw</CODE> and <CODE>rfftw</CODE>directories respectively; you may want to put them with the libraries,or wherever header files normally go on your system.<P>FFTW includes test programs, <CODE>fftw_test</CODE> and <CODE>rfftw_test</CODE>, in<A NAME="IDX325"></A><A NAME="IDX326"></A>the <CODE>tests</CODE> directory. These are compiled and linked like anyprogram using FFTW, except that they use additional header files locatedin the <CODE>fftw</CODE> and <CODE>rfftw</CODE> directories, so you will need to setyour compiler <CODE>#include</CODE> paths appropriately. <CODE>fftw_test</CODE> iscompiled from <CODE>fftw_test.c</CODE> and <CODE>test_main.c</CODE>, while<CODE>rfftw_test</CODE> is compiled from <CODE>rfftw_test.c</CODE> and<CODE>test_main.c</CODE>. When you run these programs, you will be promptedinteractively for various possible tests to perform; see also<CODE>tests/README</CODE> for more information.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -