Community
cancel
Showing results for 
Search instead for 
Did you mean: 
mehnov__pasha
Beginner
131 Views

FFT, DftiCommitDescriptor error in dll

Hi! I'm coding my own dll in C++ language and tried to use FFT from MKL in my dll and got an error.

I'm using Win7, VS2019 and mkl 2019.5.281, 

I run official one-dimensional In-place FFT example (https://software.intel.com/en-us/node/522290) in c++ console application and it worked perfectly.

Then, i tried to do FFT by calling the c++ function( with no input parametrs and with the same example code) from python by ctypes library, but it didn't work, so i checked output parametrs of functions and defined an error.

The output status of DftiCommitDescriptor(descriptor) is equal to 5. Here it is an error message - "Intel MKL DFTI ERROR: Descriptor is uncommitted or corrupted". 

Could please help me to fix this problem? Thanks in advance.

void my(std::vector<std::complex<float>>& in)
{
	DFTI_DESCRIPTOR_HANDLE descriptor;
	MKL_LONG status;

	// Here everything is fine
    status = DftiCreateDescriptor(&descriptor, DFTI_SINGLE, DFTI_COMPLEX, 1, in.size()); //Specify size and precision
	if (status && !DftiErrorClass(status, DFTI_NO_ERROR))
	{
		printf("Error: %s\n", DftiErrorMessage(status));
	}
    // Error here
	status = DftiCommitDescriptor(descriptor);
	if (status && !DftiErrorClass(status, DFTI_NO_ERROR))
	{
		printf("Error: %s\n", DftiErrorMessage(status));
	}
	status = DftiComputeForward(descriptor, in.data());
	status = DftiFreeDescriptor(&descriptor);
}

// extern c++ function, it's called by a function from python
void cpp()
{
	std::vector<float> v = { 1.1, 2.1, 3.5, 4.2 };
    std::vector<std::complex<float>> in(v.size());
	std::copy(in.begin(), in.end(), v.begin());
	my(in);
}

 

// .h file
#pragma once
#include <iostream>
#include <vector>
#include <complex>
#include "mkl_dfti.h"

#ifdef DETERMINISTIC_EXPORTS
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif

extern "C" DLL_API void cpp();
std::vector<std::complex<float>> fft_real(std::vector<float>& in_real);
std::vector<std::complex<float>> fft_complex(std::vector<std::complex<float>>& in);

 

0 Kudos
1 Reply
Gennady_F_Intel
Moderator
131 Views

make sense to address this question to the python forum - https://software.intel.com/en-us/forums/intel-distribution-for-python

Reply