Link MKL Library

Link MKL Library

Hello,

I am trying to use the MKL library function GEMM in my code by adding the line INCLUDE "mkl.fi" and compliling with option /Qmkl in commandline. I am getting the error LNK2019: unresolved external symbol _GEMM. Am I missing anything? However, I tried to use VSCBRT function with appropriate include file, and it works. Please help.

6 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

For lapack95 support, you need
use lapack95
to accomplish the substitutions of specific MKL functions for generic ones such as gemm. I suppose this might conflict with mkl.fi, but the latter would not handle the lapack95 calls.

I tried to replace "mkl.fi" with "blas.f90", but it throws many errors since blas.f90 is the collection of interfaces alone. I use the command line of IA-32, Version 12.1.5.344 [Visual Studio 2005].

?gemm page of MKL user manual says:
Include Files:
Fortran : mkl.fi
Fortran 95 : blas.f90

Best Reply

You have to follow the prescribed way of telling the compiler and linker that your code uses BLAS95 routines such as DGEMM. See the example driver dgemx.f90 in the .../mkl/examples/blas95/source directory.

To call DGEMM using the F9x interface, you need "USE mkl95_blas" before the declarations section of your program, and link to mkl_blas95.lib.

Thanks mecej4. I tried it and found working with sgemm, not GEMM alone as indicated in manual. However, while running, I get error:

forrtl: severe (157): Program Exception - access violation.

Not sure what I miss.

test.f90************
PROGRAM test

use mkl95_blas

real*4 :: a(10,10),b(10,10),c(10,10)

a=1.0
b=1.0

call sgemm(a,b,c)

END PROGRAM test

The access violation was a result of your "fixing" something that was not broken. You called the F77 SGEMM routine with an incorrect argument list.

Try this:

PROGRAM test

use mkl95_blas

real*4 :: a(5,3),b(3,4),c(5,4)
a=1.0

b=2.0
call gemm(a,b,c)
write(*,10)(c(i,:),i=1,5)

10 format(1x,4ES12.4)
END PROGRAM test

ifort /MD /Qmkl gemx.f90 mkl_blas95.lib

Connectez-vous pour laisser un commentaire.