Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Frank_M
Beginner
125 Views

Using BLAS & LAPACK

Jump to solution
When using BLAS & LAPACK, with MKL and fortran 11.1.070
Windows XP Professional 32

I get:

Error3 error LNK2005: _F95_PRECISION. already defined in FLIB.lib(GET_SARMA.obj)C:\\Documents and Settings\\fm\\My Documents\\Visual Studio 2008\\Projects\\TSEx\\TSEx\\FLIB.lib(POLYMULT.obj)

when

INCLUDE 'blas.f90'
INCLUDE 'lapack.f90'

are in the same project.

What do I need to config/declare to get BLAS & LAPACK to work together in the same project without stumbling over _F95_PRECISION?



0 Kudos
1 Solution
barragan_villanueva_
Valued Contributor I
125 Views
Quoting Frank_M
The libs mkl95_lapack and mkl95_blas live in C:\Program Files\Intel\Compiler\11.1\070\mkl\include\ia32
and are pre compiled.

I don't know how to link the above mkl libs without using the INCLUDE statement. If I delete or comment out the INCLUDE statement -> no link. Could you point me at an example or article showing how do such a thing?


Yes, you can use precompiled mod-files and add the following option for compiler
in case of LP64
-I$(MKL_INC)/intel64/lp64
in case of ILP64 (then use ilp64 version of MKL librariesbelow)
-I$(MKL_INC)/intel64/ilp64

Also it needs to link with the following additional (for recommended byMKL Link Line Advisor) MKL libraries:
in case of MKL Dynamic libs for LP64
-lmkl_blas95_lp64 -lmkl_lapack95_lp64
in case of MKL Static libs for LP64
-lmkl_blas95_lp64 -lmkl_lapack95_lp64

N.B.
MKL_INC = $(MKLROOT)/include
MKLPATH = $(MKLROOT)/lib/ia32

View solution in original post

5 Replies
barragan_villanueva_
Valued Contributor I
125 Views
Well, this is incorrect using of Fortran UNCLUDEs of BLAS and LAPACK in current MKL.
Please compile these files separeltly and add
use blas95
use lapack95
statements in your file
Frank_M
Beginner
125 Views
First: Thank You

Second: More info.

The statements

USE mkl95_lapack, ONLY: HSEQR

USE mkl95_blas, ONLY: GEMV

are the first statements following the SUBROUTINE statement.

The libs mkl95_lapack and mkl95_blas live in C:\Program Files\Intel\Compiler\11.1\070\mkl\include\ia32
and are pre compiled.

I don't know how to link the above mkl libs without using the INCLUDE statement. If I delete or comment out the INCLUDE statement -> no link. Could you point me at an example or article showing how do such a thing?
mecej4
Black Belt
125 Views
Your description shows that you have some misunderstandings about include files, modules and libraries. These entities are related but not identical.

Using an INCLUDE statement does not, by itself, cause any library to be be included at link time. An INCLUDE statement causes the contents of the INCLUDEd file to be inserted at that point. The included text can be Fortran code, comments, or directives. The source code, after INCLUDE statements have been acted upon, must be valid Fortran source code.

USE statements cause the compiler to read .mod files to obtain information about module data and argument type information that is not available otherwise but is necessary for correctly compiling the source code.

Unless the source code (after the INCLUDEd text is inserted) contains appropriate OBJCOMMENT directives, you will need to specify the MKL libraries to be linked in using compiler options or using the linker options that the MKL Link Line Advisor provides you.
barragan_villanueva_
Valued Contributor I
126 Views
Quoting Frank_M
The libs mkl95_lapack and mkl95_blas live in C:\Program Files\Intel\Compiler\11.1\070\mkl\include\ia32
and are pre compiled.

I don't know how to link the above mkl libs without using the INCLUDE statement. If I delete or comment out the INCLUDE statement -> no link. Could you point me at an example or article showing how do such a thing?


Yes, you can use precompiled mod-files and add the following option for compiler
in case of LP64
-I$(MKL_INC)/intel64/lp64
in case of ILP64 (then use ilp64 version of MKL librariesbelow)
-I$(MKL_INC)/intel64/ilp64

Also it needs to link with the following additional (for recommended byMKL Link Line Advisor) MKL libraries:
in case of MKL Dynamic libs for LP64
-lmkl_blas95_lp64 -lmkl_lapack95_lp64
in case of MKL Static libs for LP64
-lmkl_blas95_lp64 -lmkl_lapack95_lp64

N.B.
MKL_INC = $(MKLROOT)/include
MKLPATH = $(MKLROOT)/lib/ia32

View solution in original post

Frank_M
Beginner
125 Views
Thanks, that got it.
Reply