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

MKL Matrix multiplication: undefined reference to `mkl_blas_dgemv'

bsukhwani
Beginner
1,238 Views
Hi,

I am trying to link to the MKL library (over a network). I can get MKL FFT to work but while calling a BLAS routine (Matrix Multiplication),
I get the following compile time error:

/mkl/lib/em64t/libmkl_core.a(_def_xdgemm.o): In function `mkl_blas_def_xdgemm':
__tmp_xdgemm.c:(.text+0xb27): undefined reference to `mkl_blas_dgemv'

I am using the example code that came with the MKL. The function call that leads to this error is 'cblas_dgemm'

I am compiling using the following command:

icc -o MatrixMul_MKL cblas_dgemmx.c -L$MKLPATH -I$MKLINCLUDE -W1, --start-group $MKLROOT/lib/em64t/libmkl_intel_lp64.a $MKLROOT/lib/em64t/libmkl_sequential.a $MKLROOT/lib/em64t/libmkl_core.a -W1, --end-group -lpthread

Any help would be greatly appreciated.

-Bharat
0 Kudos
4 Replies
TimP
Honored Contributor III
1,238 Views
Quoting - bsukhwani

icc -o MatrixMul_MKL cblas_dgemmx.c -L$MKLPATH -I$MKLINCLUDE -W1, --start-group $MKLROOT/lib/em64t/libmkl_intel_lp64.a $MKLROOT/lib/em64t/libmkl_sequential.a $MKLROOT/lib/em64t/libmkl_core.a -W1, --end-group -lpthread

You have mis-spelled the -Wl directives.
0 Kudos
bsukhwani
Beginner
1,238 Views
Quoting - tim18
You have mis-spelled the -Wl directives.
Hi Tim,

Thanks for the reply but that did not fix it. Still the same error.

-Bharat
0 Kudos
Gennady_F_Intel
Moderator
1,238 Views
Quoting - bsukhwani
Quoting - tim18
You have mis-spelled the -Wl directives.
Hi Tim,

Thanks for the reply but that did not fix it. Still the same error.

-Bharat

then please check your if $MKLROOT provides the proper path to the MKL,
or
please try to build this example by using makefile
see $MKLROOT/examples/cblas/
examples of using:
make lib64 function=cblas_dgemmx+

--Gennady
0 Kudos
bsukhwani
Beginner
1,238 Views

then please check your if $MKLROOT provides the proper path to the MKL,
or
please try to build this example by using makefile
see $MKLROOT/examples/cblas/
examples of using:
make lib64 function=cblas_dgemmx+

--Gennady

Great! Thanks!!

The $MKLROOT was already providing the proper path to the MKL. Using the makefile did the trick. Now it compiles fine.

This is what I used to make:
make libem64t function=cblas_dgemm

Thanks again,
Bharat
0 Kudos
Reply