annotate src/fftw-3.3.5/doc/FAQ/fftw-faq.html/section2.html @ 127:7867fa7e1b6b

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