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