annotate src/fftw-3.3.5/doc/install.texi @ 84:08ae793730bd

Add null config files
author Chris Cannam
date Mon, 02 Mar 2020 14:03:47 +0000
parents 2cd0e3b3e1fd
children
rev   line source
Chris@42 1 @node Installation and Customization, Acknowledgments, Upgrading from FFTW version 2, Top
Chris@42 2 @chapter Installation and Customization
Chris@42 3 @cindex installation
Chris@42 4
Chris@42 5 This chapter describes the installation and customization of FFTW, the
Chris@42 6 latest version of which may be downloaded from
Chris@42 7 @uref{http://www.fftw.org, the FFTW home page}.
Chris@42 8
Chris@42 9 In principle, FFTW should work on any system with an ANSI C compiler
Chris@42 10 (@code{gcc} is fine). However, planner time is drastically reduced if
Chris@42 11 FFTW can exploit a hardware cycle counter; FFTW comes with cycle-counter
Chris@42 12 support for all modern general-purpose CPUs, but you may need to add a
Chris@42 13 couple of lines of code if your compiler is not yet supported
Chris@42 14 (@pxref{Cycle Counters}). (On Unix, there will be a warning at the end
Chris@42 15 of the @code{configure} output if no cycle counter is found.)
Chris@42 16 @cindex cycle counter
Chris@42 17 @cindex compiler
Chris@42 18 @cindex portability
Chris@42 19
Chris@42 20
Chris@42 21 Installation of FFTW is simplest if you have a Unix or a GNU system,
Chris@42 22 such as GNU/Linux, and we describe this case in the first section below,
Chris@42 23 including the use of special configuration options to e.g. install
Chris@42 24 different precisions or exploit optimizations for particular
Chris@42 25 architectures (e.g. SIMD). Compilation on non-Unix systems is a more
Chris@42 26 manual process, but we outline the procedure in the second section. It
Chris@42 27 is also likely that pre-compiled binaries will be available for popular
Chris@42 28 systems.
Chris@42 29
Chris@42 30 Finally, we describe how you can customize FFTW for particular needs by
Chris@42 31 generating @emph{codelets} for fast transforms of sizes not supported
Chris@42 32 efficiently by the standard FFTW distribution.
Chris@42 33 @cindex codelet
Chris@42 34
Chris@42 35 @menu
Chris@42 36 * Installation on Unix::
Chris@42 37 * Installation on non-Unix systems::
Chris@42 38 * Cycle Counters::
Chris@42 39 * Generating your own code::
Chris@42 40 @end menu
Chris@42 41
Chris@42 42 @c ------------------------------------------------------------
Chris@42 43
Chris@42 44 @node Installation on Unix, Installation on non-Unix systems, Installation and Customization, Installation and Customization
Chris@42 45 @section Installation on Unix
Chris@42 46
Chris@42 47 FFTW comes with a @code{configure} program in the GNU style.
Chris@42 48 Installation can be as simple as:
Chris@42 49 @fpindex configure
Chris@42 50
Chris@42 51 @example
Chris@42 52 ./configure
Chris@42 53 make
Chris@42 54 make install
Chris@42 55 @end example
Chris@42 56
Chris@42 57 This will build the uniprocessor complex and real transform libraries
Chris@42 58 along with the test programs. (We recommend that you use GNU
Chris@42 59 @code{make} if it is available; on some systems it is called
Chris@42 60 @code{gmake}.) The ``@code{make install}'' command installs the fftw
Chris@42 61 and rfftw libraries in standard places, and typically requires root
Chris@42 62 privileges (unless you specify a different install directory with the
Chris@42 63 @code{--prefix} flag to @code{configure}). You can also type
Chris@42 64 ``@code{make check}'' to put the FFTW test programs through their paces.
Chris@42 65 If you have problems during configuration or compilation, you may want
Chris@42 66 to run ``@code{make distclean}'' before trying again; this ensures that
Chris@42 67 you don't have any stale files left over from previous compilation
Chris@42 68 attempts.
Chris@42 69
Chris@42 70 The @code{configure} script chooses the @code{gcc} compiler by default,
Chris@42 71 if it is available; you can select some other compiler with:
Chris@42 72 @example
Chris@42 73 ./configure CC="@r{@i{<the name of your C compiler>}}"
Chris@42 74 @end example
Chris@42 75
Chris@42 76 The @code{configure} script knows good @code{CFLAGS} (C compiler flags)
Chris@42 77 @cindex compiler flags
Chris@42 78 for a few systems. If your system is not known, the @code{configure}
Chris@42 79 script will print out a warning. In this case, you should re-configure
Chris@42 80 FFTW with the command
Chris@42 81 @example
Chris@42 82 ./configure CFLAGS="@r{@i{<write your CFLAGS here>}}"
Chris@42 83 @end example
Chris@42 84 and then compile as usual. If you do find an optimal set of
Chris@42 85 @code{CFLAGS} for your system, please let us know what they are (along
Chris@42 86 with the output of @code{config.guess}) so that we can include them in
Chris@42 87 future releases.
Chris@42 88
Chris@42 89 @code{configure} supports all the standard flags defined by the GNU
Chris@42 90 Coding Standards; see the @code{INSTALL} file in FFTW or
Chris@42 91 @uref{http://www.gnu.org/prep/standards/html_node/index.html, the GNU web page}.
Chris@42 92 Note especially @code{--help} to list all flags and
Chris@42 93 @code{--enable-shared} to create shared, rather than static, libraries.
Chris@42 94 @code{configure} also accepts a few FFTW-specific flags, particularly:
Chris@42 95
Chris@42 96 @itemize @bullet
Chris@42 97
Chris@42 98 @item
Chris@42 99 @cindex precision
Chris@42 100 @code{--enable-float}: Produces a single-precision version of FFTW
Chris@42 101 (@code{float}) instead of the default double-precision (@code{double}).
Chris@42 102 @xref{Precision}.
Chris@42 103
Chris@42 104 @item
Chris@42 105 @cindex precision
Chris@42 106 @code{--enable-long-double}: Produces a long-double precision version of
Chris@42 107 FFTW (@code{long double}) instead of the default double-precision
Chris@42 108 (@code{double}). The @code{configure} script will halt with an error
Chris@42 109 message if @code{long double} is the same size as @code{double} on your
Chris@42 110 machine/compiler. @xref{Precision}.
Chris@42 111
Chris@42 112 @item
Chris@42 113 @cindex precision
Chris@42 114 @code{--enable-quad-precision}: Produces a quadruple-precision version
Chris@42 115 of FFTW using the nonstandard @code{__float128} type provided by
Chris@42 116 @code{gcc} 4.6 or later on x86, x86-64, and Itanium architectures,
Chris@42 117 instead of the default double-precision (@code{double}). The
Chris@42 118 @code{configure} script will halt with an error message if the
Chris@42 119 compiler is not @code{gcc} version 4.6 or later or if @code{gcc}'s
Chris@42 120 @code{libquadmath} library is not installed. @xref{Precision}.
Chris@42 121
Chris@42 122 @item
Chris@42 123 @cindex threads
Chris@42 124 @code{--enable-threads}: Enables compilation and installation of the
Chris@42 125 FFTW threads library (@pxref{Multi-threaded FFTW}), which provides a
Chris@42 126 simple interface to parallel transforms for SMP systems. By default,
Chris@42 127 the threads routines are not compiled.
Chris@42 128
Chris@42 129 @item
Chris@42 130 @code{--enable-openmp}: Like @code{--enable-threads}, but using OpenMP
Chris@42 131 compiler directives in order to induce parallelism rather than
Chris@42 132 spawning its own threads directly, and installing an @samp{fftw3_omp} library
Chris@42 133 rather than an @samp{fftw3_threads} library (@pxref{Multi-threaded
Chris@42 134 FFTW}). You can use both @code{--enable-openmp} and @code{--enable-threads}
Chris@42 135 since they compile/install libraries with different names. By default,
Chris@42 136 the OpenMP routines are not compiled.
Chris@42 137
Chris@42 138 @item
Chris@42 139 @code{--with-combined-threads}: By default, if @code{--enable-threads}
Chris@42 140 is used, the threads support is compiled into a separate library that
Chris@42 141 must be linked in addition to the main FFTW library. This is so that
Chris@42 142 users of the serial library do not need to link the system threads
Chris@42 143 libraries. If @code{--with-combined-threads} is specified, however,
Chris@42 144 then no separate threads library is created, and threads are included
Chris@42 145 in the main FFTW library. This is mainly useful under Windows, where
Chris@42 146 no system threads library is required and inter-library dependencies
Chris@42 147 are problematic.
Chris@42 148
Chris@42 149 @item
Chris@42 150 @cindex MPI
Chris@42 151 @code{--enable-mpi}: Enables compilation and installation of the FFTW
Chris@42 152 MPI library (@pxref{Distributed-memory FFTW with MPI}), which provides
Chris@42 153 parallel transforms for distributed-memory systems with MPI. (By
Chris@42 154 default, the MPI routines are not compiled.) @xref{FFTW MPI
Chris@42 155 Installation}.
Chris@42 156
Chris@42 157 @item
Chris@42 158 @cindex Fortran-callable wrappers
Chris@42 159 @code{--disable-fortran}: Disables inclusion of legacy-Fortran
Chris@42 160 wrapper routines (@pxref{Calling FFTW from Legacy Fortran}) in the standard
Chris@42 161 FFTW libraries. These wrapper routines increase the library size by
Chris@42 162 only a negligible amount, so they are included by default as long as
Chris@42 163 the @code{configure} script finds a Fortran compiler on your system.
Chris@42 164 (To specify a particular Fortran compiler @i{foo}, pass
Chris@42 165 @code{F77=}@i{foo} to @code{configure}.)
Chris@42 166
Chris@42 167 @item
Chris@42 168 @code{--with-g77-wrappers}: By default, when Fortran wrappers are
Chris@42 169 included, the wrappers employ the linking conventions of the Fortran
Chris@42 170 compiler detected by the @code{configure} script. If this compiler is
Chris@42 171 GNU @code{g77}, however, then @emph{two} versions of the wrappers are
Chris@42 172 included: one with @code{g77}'s idiosyncratic convention of appending
Chris@42 173 two underscores to identifiers, and one with the more common
Chris@42 174 convention of appending only a single underscore. This way, the same
Chris@42 175 FFTW library will work with both @code{g77} and other Fortran
Chris@42 176 compilers, such as GNU @code{gfortran}. However, the converse is not
Chris@42 177 true: if you configure with a different compiler, then the
Chris@42 178 @code{g77}-compatible wrappers are not included. By specifying
Chris@42 179 @code{--with-g77-wrappers}, the @code{g77}-compatible wrappers are
Chris@42 180 included in addition to wrappers for whatever Fortran compiler
Chris@42 181 @code{configure} finds.
Chris@42 182 @fpindex g77
Chris@42 183
Chris@42 184 @item
Chris@42 185 @code{--with-slow-timer}: Disables the use of hardware cycle counters,
Chris@42 186 and falls back on @code{gettimeofday} or @code{clock}. This greatly
Chris@42 187 worsens performance, and should generally not be used (unless you don't
Chris@42 188 have a cycle counter but still really want an optimized plan regardless
Chris@42 189 of the time). @xref{Cycle Counters}.
Chris@42 190
Chris@42 191 @item
Chris@42 192 @code{--enable-sse} (single precision),
Chris@42 193 @code{--enable-sse2} (single, double),
Chris@42 194 @code{--enable-avx} (single, double),
Chris@42 195 @code{--enable-avx2} (single, double),
Chris@42 196 @code{--enable-avx512} (single, double),
Chris@42 197 @code{--enable-avx-128-fma},
Chris@42 198 @code{--enable-kcvi} (single),
Chris@42 199 @code{--enable-altivec} (single),
Chris@42 200 @code{--enable-vsx} (single, double),
Chris@42 201 @code{--enable-neon} (single, double on aarch64),
Chris@42 202 @code{--enable-generic-simd128},
Chris@42 203 and
Chris@42 204 @code{--enable-generic-simd256}:
Chris@42 205
Chris@42 206 Enable various SIMD instruction sets. You need compiler that supports
Chris@42 207 the given SIMD extensions, but FFTW will try to detect at runtime
Chris@42 208 whether the CPU supports these extensions. That is, you can compile
Chris@42 209 with@code{--enable-avx} and the code will still run on a CPU without AVX
Chris@42 210 support.
Chris@42 211
Chris@42 212 @itemize @minus
Chris@42 213 @item
Chris@42 214 These options require a compiler supporting SIMD extensions, and
Chris@42 215 compiler support is always a bit flaky: see the FFTW FAQ for a list of
Chris@42 216 compiler versions that have problems compiling FFTW.
Chris@42 217 @item
Chris@42 218 Because of the large variety of ARM processors and ABIs, FFTW
Chris@42 219 does not attempt to guess the correct @code{gcc} flags for generating
Chris@42 220 NEON code. In general, you will have to provide them on the command line.
Chris@42 221 This command line is known to have worked at least once:
Chris@42 222 @example
Chris@42 223 ./configure --with-slow-timer --host=arm-linux-gnueabi \
Chris@42 224 --enable-single --enable-neon \
Chris@42 225 "CC=arm-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=softfp"
Chris@42 226 @end example
Chris@42 227 @end itemize
Chris@42 228
Chris@42 229 @end itemize
Chris@42 230
Chris@42 231 @cindex compiler
Chris@42 232 To force @code{configure} to use a particular C compiler @i{foo}
Chris@42 233 (instead of the default, usually @code{gcc}), pass @code{CC=}@i{foo} to the
Chris@42 234 @code{configure} script; you may also need to set the flags via the variable
Chris@42 235 @code{CFLAGS} as described above.
Chris@42 236 @cindex compiler flags
Chris@42 237
Chris@42 238 @c ------------------------------------------------------------
Chris@42 239 @node Installation on non-Unix systems, Cycle Counters, Installation on Unix, Installation and Customization
Chris@42 240 @section Installation on non-Unix systems
Chris@42 241
Chris@42 242 It should be relatively straightforward to compile FFTW even on non-Unix
Chris@42 243 systems lacking the niceties of a @code{configure} script. Basically,
Chris@42 244 you need to edit the @code{config.h} header (copy it from
Chris@42 245 @code{config.h.in}) to @code{#define} the various options and compiler
Chris@42 246 characteristics, and then compile all the @samp{.c} files in the
Chris@42 247 relevant directories.
Chris@42 248
Chris@42 249 The @code{config.h} header contains about 100 options to set, each one
Chris@42 250 initially an @code{#undef}, each documented with a comment, and most of
Chris@42 251 them fairly obvious. For most of the options, you should simply
Chris@42 252 @code{#define} them to @code{1} if they are applicable, although a few
Chris@42 253 options require a particular value (e.g. @code{SIZEOF_LONG_LONG} should
Chris@42 254 be defined to the size of the @code{long long} type, in bytes, or zero
Chris@42 255 if it is not supported). We will likely post some sample
Chris@42 256 @code{config.h} files for various operating systems and compilers for
Chris@42 257 you to use (at least as a starting point). Please let us know if you
Chris@42 258 have to hand-create a configuration file (and/or a pre-compiled binary)
Chris@42 259 that you want to share.
Chris@42 260
Chris@42 261 To create the FFTW library, you will then need to compile all of the
Chris@42 262 @samp{.c} files in the @code{kernel}, @code{dft}, @code{dft/scalar},
Chris@42 263 @code{dft/scalar/codelets}, @code{rdft}, @code{rdft/scalar},
Chris@42 264 @code{rdft/scalar/r2cf}, @code{rdft/scalar/r2cb},
Chris@42 265 @code{rdft/scalar/r2r}, @code{reodft}, and @code{api} directories.
Chris@42 266 If you are compiling with SIMD support (e.g. you defined
Chris@42 267 @code{HAVE_SSE2} in @code{config.h}), then you also need to compile
Chris@42 268 the @code{.c} files in the @code{simd-support},
Chris@42 269 @code{@{dft,rdft@}/simd}, @code{@{dft,rdft@}/simd/*} directories.
Chris@42 270
Chris@42 271 Once these files are all compiled, link them into a library, or a shared
Chris@42 272 library, or directly into your program.
Chris@42 273
Chris@42 274 To compile the FFTW test program, additionally compile the code in the
Chris@42 275 @code{libbench2/} directory, and link it into a library. Then compile
Chris@42 276 the code in the @code{tests/} directory and link it to the
Chris@42 277 @code{libbench2} and FFTW libraries. To compile the @code{fftw-wisdom}
Chris@42 278 (command-line) tool (@pxref{Wisdom Utilities}), compile
Chris@42 279 @code{tools/fftw-wisdom.c} and link it to the @code{libbench2} and FFTW
Chris@42 280 libraries
Chris@42 281
Chris@42 282 @c ------------------------------------------------------------
Chris@42 283 @node Cycle Counters, Generating your own code, Installation on non-Unix systems, Installation and Customization
Chris@42 284 @section Cycle Counters
Chris@42 285 @cindex cycle counter
Chris@42 286
Chris@42 287 FFTW's planner actually executes and times different possible FFT
Chris@42 288 algorithms in order to pick the fastest plan for a given @math{n}. In
Chris@42 289 order to do this in as short a time as possible, however, the timer must
Chris@42 290 have a very high resolution, and to accomplish this we employ the
Chris@42 291 hardware @dfn{cycle counters} that are available on most CPUs.
Chris@42 292 Currently, FFTW supports the cycle counters on x86, PowerPC/POWER, Alpha,
Chris@42 293 UltraSPARC (SPARC v9), IA64, PA-RISC, and MIPS processors.
Chris@42 294
Chris@42 295 @cindex compiler
Chris@42 296 Access to the cycle counters, unfortunately, is a compiler and/or
Chris@42 297 operating-system dependent task, often requiring inline assembly
Chris@42 298 language, and it may be that your compiler is not supported. If you are
Chris@42 299 @emph{not} supported, FFTW will by default fall back on its estimator
Chris@42 300 (effectively using @code{FFTW_ESTIMATE} for all plans).
Chris@42 301 @ctindex FFTW_ESTIMATE
Chris@42 302
Chris@42 303 You can add support by editing the file @code{kernel/cycle.h}; normally,
Chris@42 304 this will involve adapting one of the examples already present in order
Chris@42 305 to use the inline-assembler syntax for your C compiler, and will only
Chris@42 306 require a couple of lines of code. Anyone adding support for a new
Chris@42 307 system to @code{cycle.h} is encouraged to email us at @email{fftw@@fftw.org}.
Chris@42 308
Chris@42 309 If a cycle counter is not available on your system (e.g. some embedded
Chris@42 310 processor), and you don't want to use estimated plans, as a last resort
Chris@42 311 you can use the @code{--with-slow-timer} option to @code{configure} (on
Chris@42 312 Unix) or @code{#define WITH_SLOW_TIMER} in @code{config.h} (elsewhere).
Chris@42 313 This will use the much lower-resolution @code{gettimeofday} function, or even
Chris@42 314 @code{clock} if the former is unavailable, and planning will be
Chris@42 315 extremely slow.
Chris@42 316
Chris@42 317 @c ------------------------------------------------------------
Chris@42 318 @node Generating your own code, , Cycle Counters, Installation and Customization
Chris@42 319 @section Generating your own code
Chris@42 320 @cindex code generator
Chris@42 321
Chris@42 322 The directory @code{genfft} contains the programs that were used to
Chris@42 323 generate FFTW's ``codelets,'' which are hard-coded transforms of small
Chris@42 324 sizes.
Chris@42 325 @cindex codelet
Chris@42 326 We do not expect casual users to employ the generator, which is a rather
Chris@42 327 sophisticated program that generates directed acyclic graphs of FFT
Chris@42 328 algorithms and performs algebraic simplifications on them. It was
Chris@42 329 written in Objective Caml, a dialect of ML, which is available at
Chris@42 330 @uref{http://caml.inria.fr/ocaml/index.en.html}.
Chris@42 331 @cindex Caml
Chris@42 332
Chris@42 333
Chris@42 334 If you have Objective Caml installed (along with recent versions of
Chris@42 335 GNU @code{autoconf}, @code{automake}, and @code{libtool}), then you
Chris@42 336 can change the set of codelets that are generated or play with the
Chris@42 337 generation options. The set of generated codelets is specified by the
Chris@42 338 @code{@{dft,rdft@}/@{codelets,simd@}/*/Makefile.am} files. For example, you can add
Chris@42 339 efficient REDFT codelets of small sizes by modifying
Chris@42 340 @code{rdft/codelets/r2r/Makefile.am}.
Chris@42 341 @cindex REDFT
Chris@42 342 After you modify any @code{Makefile.am} files, you can type @code{sh
Chris@42 343 bootstrap.sh} in the top-level directory followed by @code{make} to
Chris@42 344 re-generate the files.
Chris@42 345
Chris@42 346 We do not provide more details about the code-generation process, since
Chris@42 347 we do not expect that most users will need to generate their own code.
Chris@42 348 However, feel free to contact us at @email{fftw@@fftw.org} if
Chris@42 349 you are interested in the subject.
Chris@42 350
Chris@42 351 @cindex monadic programming
Chris@42 352 You might find it interesting to learn Caml and/or some modern
Chris@42 353 programming techniques that we used in the generator (including monadic
Chris@42 354 programming), especially if you heard the rumor that Java and
Chris@42 355 object-oriented programming are the latest advancement in the field.
Chris@42 356 The internal operation of the codelet generator is described in the
Chris@42 357 paper, ``A Fast Fourier Transform Compiler,'' by M. Frigo, which is
Chris@42 358 available from the @uref{http://www.fftw.org,FFTW home page} and also
Chris@42 359 appeared in the @cite{Proceedings of the 1999 ACM SIGPLAN Conference on
Chris@42 360 Programming Language Design and Implementation (PLDI)}.
Chris@42 361