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

Using Intel MKL with gfortran under Windows

Petros_A_1
초급자
3,750 조회수

Hi,

I have been searching about this for a while. Based on the MKL link advisor, gfortran (or gcc) is not supported under windows. When trying to link to my project (with mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib), I get many undefined references. For instance:

mkl_intel_lp64.lib(_dgemm_lp64.obj):(.text[dgemm]+0x42): undefined reference to `mkl_serv_set_xerbla_interface'
mkl_intel_lp64.lib(_dgemm_lp64.obj):(.text[dgemm]+0x1e3): undefined reference to `__security_check_cookie'

Has anyone managed to work this out? Or, is it simply unsupported and I should give up?

I have the academic license for MKL 2017.

Thanks in advance,
Petros

0 포인트
1 솔루션
mecej4
명예로운 기여자 III
3,751 조회수

Although this is not supported, if your code makes F77 style calls and your MKL license allows it, you can use MKL from Gfortran as follows. For example, take the source code presented in http://software.intel.com/en-us/forums/intel-math-kernel-library/topic/702864, #4. Compile with the command

    gfortran strsmx1.f <...compilers_and_libraries_2017.1.143\windows\redist\intel64\mkl\mkl_rt.dll>

where you have to insert the proper pathname for your installation, and replace "intel64" with "ia32" if appropriate.

Add the directory containing mkl_rt.dll to PATH, and run the example:

   a.exe < strsmx.d

원본 게시물의 솔루션 보기

7 응답
Zhen_Z_Intel
직원
3,750 조회수

Dear customer,

Well, I am afraid MKL does not support for gcc/gfortran linkage in windows environment. You probably need to use MS compiler or Intel compiler.

Best regards,
Fiona 

0 포인트
Petros_A_1
초급자
3,750 조회수

Thanks for the prompt answer Fiona. I already have a Linux license for Intel Parallel Studio for my desktop. I will download the vanilla Blas and Lapack libraries to go with gcc/gfortran.

Best,
Petros

Fiona Z. (Intel) wrote:

Dear customer,

Well, I am afraid MKL does not support for gcc/gfortran linkage in windows environment. You probably need to use MS compiler or Intel compiler.

Best regards,
Fiona 

0 포인트
mecej4
명예로운 기여자 III
3,752 조회수

Although this is not supported, if your code makes F77 style calls and your MKL license allows it, you can use MKL from Gfortran as follows. For example, take the source code presented in http://software.intel.com/en-us/forums/intel-math-kernel-library/topic/702864, #4. Compile with the command

    gfortran strsmx1.f <...compilers_and_libraries_2017.1.143\windows\redist\intel64\mkl\mkl_rt.dll>

where you have to insert the proper pathname for your installation, and replace "intel64" with "ia32" if appropriate.

Add the directory containing mkl_rt.dll to PATH, and run the example:

   a.exe < strsmx.d

Petros_A_1
초급자
3,750 조회수

Thanks! This seems to work fine.

mecej4 wrote:

Although this is not supported, if your code makes F77 style calls and your MKL license allows it, you can use MKL from Gfortran as follows. For example, take the source code presented in software.intel.com/en-us/forums/intel-math-kernel-library/topic/702864, #4. Compile with the command

    gfortran strsmx1.f <...compilers_and_libraries_2017.1.143\windows\redist\intel64\mkl\mkl_rt.dll>

where you have to insert the proper pathname for your installation, and replace "intel64" with "ia32" if appropriate.

Add the directory containing mkl_rt.dll to PATH, and run the example:

   a.exe < strsmx.d

0 포인트
TimP
명예로운 기여자 III
3,750 조회수

I suppose there may be a chance of employing MKL USE , but the .mod files would have to be built from source code using your choice of gfortran version.  There are so many differing versions of gfortran for Windows that I'm surprised at your blanket statements which don't mention versions.

0 포인트
mecej4
명예로운 기여자 III
3,750 조회수

If I may follow in the footsteps of many distinguished posters here, the version, of course, is "the one that I have"!

Seriously, since this is unsupported, I don't want to make any claims at all. This suggestion is in the category of "if you dare to, try the suggestion; if it does not work, don't blame me, don't ask for support." Note that O.P. did not state Gfortran version and pedigree.

If Lapack-95/BLAS-95 calls are involved, there is little hope of being able to build with Gfortran since the wrapper routines use optional arguments, assumed-shape array arguments, etc., and the interface libraries would also need to be rebuilt with Gfortran. Older versions of MKL used to come with sources and makefiles for Lapack95.

0 포인트
Petros_A_1
초급자
3,750 조회수

Dear Tim, I apologise for my "vagueness". I have tried several versions of gfortran; mainly 4.9.2 and 5.3.0. All provided by MINGW. I make direct calls to LAPACK and BLAS subroutines using the f77 notation (e.g., call dgetrf(...)), so .mod files are not needed.

Following the advice above, I linked directly to mkl_rt.dll and it seems to be working fine (with gfortran 5.3.0). I don't know if it's a lucky coincidence or if it will be the case also with new MKL/gfortranversions. To be seen.

Tim P. wrote:

I suppose there may be a chance of employing MKL USE , but the .mod files would have to be built from source code using your choice of gfortran version.  There are so many differing versions of gfortran for Windows that I'm surprised at your blanket statements which don't mention versions.

0 포인트
응답