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

Intel MKL 2018 update 1 Linkage problems with Visual Studio 2017

bouzas__dimitrios
1,916 Views

Description

Just bought my new Visual Studio 2017 and I wanted to give it a shot with the new Intel MKL v2018 update 1. Although, I followed "precisely" the instructions for automatically setting MKL v2018 to work along side with Visual Studio 2017 as shown in the thread : "Compiling and Linking Intel Math Kernel Libray with MicrosoftVisual Studio C++". I have unresolved linkage issues. I even tried to repair my MKL v2018 update 1 installation but the issues still remain. I get a strange warning that my intuition tells that some environmental variable wasn't set right or something during the installation process went wrong (emphasis mine):

Severity Code Description Project File Line Suppression State
Warning Could not expand MKLProductDir variable. Corresponding version of Intel(R) MKL is not installed or the registry information may be incorrect. Matrix C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141\ImportAfter\Intel.Libs.MKL.v141.targets 37
 
Linkage errors I get are of the form (emphasis mine):
 
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _cblas_sswap referenced in function "void __cdecl mkl::sswap(int,float *,int,float *,int)" (?sswap@mkl@@YAXHPAMH0H@Z) Matrix C:\Users\bouza\source\repos\Matrix\Matrix\Matrix\mkl_interface.obj 1
 
The project can be found in github in the following link:
 
 

Questions

Is this a bug of Intel MKL v2018 update 1 or Visual Studio 2017, or is it an omission of mine? Either way, is there a work around or a way to fix this?

0 Kudos
5 Replies
mecej4
Honored Contributor III
1,916 Views

I have not looked into your source files in detail, but one error message from the build process is notable -- the one regarding %MKL_PRODUCT_DIR% not being defined. A consequence of this environmental variable not being defined may be that the CBLAS library is not found during linking.

It would help if you attached the buildlog.htm file from the failed build attempt.

0 Kudos
Zhen_Z_Intel
Employee
1,916 Views

Hi Dimitrios,

For the Warning Could not expand MKLProductDir variable error, you probably not install/integrated MKL correctly.

1. Firstly, please check your environmental variable "Path" in any command window through "set" command, watch if you have already set MKL product Dir, the path normally like "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_<your_version>\windows\redist\intel64\mkl". If it is not been set, run script file "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_<your_version>\windows\bin\compilvars.sh intel64".

2. Check if the "property" of your project -> "configuration Properties" -> "General" -> "Platform Toolset" is set to "Intel C++ Compiler 18.0"? Also select "Tools" -> "Options" -> "Intel Compilers and Tools", check the version of Intel compiler and Performance Libraries you are using.

3. If above suggestions still no help, you probably install MKL incorrectly, please try to reinstall. And send me your installation log file under %tmp%\pset_tmp_PSXE2018_<your_username>\<date_installed_mkl>\

For the unresolved external symbol error, you probably not link to MKL libs correctly:

1. The cblas_sswap symbol is defined in "mkl_intel_lp64.<lib|dll>" for static/dynamic linkage, and "mkl_rt.dll" for single dynamic. check your linked MKL libraries. Normally, if your MKL Product Dir is not set correctly, VS could not find proper libraries for MKL, even could not link correctly.

Best regards,
Fiona

 

 

 

0 Kudos
bouzas__dimitrios
1,916 Views

​Thank you all for the reply and time.

  1. Yes my environmental variables aren't set. Running "compilvar.sh intel64" in my command prompt seems to set them, but this doesn't really help, problem still remains (Shouldn't these variables being set automatically with the installation of MKL? Why do I have to do this manually? Even if this was the solution, I'd had to run "compilevar.sh" everytime windows boot or I'd had to set the .bat file to run everytime windows boot).
  2. I don't have an Intel compiler installed. I run with Clang though, that comes with visual studio 2017, but this didn't helped either.
  3. Reinstalled Intel MKL 2018 update1. Reinstallation screwed up my installation of visual studio 2017. Now Visual studio 2017 doesn't have icons on its buttons and apart from this, reinstallation didn't solve the problem.

Really frustrated here.

(thinking out loud)  I guess I'll have to wait for a more mature update of MKL, if considering installing MKL at all in the future". Going to the phycologist now, after all these I surely need an extra session...

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

OK back from the phycologist, this really helped... not...

Uninstalling MKL 2018 brought back the icons of visual studio,vs_no_icons.png

(thinking loud) "thank God!".

Assuming that update 1 is screwed up. I installed MKL 2018 initial release.

  1. Installing MKL 2018 initial release.
  2. Created an empty Visual C++ project.
  3. Created in the empty project a "main.cpp" file.
  4. Created in the "main.cpp" a main function (see code below).
  5. Build OK!
  6. Project > Properties > Intel Performance Libraries > Set Intel MKL "Parallel"
  7. Project > Properties > C/C++ > Code Generation > Runtime Library > set Multi-Threaded /MT
  8. Build FAILED!

Error:

Severity Code Description Project File Line Suppression State
Error MSB4086 A numeric comparison was attempted on "$(MKLMajorVersion)" that evaluates to "" instead of a number, in condition "'$(SuiteVer)' == '[Intel Compiler is not installed]' AND (($(MKLMajorVersion) == 11 AND $(MKLMinorVersion) >= 3) OR $(MKLMajorVersion) >= 17)". MKLSandbox C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141\ImportBefore\Intel.Libs.MKL.v141.targets 41
 
Code:
int main() {}

(Thinking out loud) I guess people over Intel didn't expect malicious users like me. That would install MKL 2018 update 1, after seeing that it screws up visual studio would uninstall it and then install MKL 2018 initial update to see if this works. Maybe Kerbal Space Program has to do something with it :P, maybe I should uninstall it as well.

P.S Environmental variables in %Path% aren't set with the initial release as well.

 Now let's go for another experiment, install update 1 on top of initial release. Following the same drill (OK this time the icons of visual studio are OK):

  1. Created an empty Visual C++ project.
  2. Created in the empty project a "main.cpp" file.
  3. Created in the "main.cpp" a main function (see code below).
  4. Build OK!
  5. Project > Properties > Intel Performance Libraries > Set Intel MKL "Parallel" mkl_perf_libs.png
  6. Project > Properties > C/C++ > Code Generation > Runtime Library > set Multi-Threaded /MTmkl_code_gen.png
  7. Build OK!
  8. #include "mkl.h" (code below)
  9. Boom! 2 Errors and 6 warning (see pictures bellow).visual_studio.png
  10. Checking for environmental variable and not found them. In command prompt  C:\>cd C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\mkl\bin\
  11. Issuing command "C:\>mklvars.bat intel64"
  12. Issuing command "C:\> echo %Path%"
  13.  Result seems OK (emphasis mine):
    C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\redist\intel64_win\tbb\vc_mt;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\redist\intel64_win\mkl;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\redist\intel64_win\compiler;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.3;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\\MSBuild\15.0\bin;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\WINDOWS\system32;C:\Users\bouza\AppData\Local\Microsoft\WindowsApps;
  14. Opening Visual Studio Again.
  15. Opening same application.
  16. Build same application.
  17. Nothing changed same errors.
  18. Build log: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141\ImportAfter\Intel.Libs.MKL.v141.targets(37,5): warning : Could not expand MKLProductDir variable. Corresponding version of Intel(R) MKL is not installed or the registry information may be incorrect. 
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141\ImportAfter\Intel.Libs.MKL.v141.targets(38,5): warning : Could not expand MKLMajorVersion variable. Corresponding version of Intel(R) MKL is not installed or the registry information may be incorrect. 
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141\ImportAfter\Intel.Libs.MKL.v141.targets(39,5): warning : Could not expand MKLMinorVersion variable. Corresponding version of Intel(R) MKL is not installed or the registry information may be incorrect. 
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141\ImportAfter\Intel.Libs.MKL.v141.targets(40,5): warning : Could not expand MKLIncludeDir variable. Corresponding version of Intel(R) MKL is not installed or the registry information may be incorrect. 
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141\ImportAfter\Intel.Libs.MKL.v141.targets(41,5): warning : Could not expand MKLLibDir variable. Corresponding version of Intel(R) MKL is not installed or the registry information may be incorrect. 
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141\ImportAfter\Intel.Libs.MKL.v141.targets(42,5): warning : Could not expand OmpLibDir variable. Corresponding version of Intel(R) MKL is not installed or the registry information may be incorrect. 
      main.cpp
    c:\users\bouza\source\repos\mklsandbox2\mklsandbox2\main.cpp(1): fatal error C1083: Cannot open include file: 'mkl.h': No such file or directory

 

0 Kudos
Ying_H_Intel
Employee
1,916 Views

Hi

the Step : Configuration Properties > Intel Performance Libraries > Intel (R) Math Kernel Library > Use Intel (R) MKL > Parallel|Sequential

originally, the step  should be fine to link all mkl into your project. 

But maybe there is integration error, between MKL and MSVS 2017.  please see integration to MVSC 2017.

So you may switch off the step , then  try manually link your application with mkl follow by this KB article recipe, i hope this help.

Attach one solution , which have manual mkl setting in project property. for your reference.

thanks,

Ying

0 Kudos
Reply