Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7117 Discussions

Intel MKL FFT example 27, 27a gives "Aborted"

CDS-B
Beginner
765 Views
Hi,

I am working on running a set of MKL FFTs in parallel using user threads (using openMP primitives)
I tried out Example 27 in MKL manual:
I do a MKL_Set_Num_Threads(1) as suggested in the manual and run 4 OMP threads.
But I see "Aborted" in the output. This apparently happens after the first thread completes all the statements in the parallel region. It is not clear as to what the reason is.
I use the following options for compiling:
icc -Wl,--start-group -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -openmp -lpthread test_mkl.c

It will be great if some one can help me with this.
Following is the code I use:


#include
#include
#include
#include "mkl.h"
#include
#define DEBUG 0

int main (){
float _Complex x[200][100];
MKL_LONG len[2];
int j,k;
float real, imag=0;
for (j = 0; j < 200; ++j)
for(k=0; k<100; ++k)
{
real = ((float)((float)rand()/(float)RAND_MAX) );
imag = ((float)((float)rand()/(float)RAND_MAX) );
x= real + imag * I;
}

len[0]=50; len[1]=100;
MKL_Set_Num_Threads(1);

int nthreads;
#pragma omp parallel num_threads(4)
{
DFTI_DESCRIPTOR_HANDLE my_desc_handle;
MKL_LONG myStatus;
int myID = omp_get_thread_num ();
printf("\n %d", myID);fflush(stdout);
myStatus = DftiCreateDescriptor (&my_desc_handle, DFTI_SINGLE,DFTI_COMPLEX, 2, len);
myStatus = DftiCommitDescriptor (my_desc_handle);
myStatus = DftiComputeForward (my_desc_handle, &x[myID * len[0] * len[1]]);
myStatus = DftiFreeDescriptor (&my_desc_handle);
printf("\n free desc my id: %d ---> my status: %ld", myID, myStatus); fflush(stdout);
if (myID == 0)
{
nthreads = omp_get_num_threads();
printf("Number of threads = %d\n", nthreads);
}

}
printf("\n all done");
/* End OpenMP parallel region */
return 0;
}
0 Kudos
4 Replies
barragan_villanueva_
Valued Contributor I
765 Views

Hi,

Yourtest fails becuse of problem in the following expression:
myStatus = DftiComputeForward (my_desc_handle, &x[myID * len[0] * len[1]]);
Please add new pointer yat the top of thetest (after definition of x) :
float _Complex *y=&x[0][0];
and use y instead of x:
myStatus = DftiComputeForward (my_desc_handle, &y[myID * len[0] * len[1]]);

So,MKL DFTIexamples:


Using Parallel Mode with Multiple Descriptors Initialized in One Thread

Using Parallel Mode with a Common Descriptor

are to be corrected

Thank you
--Victor
0 Kudos
barragan_villanueva_
Valued Contributor I
765 Views

Or it's OK just to use the following expression:

&x [myID * len[0]] [0]

instead of

&x[myID * len[0] * len[1]]);
0 Kudos
CDS-B
Beginner
765 Views
Thanks Victor !



Hi,

Yourtest fails becuse of problem in the following expression:
myStatus = DftiComputeForward (my_desc_handle, &x[myID * len[0] * len[1]]);
Please add new pointer yat the top of thetest (after definition of x) :
float _Complex *y=&x[0][0];
and use y instead of x:
myStatus = DftiComputeForward (my_desc_handle, &y[myID * len[0] * len[1]]);

So,MKL DFTIexamples:


Using Parallel Mode with Multiple Descriptors Initialized in One Thread

Using Parallel Mode with a Common Descriptor

are to be corrected

Thank you
--Victor

0 Kudos
Ying_H_Intel
Employee
765 Views
Just for your information,

All ofnew FORTRAN examplesand the fixedC examples are integrated into MKL 10.3.1, which release recently.

For who are using Intel Compiler or Composer, please find the MKL Version info fromhttp://software.intel.com/en-us/articles/which-version-of-the-intel-ipp-intel-mkl-and-intel-tbb-libraries-are-included-in-the-intel-composer-bundles/

Regards,
Ying H.
0 Kudos
Reply