annotate fft/fftw/fftw-3.3.4/doc/FAQ/fftw-faq.html/section2.html @ 40:223f770b5341 kissfft-double tip

Try a double-precision kissfft
author Chris Cannam
date Wed, 07 Sep 2016 10:40:32 +0100
parents 26056e866c29
children
rev   line source
Chris@19 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
Chris@19 2 <html>
Chris@19 3 <head><title>
Chris@19 4 FFTW FAQ - Section 2
Chris@19 5 </title>
Chris@19 6 <link rev="made" href="mailto:fftw@fftw.org">
Chris@19 7 <link rel="Contents" href="index.html">
Chris@19 8 <link rel="Start" href="index.html">
Chris@19 9 <link rel="Next" href="section3.html"><link rel="Previous" href="section1.html"><link rel="Bookmark" title="FFTW FAQ" href="index.html">
Chris@19 10 </head><body text="#000000" bgcolor="#FFFFFF"><h1>
Chris@19 11 FFTW FAQ - Section 2 <br>
Chris@19 12 Installing FFTW
Chris@19 13 </h1>
Chris@19 14
Chris@19 15 <ul>
Chris@19 16 <li><a href="#systems" rel=subdocument>Q2.1. Which systems does FFTW run on?</a>
Chris@19 17 <li><a href="#runOnWindows" rel=subdocument>Q2.2. Does FFTW run on Windows?</a>
Chris@19 18 <li><a href="#compilerCrashes" rel=subdocument>Q2.3. My compiler has trouble with FFTW.</a>
Chris@19 19 <li><a href="#solarisSucks" rel=subdocument>Q2.4. FFTW does not compile on Solaris, complaining about
Chris@19 20 <code>const</code>.</a>
Chris@19 21 <li><a href="#3dnow" rel=subdocument>Q2.5. What's the difference between <code>--enable-3dnow</code> and <code>--enable-k7</code>?</a>
Chris@19 22 <li><a href="#fma" rel=subdocument>Q2.6. What's the difference between the fma and the non-fma
Chris@19 23 versions?</a>
Chris@19 24 <li><a href="#languages" rel=subdocument>Q2.7. Which language is FFTW written in?</a>
Chris@19 25 <li><a href="#fortran" rel=subdocument>Q2.8. Can I call FFTW from Fortran?</a>
Chris@19 26 <li><a href="#cplusplus" rel=subdocument>Q2.9. Can I call FFTW from C++?</a>
Chris@19 27 <li><a href="#whynotfortran" rel=subdocument>Q2.10. Why isn't FFTW written in Fortran/C++?</a>
Chris@19 28 <li><a href="#singleprec" rel=subdocument>Q2.11. How do I compile FFTW to run in single precision?</a>
Chris@19 29 <li><a href="#64bitk7" rel=subdocument>Q2.12. --enable-k7 does not work on x86-64</a>
Chris@19 30 </ul><hr>
Chris@19 31
Chris@19 32 <h2><A name="systems">
Chris@19 33 Question 2.1. Which systems does FFTW run
Chris@19 34 on?
Chris@19 35 </A></h2>
Chris@19 36
Chris@19 37 FFTW is written in ANSI C, and should work on any system with a decent
Chris@19 38 C compiler. (See also <A href="#runOnWindows">Q2.2 `Does FFTW run on Windows?'</A>, <A href="#compilerCrashes">Q2.3 `My compiler has trouble with FFTW.'</A>.) FFTW can also take advantage of certain hardware-specific features,
Chris@19 39 such as cycle counters and SIMD instructions, but this is optional.
Chris@19 40
Chris@19 41 <h2><A name="runOnWindows">
Chris@19 42 Question 2.2. Does FFTW run on Windows?
Chris@19 43 </A></h2>
Chris@19 44
Chris@19 45 Yes, many people have reported successfully using FFTW on Windows with
Chris@19 46 various compilers. FFTW was not developed on Windows, but the source
Chris@19 47 code is essentially straight ANSI C. See also the
Chris@19 48 <A href="http://www.fftw.org/install/windows.html">FFTW Windows installation notes</A>, <A href="#compilerCrashes">Q2.3 `My compiler has trouble with FFTW.'</A>, and <A href="section3.html#vbetalia">Q3.18 `How do I call FFTW from the Microsoft language du
Chris@19 49 jour?'</A>.
Chris@19 50 <h2><A name="compilerCrashes">
Chris@19 51 Question 2.3. My compiler has trouble with
Chris@19 52 FFTW.
Chris@19 53 </A></h2>
Chris@19 54
Chris@19 55 Complain fiercely to the vendor of the compiler.
Chris@19 56
Chris@19 57 <p>
Chris@19 58 We have successfully used <code>gcc</code> 3.2.x on x86 and PPC, a recent Compaq C compiler for Alpha, version 6 of IBM's
Chris@19 59 <code>xlc</code> compiler for AIX, Intel's <code>icc</code> versions 5-7, and Sun WorkShop <code>cc</code> version 6.
Chris@19 60 <p>
Chris@19 61 FFTW is likely to push compilers to their limits, however, and several
Chris@19 62 compiler bugs have been exposed by FFTW. A partial list follows.
Chris@19 63
Chris@19 64 <p>
Chris@19 65 <code>gcc</code> 2.95.x for Solaris/SPARC produces incorrect code for
Chris@19 66 the test program (workaround: recompile the
Chris@19 67 <code>libbench2</code> directory with <code>-O2</code>).
Chris@19 68 <p>
Chris@19 69 NetBSD/macppc 1.6 comes with a <code>gcc</code> version that also miscompiles the test program. (Please report a workaround if you know
Chris@19 70 one.)
Chris@19 71 <p>
Chris@19 72 <code>gcc</code> 3.2.3 for ARM reportedly crashes during compilation.
Chris@19 73 This bug is reportedly fixed in later versions of
Chris@19 74 <code>gcc</code>.
Chris@19 75 <p>
Chris@19 76 Versions 8.0 and 8.1 of Intel's <code>icc</code> falsely claim to be <code>gcc</code>, so you should specify <code>CC=&quot;icc -no-gcc&quot;</code>; this is automatic in FFTW 3.1. <code>icc-8.0.066</code> reportely produces incorrect code for FFTW 2.1.5, but is fixed in version 8.1.
Chris@19 77 <code>icc-7.1</code> compiler build 20030402Z appears to produce
Chris@19 78 incorrect dependencies, causing the compilation to fail.
Chris@19 79 <code>icc-7.1</code> build 20030307Z appears to work fine. (Use
Chris@19 80 <code>icc -V</code> to check which build you have.) As of 2003/04/18,
Chris@19 81 build 20030402Z appears not to be available any longer on Intel's
Chris@19 82 website, whereas the older build 20030307Z is available.
Chris@19 83
Chris@19 84 <p>
Chris@19 85 <code>ranlib</code> of GNU <code>binutils</code> 2.9.1 on Irix has been observed to corrupt the FFTW libraries, causing a link failure when
Chris@19 86 FFTW is compiled. Since <code>ranlib</code> is completely superfluous on Irix, we suggest deleting it from your system and replacing it with
Chris@19 87 a symbolic link to <code>/bin/echo</code>.
Chris@19 88 <p>
Chris@19 89 If support for SIMD instructions is enabled in FFTW, further compiler
Chris@19 90 problems may appear:
Chris@19 91 <p>
Chris@19 92 <code>gcc</code> 3.4.[0123] for x86 produces incorrect SSE2 code for
Chris@19 93 FFTW when <code>-O2</code> (the best choice for FFTW) is used, causing
Chris@19 94 FFTW to crash (<code>make check</code> crashes). This bug is fixed in <code>gcc</code> 3.4.4. On x86_64 (amd64/em64t), <code>gcc</code> 3.4.4 reportedly still has a similar problem, but this is fixed as of
Chris@19 95 <code>gcc</code> 3.4.6.
Chris@19 96 <p>
Chris@19 97 <code>gcc-3.2</code> for x86 produces incorrect SIMD code if
Chris@19 98 <code>-O3</code> is used. The same compiler produces incorrect SIMD
Chris@19 99 code if no optimization is used, too. When using
Chris@19 100 <code>gcc-3.2</code>, it is a good idea not to change the default
Chris@19 101 <code>CFLAGS</code> selected by the <code>configure</code> script.
Chris@19 102 <p>
Chris@19 103 Some 3.0.x and 3.1.x versions of <code>gcc</code> on <code>x86</code> may crash. <code>gcc</code> so-called 2.96 shipping with RedHat 7.3 crashes
Chris@19 104 when compiling SIMD code. In both cases, please upgrade to
Chris@19 105 <code>gcc-3.2</code> or later.
Chris@19 106 <p>
Chris@19 107 Intel's <code>icc</code> 6.0 misaligns SSE constants, but FFTW has a
Chris@19 108 workaround. <code>icc</code> 8.x fails to compile FFTW 3.0.x because it
Chris@19 109 falsely claims to be <code>gcc</code>; we believe this to be a bug in <code>icc</code>, but FFTW 3.1 has a workaround.
Chris@19 110 <p>
Chris@19 111 Visual C++ 2003 reportedly produces incorrect code for SSE/SSE2 when
Chris@19 112 compiling FFTW. This bug was reportedly fixed in VC++ 2005;
Chris@19 113 alternatively, you could switch to the Intel compiler. VC++ 6.0 also
Chris@19 114 reportedly produces incorrect code for the file
Chris@19 115 <code>reodft11e-r2hc-odd.c</code> unless optimizations are disabled for that file.
Chris@19 116 <p>
Chris@19 117 <code>gcc</code> 2.95 on MacOS X miscompiles AltiVec code (fixed in
Chris@19 118 later versions). <code>gcc</code> 3.2.x miscompiles AltiVec permutations, but FFTW has a workaround.
Chris@19 119 <code>gcc</code> 4.0.1 on MacOS for Intel crashes when compiling FFTW; a workaround is to
Chris@19 120 compile one file without optimization: <code>cd kernel; make CFLAGS=&quot; &quot; trig.lo</code>.
Chris@19 121 <p>
Chris@19 122 <code>gcc</code> 4.1.1 reportedly crashes when compiling FFTW for MIPS;
Chris@19 123 the workaround is to compile the file it crashes on
Chris@19 124 (<code>t2_64.c</code>) with a lower optimization level.
Chris@19 125 <p>
Chris@19 126 <code>gcc</code> versions 4.1.2 to 4.2.0 for x86 reportedly miscompile
Chris@19 127 FFTW 3.1's test program, causing <code>make check</code> to crash (<code>gcc</code> bug #26528). The bug was reportedly fixed in
Chris@19 128 <code>gcc</code> version 4.2.1 and later. A workaround is to compile
Chris@19 129 <code>libbench2/verify-lib.c</code> without optimization.
Chris@19 130 <h2><A name="solarisSucks">
Chris@19 131 Question 2.4. FFTW does not compile on Solaris, complaining about
Chris@19 132 <code>const</code>.
Chris@19 133 </A></h2>
Chris@19 134
Chris@19 135 We know that at least on Solaris 2.5.x with Sun's compilers 4.2 you
Chris@19 136 might get error messages from <code>make</code> such as
Chris@19 137 <p>
Chris@19 138 <code>&quot;./fftw.h&quot;, line 88: warning: const is a keyword in ANSI
Chris@19 139 C</code>
Chris@19 140 <p>
Chris@19 141 This is the case when the <code>configure</code> script reports that <code>const</code> does not work:
Chris@19 142 <p>
Chris@19 143 <code>checking for working const... (cached) no</code>
Chris@19 144 <p>
Chris@19 145 You should be aware that Solaris comes with two compilers, namely,
Chris@19 146 <code>/opt/SUNWspro/SC4.2/bin/cc</code> and <code>/usr/ucb/cc</code>. The latter compiler is non-ANSI. Indeed, it is a perverse shell script
Chris@19 147 that calls the real compiler in non-ANSI mode. In order
Chris@19 148 to compile FFTW, change your path so that the right
Chris@19 149 <code>cc</code> is used.
Chris@19 150 <p>
Chris@19 151 To know whether your compiler is the right one, type
Chris@19 152 <code>cc -V</code>. If the compiler prints ``<code>ucbcc</code>'', as in
Chris@19 153 <p>
Chris@19 154 <code>ucbcc: WorkShop Compilers 4.2 30 Oct 1996 C
Chris@19 155 4.2</code>
Chris@19 156 <p>
Chris@19 157 then the compiler is wrong. The right message is something like
Chris@19 158
Chris@19 159 <p>
Chris@19 160 <code>cc: WorkShop Compilers 4.2 30 Oct 1996 C
Chris@19 161 4.2</code>
Chris@19 162 <h2><A name="3dnow">
Chris@19 163 Question 2.5. What's the difference between
Chris@19 164 <code>--enable-3dnow</code> and <code>--enable-k7</code>?
Chris@19 165 </A></h2>
Chris@19 166
Chris@19 167 <code>--enable-k7</code> enables 3DNow! instructions on K7 processors
Chris@19 168 (AMD Athlon and its variants). K7 support is provided by assembly
Chris@19 169 routines generated by a special purpose compiler.
Chris@19 170 As of fftw-3.2, --enable-k7 is no longer supported.
Chris@19 171
Chris@19 172 <p>
Chris@19 173 <code>--enable-3dnow</code> enables generic 3DNow! support using <code>gcc</code> builtin functions. This works on earlier AMD
Chris@19 174 processors, but it is not as fast as our special assembly routines.
Chris@19 175 As of fftw-3.1, --enable-3dnow is no longer supported.
Chris@19 176
Chris@19 177 <h2><A name="fma">
Chris@19 178 Question 2.6. What's the difference between the fma and the non-fma
Chris@19 179 versions?
Chris@19 180 </A></h2>
Chris@19 181
Chris@19 182 The fma version tries to exploit the fused multiply-add instructions
Chris@19 183 implemented in many processors such as PowerPC, ia-64, and MIPS. The
Chris@19 184 two FFTW packages are otherwise identical. In FFTW 3.1, the fma and
Chris@19 185 non-fma versions were merged together into a single package, and the
Chris@19 186 <code>configure</code> script attempts to automatically guess which
Chris@19 187 version to use.
Chris@19 188 <p>
Chris@19 189 The FFTW 3.1 <code>configure</code> script enables fma by default on PowerPC, Itanium, and PA-RISC, and disables it otherwise. You can
Chris@19 190 force one or the other by using the <code>--enable-fma</code> or <code>--disable-fma</code> flag for <code>configure</code>.
Chris@19 191 <p>
Chris@19 192 Definitely use fma if you have a PowerPC-based system with
Chris@19 193 <code>gcc</code> (or IBM <code>xlc</code>). This includes all GNU/Linux systems for PowerPC and the older PowerPC-based MacOS systems. Also
Chris@19 194 use it on PA-RISC and Itanium with the HP/UX compiler.
Chris@19 195
Chris@19 196 <p>
Chris@19 197 Definitely do not use the fma version if you have an ia-32 processor
Chris@19 198 (Intel, AMD, MacOS on Intel, etcetera).
Chris@19 199
Chris@19 200 <p>
Chris@19 201 For other architectures/compilers, the situation is not so clear. For
Chris@19 202 example, ia-64 has the fma instruction, but
Chris@19 203 <code>gcc-3.2</code> appears not to exploit it correctly. Other compilers may do the right thing,
Chris@19 204 but we have not tried them. Please send us your feedback so that we
Chris@19 205 can update this FAQ entry.
Chris@19 206 <h2><A name="languages">
Chris@19 207 Question 2.7. Which language is FFTW written
Chris@19 208 in?
Chris@19 209 </A></h2>
Chris@19 210
Chris@19 211 FFTW is written in ANSI C. Most of the code, however, was
Chris@19 212 automatically generated by a program called
Chris@19 213 <code>genfft</code>, written in the Objective Caml dialect of ML. You do not need to know ML or to
Chris@19 214 have an Objective Caml compiler in order to use FFTW.
Chris@19 215
Chris@19 216 <p>
Chris@19 217 <code>genfft</code> is provided with the FFTW sources, which means that
Chris@19 218 you can play with the code generator if you want. In this case, you
Chris@19 219 need a working Objective Caml system. Objective Caml is available
Chris@19 220 from <A href="http://caml.inria.fr">the Caml web page</A>.
Chris@19 221 <h2><A name="fortran">
Chris@19 222 Question 2.8. Can I call FFTW from Fortran?
Chris@19 223 </A></h2>
Chris@19 224
Chris@19 225 Yes, FFTW (versions 1.3 and higher) contains a Fortran-callable
Chris@19 226 interface, documented in the FFTW manual.
Chris@19 227
Chris@19 228 <p>
Chris@19 229 By default, FFTW configures its Fortran interface to work with the
Chris@19 230 first compiler it finds, e.g. <code>g77</code>. To configure for a different, incompatible Fortran compiler
Chris@19 231 <code>foobar</code>, use <code>./configure F77=foobar</code> when installing FFTW. (In the case of <code>g77</code>, however, FFTW 3.x also includes an extra set of
Chris@19 232 Fortran-callable routines with one less underscore at the end of
Chris@19 233 identifiers, which should cover most other Fortran compilers on Linux
Chris@19 234 at least.)
Chris@19 235 <h2><A name="cplusplus">
Chris@19 236 Question 2.9. Can I call FFTW from C++?
Chris@19 237 </A></h2>
Chris@19 238
Chris@19 239 Most definitely. FFTW should compile and/or link under any C++
Chris@19 240 compiler. Moreover, it is likely that the C++
Chris@19 241 <code>&lt;complex&gt;</code> template class is bit-compatible with FFTW's complex-number format
Chris@19 242 (see the FFTW manual for more details).
Chris@19 243
Chris@19 244 <h2><A name="whynotfortran">
Chris@19 245 Question 2.10. Why isn't FFTW written in
Chris@19 246 Fortran/C++?
Chris@19 247 </A></h2>
Chris@19 248
Chris@19 249 Because we don't like those languages, and neither approaches the
Chris@19 250 portability of C.
Chris@19 251 <h2><A name="singleprec">
Chris@19 252 Question 2.11. How do I compile FFTW to run in single
Chris@19 253 precision?
Chris@19 254 </A></h2>
Chris@19 255
Chris@19 256 On a Unix system: <code>configure --enable-float</code>. On a non-Unix system: edit <code>config.h</code> to <code>#define</code> the symbol <code>FFTW_SINGLE</code> (for FFTW 3.x). In both cases, you must then
Chris@19 257 recompile FFTW. In FFTW 3, all FFTW identifiers will then begin with
Chris@19 258 <code>fftwf_</code> instead of <code>fftw_</code>.
Chris@19 259 <h2><A name="64bitk7">
Chris@19 260 Question 2.12. --enable-k7 does not work on
Chris@19 261 x86-64
Chris@19 262 </A></h2>
Chris@19 263
Chris@19 264 Support for --enable-k7 was discontinued in fftw-3.2.
Chris@19 265
Chris@19 266 <p>
Chris@19 267 The fftw-3.1 release supports --enable-k7. This option only works on
Chris@19 268 32-bit x86 machines that implement 3DNow!, including the AMD Athlon
Chris@19 269 and the AMD Opteron in 32-bit mode. --enable-k7 does not work on AMD
Chris@19 270 Opteron in 64-bit mode. Use --enable-sse for x86-64 machines.
Chris@19 271
Chris@19 272 <p>
Chris@19 273 FFTW supports 3DNow! by means of assembly code generated by a
Chris@19 274 special-purpose compiler. It is hard to produce assembly code that
Chris@19 275 works in both 32-bit and 64-bit mode. <hr>
Chris@19 276 Next: <a href="section3.html" rel=precedes>Using FFTW</a>.<br>
Chris@19 277 Back: <a href="section1.html" rev=precedes>Introduction and General Information</a>.<br>
Chris@19 278 <a href="index.html" rev=subdocument>Return to contents</a>.<p>
Chris@19 279 <address>
Chris@19 280 <A href="http://www.fftw.org">Matteo Frigo and Steven G. Johnson</A> / <A href="mailto:fftw@fftw.org">fftw@fftw.org</A>
Chris@19 281 - 04 March 2014
Chris@19 282 </address><br>
Chris@19 283 Extracted from FFTW Frequently Asked Questions with Answers,
Chris@19 284 Copyright &copy; 2014 Matteo Frigo and Massachusetts Institute of Technology.
Chris@19 285 </body></html>