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

Unexpected DftiComputeForward failures using larger inputs

Cohen__Idan
Beginner
508 Views

Hey,

I'm using MKL 2019u3 to compute 3D FFT.

This is the function:

void CheckMklFFT(const std::string &err_prefix, MKL_LONG status) {
        if (status != 0) {
            std::string error_message(DftiErrorMessage(status));
            std::cerr << err_prefix + error_message << std::endl;
            throw std::runtime_error(err_prefix + error_message);
        }
 }

std::shared_ptr<Ipp64fc> FFT3D(float *image, RPP::DataDimensions dims) {

        std::shared_ptr<Ipp64fc> image_fft = std::shared_ptr<Ipp64fc>(ippsMalloc_64fc((dims.x / 2 + 1) * dims.y * dims.z), [](Ipp64fc *x) { ippFree(x); });
        ippsZero_64fc(image_fft.get(), (dims.x / 2 + 1) * dims.x * dims.z);

        long lengths[] = {dims.z, dims.y, dims.x};
        long strides_in[] = {0, dims.x * dims.y, dims.x, 1};
        long strides_out[] = {0, (dims.x / 2 + 1) * dims.y, dims.x / 2 + 1, 1};

        std::string err_prefix = "Error: Failed with FFT due to ";

        // create descriptor
        DFTI_DESCRIPTOR_HANDLE Desc_Handle;
        CheckMklFFT(err_prefix, DftiCreateDescriptor(&Desc_Handle, DFTI_SINGLE, DFTI_REAL, 3, lengths));

        CheckMklFFT(err_prefix, DftiSetValue(Desc_Handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE));
        CheckMklFFT(err_prefix, DftiSetValue(Desc_Handle, DFTI_PACKED_FORMAT, DFTI_CCE_FORMAT));
        CheckMklFFT(err_prefix, DftiSetValue(Desc_Handle, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX));
        CheckMklFFT(err_prefix, DftiSetValue(Desc_Handle, DFTI_INPUT_STRIDES, strides_in));
        CheckMklFFT(err_prefix, DftiSetValue(Desc_Handle, DFTI_OUTPUT_STRIDES, strides_out));
        CheckMklFFT(err_prefix, DftiCommitDescriptor(Desc_Handle));

        // direct FFT
        CheckMklFFT(err_prefix, DftiComputeForward(Desc_Handle, image, image_fft.get()));

        // Free descriptor
        CheckMklFFT(err_prefix, DftiFreeDescriptor(&Desc_Handle));

        return image_fft;
    }

My problem occurs when I use a very large array (for example, an image with the dimensions of 814x814x814 when each value is float, the size of the array is about 231, when moving to Fourier domain (to complex numbers) the size of the array grows to ~232).
I compile on Linux system with Intel (R) Xeon (R) CPU E5-4627 v3 @ 2.60GHz processor and add the following flags:

  -DMKL_ILP64 -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread

However, as soon as I get to DftiComputeForward, an error value returned with the following error message:
Intel MKL DFTI ERROR: Inconsistent configuration parameters.
I've red at the forum that someone was having a similar problem and on MKL 11 updated 5 it fixed, link to the post:

Unexpected DftiCommitDescriptor failures/interactions using larger inputs with MKL 11.1

Anyone know how to deal with the problem?

Thank you :)

0 Kudos
2 Replies
Cohen__Idan
Beginner
508 Views

I've found the problem.

When I allocate memory I use ippsMalloc_64fc, but this allocation allocate memory for blocks of 32-bit length, and the blocks that I use are bigger, so the memory should be allocated by ippsMalloc_64fc_L.

0 Kudos
Gennady_F_Intel
Moderator
508 Views

thanks for the update. that's true, for work with 64-bit object sizes, IPP suggest to use platform-aware  API

0 Kudos
Reply