main.c
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <complex.h>
#include "mkl.h"
#include "mkl_dfti.h"
float _Complex c2c_input[32];
float _Complex c2c_output[32];
DFTI_DESCRIPTOR_HANDLE my_desc_handle = NULL;
MKL_LONG status;
int main(int argc, char* argv[])
{
int i;
clock_t start, stop;
start = clock();
for(i=0;i<32;i++)
c2c_input[i]=i;
status = DftiCreateDescriptor(&my_desc_handle, DFTI_SINGLE,DFTI_COMPLEX, 1, 32);
status = DftiSetValue(my_desc_handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
status = DftiCommitDescriptor(my_desc_handle);
status = DftiComputeForward(my_desc_handle, c2c_input, c2c_output);
status = DftiFreeDescriptor(&my_desc_handle);
for(i=0;i<32;i++)
printf("%f\n",creal(c2c_output[i]));
stop = clock();
printf("Program Finished! Elapsed time = %g seconds\n",((double)(stop - start)) / CLOCKS_PER_SEC);
return 0;
}
Makefile
#https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
#source /opt/intel/compilers_and_libraries/linux/mkl/bin/mklvars.sh intel64
main: main.c
gcc -o main main.c -m64 -I/opt/intel/compilers_and_libraries_2020.0.166/linux/mkl/include -L/opt/intel/compilers_and_libraries_2020.0.166/linux/mkl/lib/intel64 -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl
clean:
rm -f main