Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

Errors using MKL FFTW, OpenMP, and Visual Fortran 9.1

david_sallngc_com
500 Views
Hi!

I am getting data errors when using the Intel MKL FFTW libraires and Fortran code compiled using OpenMP. I am generating a mexfunction for Matlab and am using the Intel 9.1 Visual Fortran compiler for Windows and the Intel MKL 10.1.3.028 libraires (I must use the version 9.1 compiler due to restrictions from the version of Matlab I am using). I am generating a static build of my mexfunction using the command,

> mex foo.f90 'c:\program files\intel\mkl\10.1.3.028\ia32\lib\fftw3xf_ms.lib' 'c:\...\libguide40.lib' 'c:\...\mkl_intel_thread.lib' 'c:\...\mkl_intel_c.lib' 'c:\...\mkl_core.lib'

and using the option '/Qopenmp' in the COMPFLAGS in the mexopts.bat file.

If I create my mexfunction without using OpenMP then the program results using the MKL FFTW and the FFTW library from www.fftw.org are identical. Compiling the code using OpenMP gives erroneous results.

Are there incompatabilities using Intel Visual Fortran 9.1 and MKL 10.1.3.028? Am I inadvertently trying to run a threaded version of FFTW? In my code, I do NOT call for a threaded version of FFTW. I use OpenMP to speed up DO-LOOPS that contain FFTW calls.

Thank you very much for your help.

Sincerely,

David
0 Kudos
2 Replies
TimP
Honored Contributor III
500 Views
You may require the libguide from MKL (newer than the one from ifort 9.1) to find a version which is compatible both with ifort 9 and with MKL 10.1. If you don't want MKL to start its own threads or have problems with OpenMP run time link compatibility, use the mkl_sequential library in place of mkl_intel_thread. Then you should not have a problem with the libguide chosen by ifort 9.1. These problems should be alleviated by ifort professional (all recent versions), where the current MKL is included in ifort.
0 Kudos
david_sallngc_com
500 Views
Quoting - tim18
You may require the libguide from MKL (newer than the one from ifort 9.1) to find a version which is compatible both with ifort 9 and with MKL 10.1. If you don't want MKL to start its own threads or have problems with OpenMP run time link compatibility, use the mkl_sequential library in place of mkl_intel_thread. Then you should not have a problem with the libguide chosen by ifort 9.1. These problems should be alleviated by ifort professional (all recent versions), where the current MKL is included in ifort.
Hi tim18!

Thank you for the response but I still get the same result using the mkl_sequential library. I must make a static build (my mexfunction dll will be on computers that do not have MSVS and Intel compilers and MKL) and require OpenMP for program speed. I am also limited to using the Intel Visual Fortran version 9.1 because of Matlab restrictions. I have tried using MKL 9.1.027 using the following library list,

> mex foo.f90 'c:program filesintelmkl9.1.027ia32libfftw3xf_ms.lib' 'c:...liblibguide40.lib' 'c:...libmkl_c.lib' 'c:...libmkl_ia32.lib'

but this crashes Matlab when I run the dll.

So this is where I stand:
1) if I use MKL 9.1.027 I can not make either a static or shared version of my code. Both will crash Matlab.
2) if I use MKL 10.1.3.028 I can make a static build without OpenMP and get correct output data. If I compile using /Qopenmp, I get incorrect output (but does not crash Matlab)

Do I have any options left?

Thanks again for your help.

Sincerely,

David
0 Kudos
Reply