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

MKL question

nvaneck
New Contributor I
736 Views
I haven't used any MKL routines before, and I'm trying to use the spevd eigenvalue routine.

With INCLUDE 'LAPACK.F90' I get 975 warning #6738messages, and the linker says it can't find _spevd.

I must be missing something simple. Can you help?

Thanks!
Neal
0 Kudos
10 Replies
mecej4
Honored Contributor III
736 Views
You left out details of where the INCLUDE statement is placed, how you call MKL and how you compiled and linked the program. Without those, it is difficult to tell you what went wrong.

Here is a short example of calling SPEVD using the Lapack95 interface. The upper triangle of the symmetric matrix is packed by columns into the 1-D array Ap.

[fortran]program spevdx
use lapack95
integer, parameter :: N=4
real, dimension(N*(N+1)/2) :: Ap= &
   (/-4., &
     2.,-6., &
     0.5,2.,-8., &
     0.,0.3,2.,-10./), &
   w(N)

call spevd(Ap,w)
write(*,10)(i,w(i),i=1,N)

10 format(1x,I3,2x,F10.5)

end program spevdx
[/fortran]
Using the current version of IFort (Win32), which comes with the Lapack95 libraries precompiled, build using the command

[bash]ifort /Qmkl spevdx.f90 mkl_lapack95.lib
[/bash]
and run to obtain the results:

[bash]S:LANG>spevdx
   1   -11.37360
   2    -8.43331
   3    -5.91824
   4    -2.27485
[/bash]
0 Kudos
nvaneck
New Contributor I
736 Views

Thanks!

That helped a lot, but when I try it with visual studio I get

"Generic procedure reference has two or more specific procedure with the same type/rank/keyword signature. [SPEVD]"


I haven't tried with the command line yet as you suggested because I'm not quite set up for that, but shouldn't it work with visual studio?

0 Kudos
mecej4
Honored Contributor III
736 Views
There may be a problem with your installation of Visual Studio or Intel Fortran. All that I had to do was to create a new Fortran console solution with the default options, to which I added these options:

Project=>Properties=>Fortran=>Libraries=>Use Intel MKL {make your selection}
Project=>Properties=>Linker=> Additional Dependencies mkl_lapack95.lib

and my example ran fine with IFort 12.1 and VS2010.

> I haven't tried with the command line yet as you suggested because I'm not quite set up for that,..

There is no set up required. Every installation of Intel Fortran gives you links in the Start Menu to one or more properly configured command windows.
0 Kudos
nvaneck
New Contributor I
736 Views
Thanks a million!

I got it to work. Now I can work it into my programs...


NEal
0 Kudos
nvaneck
New Contributor I
736 Views
Unfortunately, while I can get it to work in it's own project, when I try it in my real project I still get

"Generic procedure reference has two or more specific procedure with the same type/rank/keyword signature. [SPEVD]"

there a way to track this down? A way to resolve it? Why would it think there are 2 routines witht he same name. Would it work better to use the Fortran 77 version? The test routine in the larger project is:

subroutine test
use lapack95

integer, parameter :: N=4

real, dimension(N*(N+1)/2) :: Ap= (/-4., 2.,-6.,0.5,2.,-8.,0.,0.3,2.,-10./),w(N)

call spevd(Ap,w)

write(*,10)(i,w(i),i=1,N)

10 format(1x,I3,2x,F10.5)
end

0 Kudos
mecej4
Honored Contributor III
736 Views
The subroutine by itself gets compiled with no error. The problem lies, then, in the part of the source code that you have not shown.

Given that the compiler is telling you that there are conflicting subroutines, in your code, switching to F77 would be pointless: it would shift the detection of the bug from compile time to run time.
0 Kudos
nvaneck
New Contributor I
736 Views

Well, sure, but I don't have any other reference to spevd, and I've added all other unique use statements used eleswhere to the standalone project with no problems, so is it a library conflict?

0 Kudos
mecej4
Honored Contributor III
736 Views
> is it a library conflict?

Cannot say, without seeing the whole source code. The message from the compiler indicates that it is a usage conflict, not a library conflict.
0 Kudos
Andrew_Smith
Valued Contributor I
736 Views
Do you still have an include 'LAPACK.F90' in some place in your project? Try removing it.
0 Kudos
nvaneck
New Contributor I
736 Views
I removed everything from the main project except the test routine--got same problem. So I compared the properties of the cut-down main project with the one that works, side-by-side and made all properties match the one that works.

I still got the same error message.

I cleaned the original main project, rebuilt it and it cleared the problem!

I think something got left around from my first abortive attempts...

0 Kudos
Reply