1
votes

I'm having a lot of trouble linking the Intel MKL libraries to my code in C++. I downloaded the MKL library from this link: https://software.intel.com/content/www/us/en/develop/tools/math-kernel-library/choose-download/windows.html

Then it says to use MKL Link Line Advisor to obtain the proper compiler options, which I'm having a lot of trouble figuring out. For reference, I'm using Windows, g++ 8.1.0 and MinGW-W64. Here is part by part:

  • Intel product: Intel MKL 2020, since I just downloaded it.

  • OS: Windows, no issues there.

  • Compiler: Intel(R) Fortran? I'm using g++ to compile my C++ code, so I have no idea since that option is not available. Doing some research in stackoverflow, it seems the right choice is Intel(R) Fortran

  • Architecture: Intel(R) 64, since I have a 64-bit OS?

  • Dynamic/Static Linking: Static linking I guess?

  • Interface layer: 64-bit, since I have a 64-bit OS?

  • Threading layer: OpenMP, since my current C++ code uses -fopenmp?

  • OpenMP library: Intel(R) libiomp5. Only one option, so no issues here.

  • Fortran95 Interfaces: BLAS95 and LAPACK95

The above choices give me the following compiler options

 /4I8 /module:"%MKLROOT%"\include\intel64/ilp64 -I"%MKLROOT%"\include

And this results in error from the compiler:

/4I8: No such file or directory

Can somebody help me please?

1
I once tried to link against MKL under MinGW and failed with many "undefined symbol"s during the linkage. Nevertheless, try to select Linux and then GNU C/C++ compiler. Note that command options under MinGW (and Linux) are specified with - and not /. You can use both 64-bit and 32-bit interface layer in 64-bit applications. If you use 64-bit interface, you should add -DMKL_ILP64 compiler option (analogous to /4I8, which is purely Fortran option), linking with 64-bits libraries without defining MKL_ILP64 will give you a segfault upon execution. - Evg

1 Answers

0
votes

I think you should use -DMKL_ILP64 -I"%MKLROOT%"\include for g++. You should definitely not pick Intel(R) Fortran for the compiler since you are not compiling Fortran programs.