Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6984 ディスカッション

linking mkl under linux with fortran 95 blas interface

beeboom
ビギナー
359件の閲覧回数

Hi everyone,

I am trying to compile test fortran program using blas with fortran 95 interface.

$ cat mkl_test.f90
program dot_main
use mkl95_blas
use mkl95_precision
real x(10), y(10), res
integer i
do i = 1, 10
x(i) = 2.0e0
y(i) = 1.0e0
end do
res = dot(x,y)
print*, 'SDOT = ', res
end

However, I do not succeed and this is the error message I get:

$ ifort mkl_test.f90 -I$FPATH -L$LIBRARY_PATH -L$LD_LIBRARY_PATH -Wl,--start-group /opt/intel/mkl/10.2.3.029/lib/32/libmkl_blas95.a /opt/intel/mkl/10.2.3.029/lib/32/libmkl_intel_thread.a /opt/intel/mkl/10.2.3.029/lib/32/libmkl_core.a -Wl,--end-group -lguide -lpthread
/opt/intel/mkl/10.2.3.029/lib/32/libmkl_blas95.a(sdot.o): In function `sdot_f95_':
../../../../interfaces/blas95/source/sdot.f90:(.text+0x141): undefined reference to `sdot_'

There is similiar thread at this forum where the problem was solved by specifying -lmkl option at compiling. But according to http://software.intel.com/en-us/articles/performance-tools-for-software-developers-for-easily-migrating-from-mkl-9x-to-10x/ and http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-for-linux-linking-applications-with-intel-mkl-version-100/ since 10th version of mkl libmkl.so was replaced by other libraries. Does somebody know what are the proper options to build this code now?

Thanks!

0 件の賞賛
2 返答(返信)
Todd_R_Intel
従業員
359件の閲覧回数

You have...

  • the Fortran 95 interface: libmkl_blas95.a
  • the threading layer: libmkl_intel_thread.a
  • and the core functionality: libmkl_core.a

But I don't see the interface layer: libmkl_intel.a

-Todd

Link Line Advisor.

beeboom
ビギナー
359件の閲覧回数

Thanks a lot, I found the solution by examining the makefile given in examples subdirectory.

The proper line should look as follows:

export LD_LIBRARY_PATH="/opt/intel/Compiler/11.1/064/mkl/lib/32":"/opt/intel/Compiler/11.1/064/lib/ia32:/opt/intel/Compiler/11.1/064/mkl/lib/32:/opt/intel/mkl/10.2.3.029/lib/32":"/usr/lib"; ifort -xK -I /opt/intel/Compiler/11.1/064/mkl/include/32 -w mkl_test.f90 /opt/intel/Compiler/11.1/064/mkl/lib/32/libmkl_blas95.a "/opt/intel/Compiler/11.1/064/mkl/lib/32"/libmkl_intel.a -Wl,--start-group "/opt/intel/Compiler/11.1/064/mkl/lib/32"/libmkl_intel_thread.a "/opt/intel/Compiler/11.1/064/mkl/lib/32"/libmkl_core.a -Wl,--end-group -L"/opt/intel/Compiler/11.1/064/mkl/lib/32" -liomp5 -lpthread

返信