Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor II
21 Views

How does Fortran choose the version of MKL to link

I received a new Windows 10 PC this week.  I have encountered a problem whilst installing our standard development environment this machine.

I am installing both Visual Studio 2013/Intel Fortran 2013 and Visual Studio 2019/Intel Fortran 2019.  The 2013 version is for maintenance on our previous releases.  The 2019 version is for new development.  Each version of VS is integrated with one version of Fortran.

Our software comprises a C# main that calls a Fortran DLL.  The Fortran DLL uses Intel Math Kernel Libraries (MKL).

On our existing systems, each Fortran version compiles and links with the matching version of MKL.  

On my new system Fortran 2013 compiles and links with the newest version of MKL.

  • With only Fortran 2013 installed, the DLL links with the 2013 version of MKL
  • With Fortran 2013 and 2019 installed, the DLL links with the 2019 version of MKL
  • If I uninstall Fortran/MKL 2019, the DLL links with the 2013 version of MKL
  • If I reinstall Fortran/MKL 2019, the DLL links with the 2019 version of MKL

How does Intel Fortran choose which version of MKL to use?  Any ideas why it varies between machines?

 

0 Kudos
6 Replies
Highlighted
New Contributor II
21 Views

On re-reading the compiler output, I see that the problem may be the Fortran libraries, rather than the MKL libraries. 

Looking at the first few line of the linker output for each case

Desired behaviour (Fortran 2013 without Fortran 2019 installed)

Linking... Creating temporary file "RSP1.rsp" with contents 
[ 
/OUT:"..\SIDRAINTERSECTION\bin\x64\Debug\SIDRUN8.dll" /VERBOSE:LIB /NOLOGO /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE\mkl\lib\intel64" /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler\lib\Intel64" /MANIFEST:NO /DEBUG /PDB:"C:\Users\david\Documents\dev\SI8\Visual Studio Solution\SIDRAINTERSECTION\bin\x64\Debug\SIDRUN8.pdb" /MAP /MAPINFO:EXPORTS /ASSEMBLYDEBUG /SUBSYSTEM:WINDOWS /IMPLIB:"C:\Users\david\Documents\dev\SI8\Visual Studio Solution\SIDRAINTERSECTION\bin\x64\Debug\SIDRUN8.lib" /DLL mkl_lapack95_lp64.lib ... object files ...
]

Creating command line "Link @"C:\Users\david\Documents\dev\SI8\Visual Studio Solution\SIDRUN\x64\Debug\RSP1.rsp""
Link: executing 'link' 
Searching libraries 
Searching C:\Program Files (x86)\Intel\Composer XE\mkl\lib\intel64\mkl_lapack95_lp64.lib: 
Searching C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler\lib\Intel64\ifconsol.lib: 
Searching C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler\lib\Intel64\libifcoremt.lib: 
Searching C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler\lib\Intel64\libifport.lib: 
Searching C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler\lib\Intel64\libmmt.lib: 
Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64\LIBCMTD.lib:

 

Undesired behaviour (Fortran 2013 with Fortran 2019 installed)

Linking...
Creating temporary file "RSP1.rsp" with contents
[
 /OUT:"..\SIDRAINTERSECTION\bin\x64\Debug\SIDRUN8.dll" /VERBOSE:LIB /NOLOGO /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE\mkl\lib\intel64" /MANIFEST:NO /DEBUG /PDB:"C:\Users\david\Documents\dev\SI8\Visual Studio Solution\SIDRAINTERSECTION\bin\x64\Debug\SIDRUN8.pdb" /MAP /MAPINFO:EXPORTS /ASSEMBLYDEBUG /SUBSYSTEM:WINDOWS /IMPLIB:"C:\Users\david\Documents\dev\SI8\Visual Studio Solution\SIDRAINTERSECTION\bin\x64\Debug\SIDRUN8.lib" /DLL mkl_lapack95_lp64.lib ... object files ...
]
Creating command line "Link @"C:\Users\david\Documents\dev\SI8\Visual Studio Solution\SIDRUN\x64\Debug\RSP1.rsp""


Searching libraries
    Searching C:\Program Files (x86)\Intel\Composer XE\mkl\lib\intel64\mkl_lapack95_lp64.lib:
    Searching C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019\windows\compiler\lib\Intel64_win\ifconsol.lib:
    Searching C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019\windows\compiler\lib\Intel64_win\libifcoremt.lib:
    Searching C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019\windows\compiler\lib\Intel64_win\libifport.lib:
    Searching C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019\windows\compiler\lib\Intel64_win\libmmt.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64\LIBCMTD.lib:
    Searching C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019\windows\compiler\lib\Intel64_win\libirc.lib:
    Searching C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019\windows\compiler\lib\Intel64_win\svml_dispmt.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64\OLDNAMES.lib:
    Searching C:\Program Files (x86)\Intel\Composer XE\mkl\lib\intel64\mkl_intel_lp64.lib:
 

 

0 Kudos
Highlighted
Black Belt Retired Employee
21 Views

In Tools > Options > Intel Compilers and Tools > Visual Fortran > Compilers, did you select the 2013 compiler and not "Latest", which is the default? Keep in mind also that there are two parts to this. The linking part simply identifies the name of a DLL to use. When you run the program, it depends on PATH and picks up the first correct-architecture DLL of that name it finds. The MKL DLLs aren't added to PATH by the compiler install.

0 Kudos
Highlighted
New Contributor II
21 Views

Thanks Steve.  That was the problem. 

I have a work instruction for installing Visual Studio and Visual Fortran.  Checking that setting is step 5 on my checklist and I didn't do it.

0 Kudos
Highlighted
Black Belt Retired Employee
21 Views

I didn't think that the 2019 compiler install would let you select a 2013 compiler, but maybe. You may want to look at https://software.intel.com/en-us/articles/using-older-intel-visual-fortran-versions-in-different-microsoft-visual-studio-versions

 

0 Kudos
Highlighted
New Contributor II
21 Views

Thanks Steve.  I have read the document above, and have used it a few times to repair installations.  I think it is out of date.

I completely uninstalled Fortran 2013 and VS 2013, leaving VS 2019 and Fortran 2019 installed.  I then deleted the "<Program Files>\Microsoft Visual Studio 12.0" directory.  

I then re-installed VS2013 and Fortran 2013.  Fortran 2019 was automatically (AFAICT) integrated with VS2013.  I think this is a recent change, as I don't recall seeing this with earlier versions of Fortran 2019.

0 Kudos
Highlighted
Black Belt Retired Employee
21 Views

Parallel Studio XE 2019 still supports VS2013, so you would get VS2013 integration that replaces the older compiler's integration. The article doesn't mention the 2019 PSXE product, so it does need updating there, though I don't think the concepts are too different from the 2018 product. The integration methods are very different, though, due to Microsoft changes.

It has been several years since I wrote this article, and there might be things that have changed. But the basic idea of how to preserve the older integration should still be valid.

0 Kudos