Community
cancel
Showing results for 
Search instead for 
Did you mean: 
107 Views

Matrix Inversion Using Intel MKL

Hi,

I am trying to write a simple matrix inversion routine in Ubuntu 64 bit. I modified one of the MKL example codes as follows:

program inversion

use mkl95_lapack, only: getrf, getri

implicit none

integer:: I, N
integer, dimension(:), allocatable:: IPIV
double precision, dimension(:,:), allocatable:: A, AA

N = 3

allocate( IPIV(N) )
allocate( A(N,N), AA(N,N) )

AA(1,1) = 1.0d0; AA(1,2) = 3.0d0; AA(1,3) = 1.0d0
AA(2,1) = 1.0d0; AA(2,2) = 1.0d0; AA(2,3) = 2.0d0
AA(3,1) = 2.0d0; AA(3,2) = 3.0d0; AA(3,3) = 4.0d0

A = AA

write(*,*) 'The Matrix A is:'
do I = 1,N
write(*,*) AA(I,:)
end do

write(*,*) 'The First Step is to Factorise A'
call getrf( A, IPIV )

write(*,*) 'The Inverted Matrix is:'
do I = 1,N
write(*,*) A(I,:)
end do

write(*,*) 'The Second Step is to Invert A'
call getri( A, IPIV )

write(*,*) 'The Inverted Matrix is:'
do I = 1,N
write(*,*) A(I,:)
end do

end program inversion

I keep getting an error message saying: error #6285: There is no matching specific subroutine for this generic subroutine call. [GETRI]


I am pretty new to using MKL templates for applications, and I was wondering if someone could throw some pointers as to what is happening. My link-line during compilation is as follows:

ifort inversion.f90 -I/opt/intel/mkl/include/intel64/ilp64 -L/opt/intel/mkl/lib/intel64/ -lmkl_lapack95_ilp64 -lmkl_blas95_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -o inversion.out

Any help or tips would be great for this newbie !! :)
0 Kudos
4 Replies
107 Views

I must add - the above program with the corresponding library linking worked perfectly fine in 32 bit environment Ubuntu.
TimP
Black Belt
107 Views

I must add - the above program with the corresponding library linking worked perfectly fine in 32 bit environment Ubuntu.

Then why did you link the ilp64 libraries, when the lp64 libraries are the ones for 32-bit (default) integers? Did you check whether your chosen copy of the USE .mod files wants 32- or 64-bit integers?
Chao_Y_Intel
Employee
107 Views

Hi,

As Tim suggest, the LP64 libraries should be the choice. The following post may help to provide some clarification on the difference:
http://software.intel.com/en-us/forums/showthread.php?t=83366

Thanks,
Chao

107 Views

Hi,

Many thanks. I used the LP64 libraries and it worked. In reponse to the message on using ILP64 - I was actually confused since I had initially written and run the code in Ubuntu 32 bit machine, and then had to include it in a job to be run in a 64 bit machine - hence I ended up wrongly linking ILP64.

Many thanks again
Reply