Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Call MKL Lapack subroutines and run on HPC machine

diandian
Beginner
349 Views

Hi,

I have problems to call the fortran Lapack subroutines. I am running my fortran 95 code on the HPC machine at the University of Arizona. I need to call SYTRI and SYTRF. The sample codes attached in the machine do not work. Could you let me know what is the correct statement in fortran code to call those subroutines and what is the compiling command? 

What I am doing is the following: 

!module load intel 
ifort -O prgram.f90 

!I call the subroutines in my code as (this is the same as the sample codes in the HPC documentation): 

USE mkl95_PRECISION, ONLY: WP => SP 
USE mkl95_LAPACK, ONLY: SYTRI, SYTRF 

Implicit none


! then 
CALL sytrf(MATA, 'U', IPIV, INFO) 
CALL SYTRI(MATA, IPIV, 'U', INFO) 

!  The errors are:

matrix_inverse.f90(12): error #6285: There is no matching specific subroutine for this generic subroutine call. [SYTRF]
CALL sytrf(MATA, 'U', IPIV, INFO)
---------^
matrix_inverse.f90(13): error #6285: There is no matching specific subroutine for this generic subroutine call. [SYTRI]
CALL SYTRI(MATA, IPIV, 'U', INFO)
---------^
compilation aborted for matrix_inverse.f90 (code 1)



Thanks for your help

0 Kudos
3 Replies
TimP
Honored Contributor III
349 Views
There's an example int the mkl examples lapack95 folder which comes with MKL. The message appears to indicate that the data types and array ranks don't match one of the supported combinations (IPIV a rank 1 integer array, INFO a rank 0 integer, MATA a rank 2 real or complex array). This would happen if you omitted any of those declarations, if implicit none didn't complain first.
0 Kudos
diandian
Beginner
349 Views
Hi, Sir: Thanks for your comments. I think I define IPIV(3) , INFO as integer and MATA is a 3X3 symetric real matrix. Now the problem becomes: matrix_inverse.f90:(.text+0xfc): undefined reference to `dsytrf_mkl95_' matrix_inverse.f90:(.text+0x1bf): undefined reference to `dsytri_mkl95_' So, there must be a problem in the US statement: USE mkl95_LAPACK, ONLY: SYTRI, SYTRF But this is the code I get from the documentation within the HPC sever.
0 Kudos
mecej4
Honored Contributor III
349 Views
You have to specify to the linker that you want the Lapack-95 library to be searched. The "USE mkl95_LAPACK" directive instructs the compiler to look up the correct interfaces to the xxx_mkl95_ routines, but the libraries containing the object codes of those routines must be specified by the user.
0 Kudos
Reply