Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Link MKL Library

mohanmuthu
New Contributor I
1,279 Views

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.

0 Kudos
1 Solution
mecej4
Honored Contributor III
1,279 Views
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.

View solution in original post

0 Kudos
5 Replies
TimP
Honored Contributor III
1,279 Views
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.
0 Kudos
mohanmuthu
New Contributor I
1,279 Views
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
0 Kudos
mecej4
Honored Contributor III
1,280 Views
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.
0 Kudos
mohanmuthu
New Contributor I
1,279 Views
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
0 Kudos
mecej4
Honored Contributor III
1,279 Views
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: [fortran]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 [/fortran] [bash]ifort /MD /Qmkl gemx.f90 mkl_blas95.lib[/bash]
0 Kudos
Reply