Thread safetyΒΆ

NVPL FFT, as cuFFT and cuFFTW, is thread safe as long as the output data are disjoint and each thread executes FFTs using its own plan. Note that this does not cover fftw_plan_with_nthreads, which is not thread-safe. Therefore, if the user would like to have plans using different number of threads, the plan creations need to be done sequentially.

In addition to the above scenario, as FFTW, the execute APIs that have input and output data as arguments are thread-safe on their own. This means that threads can share a plan and execute FFTs in parallel, assuming again that the output data are disjoint. Note that it is not thread-safe to call fftw_destroy_plan in parallel with the same plan. Users would need to destroy the shared plan outside of the parallel region.

Two examples, c2c_single_withomp_example and r2c_c2r_single_withomp_example, are available from NVPLSamples for demonstrating how to use OpenMP with NVPL FFT with the aforementioned two scenarios.