Using mkl with linux

Using mkl with linux

When i write ifort -mkl -c  %fname% there's an error:

/tmp/ifortkyko2F.o: In function `MAIN__':
%fname%:(.text+0x1233): undefined reference to `sygst_'

mkl is installed and i used mklvars 

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
mecej4's picture

You did not show any code, so this is a guess: you probably forgot to add USE MKL95_LAPACK in the subprogram/main program from which sygst() is called, and did not tell the linker to search the appropriate Lapack95 library (depends on target architecture; see the MKL Link Line Adviser).

Quote:

mecej4 wrote:

you probably forgot to add USE MKL95_LAPACK

and did not tell the linker to search the appropriate Lapack95 library (depends on target architecture; see the MKL Link Line Adviser).

i didn't know about use, ty

MKL Link Line Adviser offers me use this:

 $(MKLROOT)/lib/ia32/libmkl_lapack95.a -Wl,--start-group  $(MKLROOT)/lib/ia32/libmkl_intel.a $(MKLROOT)/lib/ia32/libmkl_sequential.a $(MKLROOT)/lib/ia32/libmkl_core.a -Wl,--end-group -lpthread -lm

and i don't know how to use it( what should i run in terminal? sorry, i'm new in fortran and linux

mecej4's picture

The USE MKL95_LAPACK statement is needed because the generic subroutine name SYGST is called from your code, and the subroutine has optional arguments. The information in the module USEd is needed by the compiler to select the specific subroutine and to pass the arguments properly.

From a console window, with the Intel compiler and MKL environment properly set, you use the command

     $ ifort <myprog.f90> <list of libraries given by link-line-adviser>

 Note the blank space between the command and the first argument (the source file name) and another between the latter and the list of libraries.

i've tried 

ifort curs1.f90 /opt/intel/composer_xe_2013.2.146/mkl/lib/ia32/libmkl_lapack95.a -Wl,--start-group /opt/intel/composer_xe_2013.2.146/mkl/lib/ia32/libmkl_intel.a /opt/intel/composer_xe_2013.2.146/mkl/lib/ia32/libmkl_sequential.a /opt/intel/composer_xe_2013.2.146/mkl/lib/ia32/libmkl_core.a -Wl,--end-group -lpthread -lm

with USE MKL95_LAPACK and got 

error #7002: Error in opening the compiled module file. Check INCLUDE paths. [MKL95_LAPACK]
USE MKL95_LAPACK
----^
compilation aborted for curs1.f90 (code 1)

and then 

ifort curs1.f90 -I /opt/intel/composer_xe_2013.2.146/mkl/include/ia32

with USE MKL95_LAPACK and got

/tmp/ifortNJbKDO.o: In function `MAIN__':
curs1.f90:(.text+0x270d): undefined reference to `dsygst_mkl95_'

mecej4's picture

Your first command line did not work because the -I option was not given; the second failed since you did not specify the MKL libraries. Both are needed for the compilation and linking to succeed. We do not know which version of IFort and which version of MKL you have.

Try the following two alternatives:

     1, To your first command line, add the -mkl option.

     2, To your second command line, add the list of libraries given by the MKL link adviser.

the first alternative is working! thank you!

Login to leave a comment.