The new DFTI_THREAD_LIMIT configuration parameter

 

This parameter explicitly configures a Discrete Fourier Transform Interface (DFTI) descriptor for the maximum number of OpenMP threads to be used for parallel computation of Fast Fourier Transform (FFT). It also allows to inquiry the number of threads that MKL has chosen for the computation of a particular FFT.

The following cases are examples when you might want to use this per-descriptor threading control:

  • configure the number of threads for computation of FFT using DFTI functions

Recommended usage

Alternative way 1

DftiSetValue(desc, DFTI_THREAD_LIMIT, NT)

DftiCommitDescriptor(desc)

Old_NT = mkl_domain_get_num_threads(MKL_FFT)

mkl_domain_set_num_threads(NT, MKL_FFT)

DftiCommitDescriptor(desc)

mkl_domain_set_num_threads(Old_NT, MKL_FFT)

Alternative way 2 (MKL 11.0 Beta 2 or later)

Old_NT = mkl_set_num_threads_local(NT)

DftiCommitDescriptor(desc)

mkl_set_num_threads_local(Old_NT)

  • discover the number of threads that DFTI will actually request for computation of a particular FFT

Recommended usage

DftiCommitDescriptor(desc)

DftiGetValue(desc, DFTI_THREAD_LIMIT, &NT)

//DFTI compute functions will request at most NT threads to compute FFT with //desc

  • specify number of threads for parallel commit of a DFTI descriptor

Recommended usage

DftiSetValue(desc, DFTI_THREAD_LIMIT, 1) // want computing FFT serially

DftiCommitDescriptor(desc) // while this call may employ multiple threads

Generally, if more than one application thread calls Intel MKL and MKL is enabled to go parallel inside, it is important to not oversubscribe computing resources (CPU cores). Specifically for DFTI, a known limit of the maximum number of threads to be used in computations might help the DftiCommitDescriptor function to select a more optimal computation method.

Settings the parameter DFTI_THREAD_LIMIT can be done via DftiSetValue routine. See MKL Reference Manual for the details.

 

For more complete information about compiler optimizations, see our Optimization Notice.