Download FFTW User's Manual

Transcript
Chapter 6: Installation and Customization
57
These libraries should be linked with any program that uses the corresponding transforms. The required header files, fftw.h and rfftw.h, are located in the fftw and rfftw
directories respectively; you may want to put them with the libraries, or wherever header
files normally go on your system.
FFTW includes test programs, fftw_test and rfftw_test, in the tests directory.
These are compiled and linked like any program using FFTW, except that they use additional header files located in the fftw and rfftw directories, so you will need to set your
compiler #include paths appropriately. fftw_test is compiled from fftw_test.c and
test_main.c, while rfftw_test is compiled from rfftw_test.c and test_main.c. When
you run these programs, you will be prompted interactively for various possible tests to
perform; see also tests/README for more information.
6.3 Installing FFTW in both single and double precision
It is often useful to install both single- and double-precision versions of the FFTW
libraries on the same machine, and we provide a convenient mechanism for achieving this
on Unix systems.
When the --enable-type-prefix option of configure is used, the FFTW libraries and
header files are installed with a prefix of ‘d’ or ‘s’, depending upon whether you compiled
in double or single precision. Then, instead of linking your program with -lrfftw -lfftw,
for example, you would link with -ldrfftw -ldfftw to use the double-precision version
or with -lsrfftw -lsfftw to use the single-precision version. Also, you would #include
<drfftw.h> or <srfftw.h> instead of <rfftw.h>, and so on.
The names of FFTW functions, data types, and constants remain unchanged! You still
call, for instance, fftw_one and not dfftw_one. Only the names of header files and libraries
are modified. One consequence of this is that you cannot use both the single- and doubleprecision FFTW libraries in the same program, simultaneously, as the function names would
conflict.
So, to install both the single- and double-precision libraries on the same machine, you
would do:
./configure --enable-type-prefix [ other options ]
make
make install
make clean
./configure --enable-float --enable-type-prefix [ other options ]
make
make install
6.4 gcc and Pentium hacks
The configure option --enable-i386-hacks enables specific optimizations for the Pentium and later x86 CPUs under gcc, which can significantly improve performance of doubleprecision transforms. Specifically, we have tested these hacks on Linux with gcc 2.[789] and
versions of egcs since 1.0.3. These optimizations affect only the performance and not the
correctness of FFTW (i.e. it is always safe to try them out).