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

f90 compiling/linking to MKL library - syev routine

mzp
Beginner
357 Views

Hello,

I am trying to link my code to syev LAPACK 95 routine and cannot compile it can you help with I am missing?

The code with compile ok with ssyev but is more convenient to use f95 interfaces 

Thanks,

 

 

ifort -O3  -mkl=sequential   test.f90 test.x

...

real :: corr(5,5), eval(5)

...

  CALL syev(corr,eval,'V')

  PRINT *,eval

...

/tmp/ifortGvqotk.o: In function `MAIN__':
test.f90:(.text+0x411f): undefined reference to `syev_'

0 Kudos
3 Replies
mecej4
Honored Contributor III
357 Views

You have two mistakes.

1. You called the generic subroutine syev(), which takes optional arguments as well, without providing an interface. You can correct this by inserting the statement use lapack95 in the caller(s).  See the section "Fortran 95 Interface Conventions for LAPACK Routines" in the MKL Reference (Fortran).

2. You should specify that the linker should use the Lapack95 library. To find the list of libraries to use, you may use the MKL Link Line Advisor, https://software.intel.com/sites/products/mkl/mkl_link_line_advisor.htm .

0 Kudos
Gennady_F_Intel
Moderator
357 Views

you may also take a look at the syev.f90 example and you will see all needed to build and run. you may find out this example into mklroot\examples\lapack95\source folder

0 Kudos
mzp
Beginner
357 Views

Thanks, the code will compile with

mpiifort -O2 test.f90 -mkl=parallel -o test.x -lmkl_lapack95_lp64

or

ifort -O2 test.f90 -mkl=sequential -o test.x -lmkl_lapack95_lp64

and insert use lapack95 in the main block

Many thanks for helping!

0 Kudos
Reply