Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
29 Views

potential bug in mkl configuration in version 2018 update 2

I installed Intel® Parallel Studio XE with VS 2017 integration on a Win 10 platform.

The parallel MKL option in the Properties page works fine as expected. But it seems like the sequential option sometimes fails the compilation using MSVC compiler. Linking error such as cannot find certain library (for example, libmmt.lib, ifconsol.lib) is generated here and there.

I know these libraries are located under windows/compiler/lib/intel_win folder on my machine. Manually adding this path to additional linking path can be a workaround. But I am keen to know what makes a difference between sequential and parallel configuration.

Then I investigated the toolset file Intel.Libs.MKL.v141.props. This file is located under this folder on my machine

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Platforms\x64\PlatformToolsets\v141\ImportAfter

Starting from line 44,

    <MKLProductDir>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Intel\Suites\$(_MKLSubKey)\MKL', 'ProductDir', null, RegistryView.Registry32))</MKLProductDir>
    <MKLIncludeDir>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Intel\Suites\$(_MKLSubKey)\MKL\$(ICPlatform)', 'IncludeDir', null, RegistryView.Registry32))</MKLIncludeDir>
    <MKLLibDir>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Intel\Suites\$(_MKLSubKey)\MKL\$(ICPlatform)', 'LibDir', null, RegistryView.Registry32))</MKLLibDir>
    <OmpLibDir>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Intel\Suites\$(_MKLSubKey)\MKL\$(ICPlatform)', 'OMPLibDir', null, RegistryView.Registry32))</OmpLibDir>

    <_MKLCombinedPath Condition="'$(UseIntelMKL)' != '' AND '$(UseIntelMKL)' != 'No'">$([System.IO.Path]::Combine($(MKLLibDir), ..\..\..\redist\$(IntelPlatform)\mkl))</_MKLCombinedPath>
    <MKLPath Condition="'$(_MKLCombinedPath)' !=''">$([System.IO.Path]::GetFullPath($(_MKLCombinedPath)));</MKLPath>

    <LibraryPath Condition="'$(UseIntelMKL)' != '' AND '$(UseIntelMKL)' != 'No' AND '$(UseEnv)' != 'true'">$(MKLLibDir);$(LibraryPath)</LibraryPath>
    <LibraryPath Condition="'$(UseIntelMKL)' != '' AND '$(UseIntelMKL)' != 'No' AND '$(UseIntelMKL)' != 'Sequential' AND '$(UseEnv)' != 'true'">$(OmpLibDir);$(LibraryPath)</LibraryPath>
    <IncludePath Condition="'$(UseIntelMKL)' != '' AND '$(UseIntelMKL)' != 'No' AND !$(MKLIncludeDir.Contains('/I')) AND '$(UseEnv)' != 'true'">$(MKLIncludeDir);$(IncludePath)</IncludePath>

The paths are retrieved from the registry, I echoed related variables and the results are

echo $(MKLLibDir)
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.2.185\windows\mkl\lib\intel64_win

echo $(OmpLibDir)
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.2.185\windows\compiler\lib\intel64_win

So in the sequential configuration, only MKLLibDir is added to LibraryPath, the parallel option further add OmpLibDir to it. This missing path causes the linking error in sequential configuration for some projects.

Now I can rewrite this condition such as

<!--     <LibraryPath Condition="'$(UseIntelMKL)' != '' AND '$(UseIntelMKL)' != 'No' AND '$(UseEnv)' != 'true'">$(MKLLibDir);$(LibraryPath)</LibraryPath>
    <LibraryPath Condition="'$(UseIntelMKL)' != '' AND '$(UseIntelMKL)' != 'No' AND '$(UseIntelMKL)' != 'Sequential' AND '$(UseEnv)' != 'true'">$(OmpLibDir);$(LibraryPath)</LibraryPath> -->
    <LibraryPath Condition="'$(UseIntelMKL)' != '' AND '$(UseIntelMKL)' != 'No' AND '$(UseEnv)' != 'true'">$(OmpLibDir);$(MKLLibDir);$(LibraryPath)</LibraryPath>

to include all paths into LibraryPath as long as MKL is switched on.

No problem is found for Intel compiler toolset, as in that case, all paths are added when combining ICIncludeDir with LibraryPath, this occurs in following file on my machine.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Platforms\x64\PlatformToolsets\Intel C++ Compiler 18.0\Toolset.props

Problems

Although I can fix it by myself, I still think that, the compiler lib path shall be included whatsoever, this shall be configured in a fashion similar to what is done in other toolsets.

In previous version I did not run into similar problem. Since this may fail other's projects, it shall be fixed am I right?

0 Kudos
1 Reply
Highlighted
Employee
29 Views

 

Hi Ted,

​Thank you very much for post the question in very clear way.  I may say, yes, it should be ok for you to workaround that by add  $(OmpLibDir); when mkl is switched on.

​Here the  $(OmpLibDir); actually means compiler library  for example, libmmt.lib, ifconsol.lib
echo $(OmpLibDir)
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.2.185\windows\compiler\lib\intel64_win.
​Some early MKL version will depend on the compiler libraries.  But  as i recalled,  we removed the dependency in latest 2018 version. So the OmpLibDir is not needed longer. 

Could you please check when the Linking error such as cannot find certain library (for example, libmmt.lib, ifconsol.lib) is generated here and there., which function you are using?  or do you have small test case so we may test at our side.

Best Regards
​Ying​

 

0 Kudos