linking with LAPACK95 in Visual Studio

linking with LAPACK95 in Visual Studio

Apologies for coming here with what is obviously a beginners problem, but I cant seem to get a matrix inversion routine from LAPACK to compile in an existing fortran program. I am programming in Visual Studio 2005, with the Intel Visual Fortran Compiler 11.0.072 (professional edition) that includes the MKL for IA32 platforms.

I have followed these steps from the MKL Users Manual:
1) I have compiled BLAS95 and LAPACK95 library and module files successfully
2) In Configuration Properties > Fortran > General > Additional Include Directories, I have added "\include" (in quotation marks)
3) In Configuration Properties > Linker > General > Additional Library Directories, I have added "\ia32\lib"
4) In Configuration Properties > Linker > Input > Additional Dependencies, I have added mkl_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5mt.lib

When I then try to compile the program with a call to the LAPACK95 routine GETRF, for example, the subroutine is not recognised.

The code does, however, seem to work perfectly with calls to LAPACK - it's just the Fortran 95 calls that I am having problems with.

Can anyone let me know what I need to add / change?

Many thanks

Justin.

13 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Quoting - jvandeven
When I then try to compile the program with a call to the LAPACK95 routine GETRF, for example, the subroutine is not recognised.

what do you mean specifically by that? (no corresponding routine/interface would suggest errors in calling statement) what is the error message? It's compilation or linking?

A.

Hi Justin,

Besides mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib, please add lapack95 interface library :
mkl_blas95.lib, mkl_lapack95.lib
also in your project if you'd like to use fortran 95 interface GETRF.

Here is a FAQ for your reference
http://software.intel.com/en-us/articles/blas-and-lapack-fortran95-mod-f...

As you are using fortran 11.0.072 , the MKL is 10.1, so you may need build the mkl_lapack95.lib manually.
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/,

Please follow the steps in MKL user guide to build the interface library.
(and there isIntel fortran Projectsample at the end of the article, it have one ready mkl_lapack95.lib. You can try it. ).

Best Regards,
Ying

Quoting - Ying Hu (Intel)

Hi Justin,

Besides mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib, please add lapack95 interface library :
mkl_blas95.lib, mkl_lapack95.lib
also in your project if you'd like to use fortran 95 interface GETRF.

Here is a FAQ for your reference
http://software.intel.com/en-us/articles/blas-and-lapack-fortran95-mod-f...

As you are using fortran 11.0.072 , the MKL is 10.1, so you may need build the mkl_lapack95.lib manually.
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/,

Please follow the steps in MKL user guide to build the interface library.
(and there isIntel fortran Projectsample at the end of the article, it have one ready mkl_lapack95.lib. You can try it. ).

Best Regards,
Ying

Hi Ying,

Thanks for your message. What has confused me is that I have done what you suggest above (build the library and module files, and include the library files as additional dependencies) with no luck. I still end up with a compilation error like:

Error 4 error LNK2019: unresolved external symbol _POTRF referenced in function _TESTER_mp_TEST 1a_tester.obj

when I try to reference a fortran95 command. I have just recompiled the library codes, and the error remains.

Thanks again for your help,

Justin.

Quoting - jvandeven

Error 4 error LNK2019: unresolved external symbol _POTRF referenced in function _TESTER_mp_TEST 1a_tester.obj

It seems that the library dependency for your lapack95 libraries is missing (assuming the library actually got built). You already got the advice about including the dependency libraries; perhaps the entire path isn't right. If you could turn on the ifort -# option in you link step, the log would show more detail about which libraries are searched.

Quoting - tim18

It seems that the library dependency for your lapack95 libraries is missing (assuming the library actually got built). You already got the advice about including the dependency libraries; perhaps the entire path isn't right. If you could turn on the ifort -# option in you link step, the log would show more detail about which libraries are searched.

Tim,

The library file mkl_lapack95.lib and mkl_blas95.lib are in the library directory, so I hope that they have been built properly. I have been working through the Visual Studio environment, and am unfamiliar with the ifort compiler from the command line (or indeed any other way of compiling my code). Is there an alternative way of producing the log that you refer to here?

Justin.

I'm not familar with the combination, but you should be able to set -# or /# in the additional options menu, which should cause the additional information to appear in the normal build log you should get under Visual Studio.

Quoting - tim18
I'm not familar with the combination, but you should be able to set -# or /# in the additional options menu, which should cause the additional information to appear in the normal build log you should get under Visual Studio.

Tim,

as far as I know the -# or /# won't work in VS. If you meant linker activity (searched libs and referenced functions) I think the /VERBOSE command (with options) does this. In VS it can be set also via Properties->Linker->General->Show progress.

A.

Quoting - ArturGuzik

Tim,

as far as I know the -# or /# won't work in VS. If you meant linker activity (searched libs and referenced functions) I think the /VERBOSE command (with options) does this. In VS it can be set also via Properties->Linker->General->Show progress.

A.

Hi Justin,

Can you attach your build log here? Seeing from the error message, as Tim and A. hinted, the mkl_lapack95.libis still not be linked in your project.

I had attach one MSVC 2005 project at that article, have you try it?

Regards,
Ying

Hi Ying,

Apologies for the delay, I find myself in and out of the office these days. Please find the build log file attached. The build seems to be finding mkl_lapack95.lib and mkl_blas95.lib, but is not finding a call to potrf in these.

Justin.

Quoting - Ying Hu (Intel)

Hi Justin,

Can you attach your build log here? Seeing from the error message, as Tim and A. hinted, the mkl_lapack95.libis still not be linked in your project.

I had attach one MSVC 2005 project at that article, have you try it?

Regards,
Ying

Quoting - jvandeven

Hi,

I might be wrong but... do you have USE statement in the routine TEST (inside module TESTER)?

something like: USE mkl95_LAPACK, ONLY: POTRF

Log shows the linker can't recognized the routine (unresolved external symbol) which performs Cholesky factorization.
The library is actually found as:

1> Found _DPOTRF
1> Referenced in 1a_tester.obj
1> Loaded mkl_intel_c.lib(_dpotrf.obj)

A.

Best Reply

Quoting - jvandeven

Hi Justin,

Arthur should be right, you may miss the "use statement" in your _TESTER_mp_TEST routine.

The code is like

PROGRAM TESTER_mp_TEST

! .. "Use Statements" ..
USE mkl95_LAPACK, ONLY: POTRF
! .. "Implicit Statement" ..
IMPLICIT NONE

DOUBLE PRECISION A(5,5)

! .. "Executable Statements" ..
CALL POTRF( )

Please notes: Please precompile the mkl95_lapack.modand put itin your INCLUDE PATH or project current directoryas that attachedtest project.

Regards,
Ying

Dear all - many thanks, last post from Ying sorted the problem out!

Best,

Justin.

Leave a Comment

Please sign in to add a comment. Not a member? Join today