It is particularly simple to use the Lapack-95 interfaces. With some older versions of MKL, these interfaces were not provided in pre-built form, but one could use a supplied makefile to build them. Here is an example:
[fortran]program linsolx use lapack95, only : getrf, getrs integer ipiv(3) double precision :: a(3,3)=reshape([2.,-1.,0.,-1.,2.,-1.,0.,-1.,2.],[3,3]) double precision :: b(3) = ([4., 5., 6.]) call getrf( a ,ipiv) ! Factorize A call getrs( a, ipiv, b) ! Solve A.x = b write(*,'(3g15.5)') b end program linsolx [/fortran]Compiling and linking:
[bash]S:LANG> ifort /Qmkl getsX.f90 mkl_lapack95.lib [/bash]
Could you tell me where these examples are? I have been trying to link fortran 11.1 with MKL 10.1 but have not been successful yet. Could you please add more details on how to create a link btween intel fortran 11.1 abd MKL 10.1?
please see here the KB article to find outwhich versions of the Intel IPP, Intel MKL and Intel TBB libraries are included as part of theIntel Compiler Probund les V11.* based
Add the paths corresponding to your installation and target architecture to the following configuration items in VS:
Project:Properties:Fortran:Additional Include Directories c:\LANG\Compiler\11.1\070\mkl\include\em64t\lp64
Project:Properties:Fortran:Libraries:Use Intel Math Kernel Library: Sequential (/Qmkl:sequential)
Project:Properties:Linker:Additional Library Directories c:\LANG\Compiler\11.1\070\mkl\em64t\lib
Note that I have installed the compiler in a different location than the default.
How do I know? I simply look for the directory where the file lapack95.mod (the module that you want to USE) exists, since the compiler has to read module files to do its job. Likewise, I look for the directory where the MKL libraries exist since the linker needs to read the library files to build the application.
USE mkl95_LAPACK , only : getrf, getrs
! Body of Console1
double precision :: a(3,3)=reshape([2.,-1.,0.,-1.,2.,-1.,0.,-1.,2.],[3,3])
double precision :: b(3) = ([4., 5., 6.])
call getrf( a ,ipiv) ! Factorize A
call getrs( a, ipiv, b) ! Solve A.x = b
print *, 'Hello World'
end program Console1
I have done the followings:
fortran, general, additional include directories: c:\program files (x86)\intel\compiler\11.1\048\mkl\include\ia32\
fortran, preprocessor, Preprocess Source File: Yes (/fpp)
linker, general, additional library directives: C:\Program Files\Intel\MKL\10.2.7.040\em64t\lib
linker, input, additional dependencies: mkl_lapack95_lp64.lib mkl_solver_lp64_sequential.lib mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib
When I try to compile this code, I get the following errors, please let me know what I need to do. Please write it in the simplest way as you can:
Error 1 error LNK2019: unresolved external symbol _DGETRF_MKL95 referenced in function _MAIN__ Console1.obj
Error 2 error LNK2019: unresolved external symbol _DGETRS1_MKL95 referenced in function _MAIN__ Console1.obj
Error 3 fatal error LNK1120: 2 unresolved externals Debug\Console1.exe
Do not mix 32-bit modules and 64-bit projects. The unresolved external symbols that you reported have the 32-bit decoration (leading underscore).
fortran, general, additional include directories: C:\Program Files\Intel\MKL\10.2.7.040\include
I am still getting the same error. Could you please let me know why?
You have only Win32 targets in your project file, but you have specified the MKL 64 bit libraries as additional dependencies for that target.
I suggest that you delete the messed up project files, and make a clean start again.
Here are the steps:
1. Create a new project, type console application. Add your source file to the project.
2. Choose the configuration as x64, debug.
3. Click Project => Properties => Fortran => Libraries, and elect to use MKL. Click "OK".
4. Click Project => Properties => Linker => Input => Additional Dependencies, and specify mkl_lapack95_lp64.lib. Click "OK".
Note that there is considerable overlap in functionality between MKL and IMSL, e.g., routines for computing eigenvalues. In such cases, note that the interfaces and arguments can be quite different. Furthermore, many routines modify input arguments; thus, if you want to use both, you may need to save and restore such arguments as required.