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

In-place 2D FFT code example: Transform does not change data

Octionary
Beginner
2,183 Views

Hi,

 

I am following the oneMKL 2D FFT code examples to perform a real to complex forward transform in-place. However, after the transform has been computed, the data does not appear to have changed. No errors are produced.

 

Attempting to upload the code on this site as a .cpp or even .txt file gives the error :

"The attachment's main.cpp/.txt content type (text/plain) does not match its file extension and has been removed."

I have instead uploaded the C++ code and CMakeLists here.

 

Any help is much appreciated.

 

Best regards,

Bjarke

0 Kudos
19 Replies
ShanmukhS_Intel
Moderator
2,150 Views

Hi Bjarke,


Thanks for posting on Intel Communities.


We have tried running the code in our environment and we could see the results being printed as well. Could you please let us know your environment details?


Best Regards,

Shanmukh.SS


0 Kudos
Octionary
Beginner
2,136 Views

Hi Shanmukh,

 

Thank you for your response. I am using Qt Creator 8.0.1 with Qt 6.4.0 MSVC2019 64bit and the following environment variables:

-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG
-DCMAKE_C_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe
-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_INSTALL_PREFIX:PATH=C:/Program Files (x86)/mkl_test
-DCMAKE_PREFIX_PATH:PATH=C:/Qt/6.4.0/msvc2019_64
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=C:/Qt/Tools/QtCreator/share/qtcreator/package-manager/auto-setup.cmake
-DENABLE_BLACS:BOOL=OFF
-DENABLE_BLAS95:BOOL=OFF
-DENABLE_CDFT:BOOL=OFF
-DENABLE_CPARDISO:BOOL=OFF
-DENABLE_LAPACK95:BOOL=OFF
-DENABLE_OMP_OFFLOAD:BOOL=OFF
-DENABLE_SCALAPACK:BOOL=OFF
-DMKL_ARCH:STRING=intel64
-DMKL_DIR:PATH=C:/Program Files (x86)/Intel/oneAPI/mkl/2022.2.0/lib/cmake/mkl
-DMKL_H:PATH=C:/Program Files (x86)/Intel/oneAPI/mkl/2022.2.0/include
-DMKL_INTERFACE_FULL:STRING=intel_ilp64
-DMKL_LINK:STRING=dynamic
-DMKL_MPI:STRING=intelmpi
-DMKL_THREADING:STRING=intel_thread
-DOMP_DLL_DIR:PATH=C:/Program Files (x86)/Intel/oneAPI/mkl/2022.2.0/../../compiler/latest/windows/redist/intel64_win/compiler
-DOMP_LIBRARY:FILEPATH=C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/compiler/lib/intel64_win/libiomp5md.lib
-DQT_CREATOR_SKIP_PACKAGE_MANAGER_SETUP:BOOL=OFF
-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Qt/6.4.0/msvc2019_64/bin/qmake.exe
-Dmkl_core_file:STRING=C:/Program Files (x86)/Intel/oneAPI/mkl/2022.2.0/lib/intel64/mkl_core_dll.lib
-Dmkl_intel_ilp64_file:FILEPATH=C:/Program Files (x86)/Intel/oneAPI/mkl/2022.2.0/lib/intel64/mkl_intel_ilp64_dll.lib
-Dmkl_intel_thread_file:FILEPATH=C:/Program Files (x86)/Intel/oneAPI/mkl/2022.2.0/lib/intel64/mkl_intel_thread_dll.lib

 

Best regards,

Bjarke

 

0 Kudos
Octionary
Beginner
2,136 Views

I should also add that the 1D FFTs from the code examples work fine for me. It is just that the 2D FFTs do not seem to update the results.

0 Kudos
ShanmukhS_Intel
Moderator
2,104 Views

Hi Bjarke,

 

We could see the data before and after transform. Attached the same for your reference.

 

Could you please cross verify the same and check if it meets the minimum software requirements?

 

Best Regards,

Shanmukh.SS

 

0 Kudos
Octionary
Beginner
2,087 Views

Hi Shanmukh,

 

Your output indeed looks correct. I have attached my output for the 2D FFT in question but also for a 1D FFT with similar code which manages to produce the expected result. The code for the 1D FFT is also attached.

 

Best regards,

Bjarke

0 Kudos
ShanmukhS_Intel
Moderator
2,059 Views

Hi Bjarke,


Could you please try compiling and running the code on Intel oneAPI command prompt and check for the results?


Please refer to the below link for more information regarding running the sample project using the command line.

https://www.intel.com/content/www/us/en/develop/documentation/get-started-with-intel-oneapi-hpc-linux/top/run-a-sample-project-using-the-command-line.html


Best Regards,

Shanmukh.SS


0 Kudos
Octionary
Beginner
1,969 Views

Hi again Shanmukh,

 

The transform indeed works when using the oneAPI command prompt to build and run the program. However, I still need to work out how to use the code through my IDE, as I want to integrate it with a larger project. Even when running Qt Creator through the oneAPI command prompt, the 2D FFT does not seem to work, while the 1D FFT still works. Do you have ideas for, what I could try?

 

Best regards,

Bjarke

0 Kudos
ShanmukhS_Intel
Moderator
2,024 Views

Hi Bjarke,


A gentle reminder:

We have not heard back from you. Has the information provided helped? Kindly let us know if we could help you further.


Best Regards,

Shanmukh.SS


0 Kudos
Octionary
Beginner
2,003 Views

Hi Shanmukh, I have been busy with some pressing matters, but I expect to look into this soon. BR, Bjarke

0 Kudos
ShanmukhS_Intel
Moderator
1,918 Views

Hi Bjarke,


Could you please refer to the below link details about hardware, operating system, and software prerequisites for the Intel® oneAPI Math Kernel Library.


https://www.intel.com/content/www/us/en/developer/articles/system-requirements/oneapi-math-kernel-library-system-requirements.html


Best Regards,

Shanmukh.SS


0 Kudos
Octionary
Beginner
1,899 Views

Hi Shanmukh,

 

I see that Qt Creator is not officially supported. However, when building with CMake in Visual Studio 2019, I get the same issue. However if built with nmake and run through the CLI, everything works as expected. So what could I try to make it work with CMake?

 

Best regards,

Bjarke 

0 Kudos
ShanmukhS_Intel
Moderator
1,773 Views

Hi Bjarke,

 

We would like to inform you that we were able to compile and execute the shared source code successfully in our environment.

 

Attached is the screenshot which contains source code output when ran using Visual Studio.

 

Best Regards,

Shanmukh.SS

 

0 Kudos
Octionary
Beginner
1,764 Views

Hi Shanmukh,

 

I do not see an attached screenshot. Was the project built using the CMakeLists.txt I provided?

 

Best regards,

Bjarke

0 Kudos
Octionary
Beginner
1,748 Views

Hi again,

 

I found out that the statuses returned DftiCommitDescriptor and DftiComputeForward are different depending on whether I use nmake or CMake. 

 

Building with nmake I get:

status = DftiCreateDescriptor(&my_desc_handle, DFTI_SINGLE,
DFTI_REAL, 2, dim_sizes);
    status = 0

status = DftiCommitDescriptor(my_desc_handle);
    status = 0

status = DftiComputeForward(my_desc_handle, r2c_data);
    status = 0

status = DftiFreeDescriptor(&my_desc_handle);
    status = 0

 

While building with CMake I get:

status = DftiCreateDescriptor(&my_desc_handle, DFTI_SINGLE,
DFTI_REAL, 2, dim_sizes);
    status = 0

status = DftiCommitDescriptor(my_desc_handle);
    status = 9

status = DftiComputeForward(my_desc_handle, r2c_data);
    status = 2

status = DftiFreeDescriptor(&my_desc_handle);
    status = 0

 

I cannot seem to find any documentation for these status values. Perhaps you could explain what they mean?

 

Best regards,

Bjarke

 

0 Kudos
ShanmukhS_Intel
Moderator
1,601 Views

Hi Bjarke,


Could you please refresh the page and check for the screenshot? Below are various types of predefined error statuses.


0 DFTI_NO_ERROR  No error. The zero status belongs to this class.
1 DFTI_MEMORY_ERROR  Usually associated with memory allocation.
2 DFTI_INVALID_CONFIGURATION  Invalid settings in one or more configuration parameters.
3 DFTI_INCONSISTENT_CONFIGURATION Inconsistent configuration or input parameters.
4 DFTI_NUMBER_OF_THREADS_ERROR  Number of OMP threads in the computation function is
not equal to the number of OMP threads in the initialization stage (commit function).
5 DFTI_MULTITHREADED_ERROR  Usually associated with a value that OMP routines return in case of errors.
6 DFTI_BAD_DESCRIPTOR  Descriptor is unusable for computation.
7 DFTI_UNIMPLEMENTED Unimplemented legitimate settings; implementation dependent.
8 DFTI_MKL_INTERNAL_ERROR  Internal library error.
9 DFTI_1D_LENGTH_EXCEEDS_INT32  Length of one of the dimensions exceeds 232 -1 (4bytes).
9 DFTI_1D_MEMORY_EXCEEDS_INT32  Data size of one of the transforms exceeds 231 -1 bytes.



You could also go through the below link for more details regarding the same.

https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/fourier-transform-functions/fft-functions/status-checking-functions/dftierrorclass.html


Best Regards,

Shanmukh.SS


0 Kudos
Octionary
Beginner
1,527 Views

Hi Shanmukh,

Thank you for the error codes. According to these, it seems that the length of a dimension in the 30x30 transform exceeds 2E32.

By the way, the latest screenshot you sent was of the 1D FFT code which I said ran fine in my environment.

Anyways, I have the corresponding example working using the FFTW3 interface, so I will be sticking to that.

Best regards,

Bjarke

0 Kudos
ShanmukhS_Intel
Moderator
1,518 Views

Hi Bjarke,


I have the corresponding example working using the FFTW3 interface, so I will be sticking to that.

>> Thanks for sharing with us the details. As your issue has been resolved, Could you please let us know if we could close this case at our end?


Best Regards,

Shanmukh.SS


0 Kudos
Octionary
Beginner
1,465 Views

Yes, you can close it. Thank you for the help. Best regards, Bjarke

0 Kudos
ShanmukhS_Intel
Moderator
1,453 Views

Hi Bjarke,


Thanks for the confirmation! If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Have a great day!


Best Regards,

Shanmukh.SS


0 Kudos
Reply