Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

how to use GETRF,GETRI in MKL ?

sunshine177
Beginner
2,722 Views
Hello,
I am trying to do matrix inversion and the following is my code.
(I am using intel visual fortran v11 with visual studio 2005)
program Console2
USE mkl95_PRECISION
USE mkl95_LAPACK
implicit none
integer, dimension(2,2) :: a,ipiv
a(1,1)=1
a(1,2)=2
a(2,1)=3
a(2,2)=4
call GETRF(a,ipiv)
call GETRI(a,ipiv)
end program Console2
And the result is
Error 1 error #6285: There is no matching specific subroutine for this generic subroutine call. [GETRF] C:\\Documents and Settings\\MyHome\\My Documents\\Visual Studio 2005\\Projects\\Console2\\Console2\\Console2.f90 29
Error 2 error #6285: There is no matching specific subroutine for this generic subroutine call. [GETRI]
C:\\Documents and Settings\\MyHome\\My Documents\\Visual Studio
2005\\Projects\\Console2\\Console2\\Console2.f90 30
Error 3 Compilation Aborted (code 1) C:\\Documents and Settings\\MyHome\\My Documents\\Visual Studio
2005\\Projects\\Console2\\Console2\\Console2.f90 1

I think MKL is not linked to my code.
But in solution explorer, right click on the project name -> properties->fortran->libraries->use intel kernel libraries. I did this.
anyone can help me with this?




0 Kudos
1 Solution
mecej4
Honored Contributor III
2,722 Views
To what the link-line advisor proposes to you, prepend mkl_lapack95.lib and mkl_blas95.lib, if using the command line. In Visual Studio, you will need to add these libraries at the appropriate place.

With some older versions of MKL, the Fortran libraries and interfaces were delivered in source form only, along with a makefile to build the needed parts and install them in the proper places.

A request to have the F95 interfaces included in the Link Line Advisor is pending: DPD200189627.

View solution in original post

0 Kudos
11 Replies
TimP
Honored Contributor III
2,723 Views
It's telling you that lapack95 doesn't support those functions for the case of the combination of integer matrix a and rank 2 pivot record ipiv. You could examine the source code or the lapack95 users' guide, as well as MKL docs, to see which choices should be supported. It won't attempt to link until you resolve the compile time problem.
0 Kudos
mecej4
Honored Contributor III
2,723 Views
The array 'a' should be type REAL or DOUBLE PRECISION. The array ipiv should be rank-1, not rank-2, and dimensioned (2), although it may not hurt to use a size larger than necessary.
0 Kudos
sunshine177
Beginner
2,723 Views
Thanks!
I changed my code, but I found new problem.
program Console1
USE mkl95_PRECISION
USE mkl95_LAPACK
implicit none
double precision, dimension(2,2) :: a
integer,dimension(1,2) :: ipiv
a(1,1)=1
a(1,2)=2
a(2,1)=3
a(2,2)=4
call GETRF(a,ipiv)
call GETRI(a,ipiv)
end program Console1
Error 1 error #7002: Error in opening the compiled module file. Check INCLUDE paths. [MKL95_PRECISION] C:\Documents and Settings\MyHome\My Documents\Visual Studio 2005\Projects\Console1\Console1\Console1.f90 16
Error 2 error #7002: Error in opening the compiled module file. Check INCLUDE paths.
[MKL95_LAPACK] C:\Documents and Settings\MyHome\My Documents\Visual Studio
2005\Projects\Console1\Console1\Console1.f90 17
Error 3 Compilation Aborted (code 1) C:\Documents and Settings\MyHome\My Documents
\Visual Studio 2005\Projects\Console1\Console1\Console1.f90 1

Is this the problem of inappropriate arguments again or of linking ?


0 Kudos
mecej4
Honored Contributor III
2,723 Views
There are two files called blas.f90 and lapack.f90 in the MKL include directory. Compiling these files will produce the module files that your compilation run could not locate. Alternatively, you could search for the module files by name and, if you find them, give the directory containing those files with the -I option to the compiler.

Oddly enough, this issue was brought up in another forum today.
0 Kudos
sunshine177
Beginner
2,723 Views
Thanks, but I still have problem. I have little background of computer science.
The following is what I did so far.
1.I choose intel visual fortran console application.
2. project > properties > fortran >Libraries >use intel mkl>sequential
3.I followed the documents
-Select Project > Properties > Linker > General > Additional Library
Directories. Add the architecture-specific lib folder
-->my case,C:\Program Files\Intel\Compiler\11.1\048\mkl\ia32\lib
-Select Project > Properties > Linker > Input > Additional Dependencies. Insert
mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib.
4. ifort -cblas.f90
ifort -clapack.f90
This made the following files inC:\Program Files\Intel\Compiler\11.1\048\mkl\include
blas95.mod
f95_precision.mod
lapack95.mod
mkl95_blas.mod
mkl95_lapack.mod
mkl95_precision.mod

5. I run my code

program Console5
USE mkl95_PRECISION
USE mkl95_LAPACK
implicit none
double precision, dimension(2,2) :: a
integer,dimension(1,2) :: ipiv
a(1,1)=1
a(1,2)=2
a(2,1)=3
a(2,2)=4
call GETRF(a,ipiv)
call GETRI(a,ipiv)
end program Console5
6. and the error message
Error 1 error #6285: There is no matching specific subroutine for this generic subroutine call. [GETRF] C:\Documents and Settings\MyHome\My Documents\Visual Studio 2005\Projects\Console5\Console5\Console5.f90 27
Error 2 error #6285: There is no matching specific subroutine for this generic subroutine call.
[GETRI] C:\Documents and Settings\MyHome\My Documents\Visual Studio 2005\Projects\Console5\Console5\Console5.f90 28
Error 3 Compilation Aborted (code 1) C:\Documents and Settings\MyHome\My Documents\Visual Studio 2005\Projects\Console5\Console5\Console5.f90 1

And I tried in a different way, I typed,
ifort -I"C:\Program Files\Intel\Compiler\11.1\048\mkl\include" console5.f90
But the same error message showed up.
What did I do wrongly?

0 Kudos
mecej4
Honored Contributor III
2,723 Views
As I wrote in #2, the array ipiv should be rank-1. A rank-2 array does not match a rank-1 array.

Replace

integer,dimension(1,2) :: ipiv

by

integer,dimension(2) :: ipiv
0 Kudos
sunshine177
Beginner
2,723 Views
Thanks.
I replaced integer,dimension(1,2) :: ipiv by integer,dimension(2) :: ipiv.
But now, it says,
Error 1 error LNK2019: unresolved external symbol _DGETRF_MKL95 referenced in function _MAIN__ Console5.obj
Error 2error LNK2019: unresolved external symbol _DGETRI_MKL95 referenced in function _MAIN__ Console5.obj
Error 3 fatal error LNK1120: 2 unresolved externals Debug\Console5.exe
why did it happen?
It seems that dgetrf.f90 and dgetri.f90
inC:\ProgramFiles\Intel\Compiler\11.1\048\mkl\interfaces\lapack95\source
should be connected with concole5.f90 when it is being compiled.
But I dont know what I should do with this.
0 Kudos
TimP
Honored Contributor III
2,723 Views
Are you up to the stage where you must consult the link advisor?
0 Kudos
sunshine177
Beginner
2,723 Views
I ve checked link advisor already.
I did this.
-Select Project > Properties > Linker > Input > Additional Dependencies. Insert
mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib.
Is this what you want to say?
0 Kudos
mecej4
Honored Contributor III
2,723 Views
To what the link-line advisor proposes to you, prepend mkl_lapack95.lib and mkl_blas95.lib, if using the command line. In Visual Studio, you will need to add these libraries at the appropriate place.

With some older versions of MKL, the Fortran libraries and interfaces were delivered in source form only, along with a makefile to build the needed parts and install them in the proper places.

A request to have the F95 interfaces included in the Link Line Advisor is pending: DPD200189627.
0 Kudos
sunshine177
Beginner
2,723 Views
Thanks so much. It works now.
I added
mkl_lapack95.lib mkl_blas95.lib
inSelect Project > Properties > Linker > Input > Additional Dependencies.
Thanks again.
0 Kudos
Reply