how to call functions in the MKL_lapack95 library

how to call functions in the MKL_lapack95 library

Hi, I need your help about using the MKL_lapack95 library: I need to call a subroutine ("polyfit.f")  which calls two functions in the MKL_lapack95 library. I am using intel fortran (composer_xe_2013_sp1.2.144) with Fedora 20. The environment should be already set up:


I compile my code with the following command:

ifort -o main main.f polyfit.f -lmkl_lapack95

it says:

/tmp/ifortq7X4uH.o: In function `polyfit_':
polyfit.f:(.text+0x5d0): undefined reference to `dgetrf_'
polyfit.f:(.text+0x68a): undefined reference to `dgetri_'

there is a file named "libmkl_lapack95.a" in the opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/ia32 directory and if I search, for example dgetrf, it returns:

$ grep -ni "dgetrf" libmkl_lapack95.a
Binary file libmkl_lapack95.a matches

Can any please tell me what's wrong here? Thank you very much!


Downloadapplication/octet-stream main_0.f737 bytes
Downloadapplication/octet-stream polyfit.f1.52 KB
3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You need to specify that the base MKL libraries need to be linked. The simple way of doing this is to give the IFort compiler the -mkl option.

In fact, you do not call any Lapack95 routines from your code, so there is no need to specify -lmkl_lapack95.

The code has other errors that you will have to remove. For example, function Polyfit returns an array, and that fact is not specified in the calling routine.

Thank you so much for your prompt reply, mecej4! It solved my problem!


Leave a Comment

Please sign in to add a comment. Not a member? Join today