Multi-threaded FFT computations via FFTW (version 3)
This module defines Chapel wrappers around key FFTW routines
supporting multithreaded execution. It builds directly on the
FFTW module, inheriting all of its functionality, so refer to
that module for documentation on the transforms themselves.
To use this module:
- Ensure that FFTW (version 3) is installed on your system with
multi-threaded support enabled and that the header and library
files (e.g., fftw3.h, libfftw3.*) are either installed in a
standard system location or that your C compiler's environment
variables are set up to find them (alternatively, the Chapel
-Lflags can be used to specify these locations).
use FFTW_MT;to your Chapel code.
- Compile and run your Chapel program as usual.
The steps to making multi-threaded FFTW calls are:
- By default, the module will initialize itself to use
here.maxTaskParthreads per locale when calling
plan_dft*routines. This auto-initialization can be disabled by setting
autoInitFFTW_MTto false at compile-time and calling
plan_with_nthreadsmanually. At any time during program execution, the number of threads to be used by FFTW can be changed by calling
plan_with_nthreadswith a new value.
- Create, ...
- execute, ...
- ...and destroy plans as in single-threaded uses of
cleanup_threadsto release the memory used by FFTW's threads and
cleanupas in single-threaded uses of
Note that where the main
FFTW module is a single-locale
module, this one is multi-locale in that, once it is initialized,
any locale can create and execute plans, though those plans will
only be valid on that locale. Calls to
cleanup_threads will take
those actions across all locales.
By default, this module will call
plan_with_nthreads()as part of its initialization. Setting this to false at compile-time will disable this auto-initialization, requiring these calls to be made manually.
FFTW_MTmodule. This has the effect of calling the FFTW C routine
fftw_init_threads()on all locales, halting the Chapel program if any of the calls generate an error.
plan_with_nthreads(nthreads: int = 0)¶
Register the number of threads to use for multi-threaded FFTW plans on all locales. If fewer than one thread is requested, each locale will default to
here.maxTaskParthreads. Note that this routine can be called multiple times, overwriting previous values.
Arguments: nthreads : int -- The number of threads to use.
Clean up the memory used by FFTW threads on all locales.