OpenMP and FFT

OpenMP and FFT

Hello,

I am currently trying to take the FFTs of several functions using the following command:

DO i=1,N
Status = DftiComputeForward( Desc_Handle, f1(i,:))
Status = DftiComputeForward( Desc_Handle, f2(i,:))
Status = DftiComputeForward( Desc_Handle, f3(i,:))
Status = DftiComputeForward( Desc_Handle, f4(i,:))
END DO

Where I have used the following initializations:

Threads = 1
Status = DftiCreateDescriptor( Desc_Handle, DFTI_DOUBLE, &
DFTI_REAL, 1, M )
Status = DftiSetValue(Desc_Handle, DFTI_BACKWARD_SCALE, Scale)
Status = DftiSetValue(Desc_Handle, DFTI_NUMBER_OF_USER_THREADS, Threads)
Status = DftiSetValue(Desc_Handle, DFTI_PACKED_FORMAT, DFTI_CCS_FORMAT)
Status = DftiCommitDescriptor( Desc_Handle )

I would like to parallelize the the loop given above using OpenMP:

!$OMP DO
DO i=1,N
Status = DftiComputeForward( Desc_Handle, f1(i,:))
Status = DftiComputeForward( Desc_Handle, f2(i,:))
Status = DftiComputeForward( Desc_Handle, f3(i,:))
Status = DftiComputeForward( Desc_Handle, f4(i,:))
END DO
!$OMP END DO

However, I realize that this cannot work using the same Desc_Handle. Can anyone make a recommendation on how to treat the descriptor handle? In other words, what is the simplest way to parallelize the above loop using Intel's FFT functions?

Thanks,
Mandrew

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Mandrew,

Once single descriptor is to be shared between N user threads, the value of parameter DFTI_NUMBER_OF_USER_THREADS should be set to N. And the OpenMP loop should be limited to that number via num_threads(N) clause.

Thanks,
Dima

Mandrew,
as an addition to Dima's comments, please look at the article "Different parallelization techniques for MKL FFT" by the following the link "http://software.intel.com/en-us/articles/different-parallelization-techniques-and-intel-mkl-fft/" See the example #4.
--Gennady

Dima and Gennady:

Thanks for your help - it is now working great!

Mandrew

Leave a Comment

Please sign in to add a comment. Not a member? Join today