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

Lapack function in MKL is not seen by compiler

nestoklon
Beginner
830 Views
I have a strange compilation error. In the function inside module the line
abstol = dlamch('S')
gives an error
error #6404: This name does not have a type, and must have an explicit type. [DLAMCH]
while in the same file
call zhpevx(...)
works as expected.
0 Kudos
1 Solution
mecej4
Honored Contributor III
830 Views
Two comments, about pulling in type and argument list declarations for functions and subroutines such as dlamch:

1. If your code calls only the F77 interface names, adding USE lapack95 will have no effect.

2. The MKL include files such as mkl_lapack.fi are in fixed format, so that they can be included in old fixed-format code. Simply adding an INCLUDE for such a file will cause compilation errors with a free-format source file, because of the mismatch. The fix is to do

[fortran]!DEC$ NOFREEFORM
include 'mkl_lapack.fi'
!DEC$ FREEFORM
[/fortran]

View solution in original post

0 Kudos
5 Replies
Gennady_F_Intel
Moderator
830 Views
i cannot see the problem on my side. I checked how it works on my win7 system with the latest 10.3.8 installed with the code below

program test

implicit none

double precision abstol, dlamch

abstol = dlamch('S')

print*,' dlamach example program'

end

here is the librairies i linked:mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

here is the outputC:\Forum_MKL\102985>_test.exe

dlamach example program

here is comiler version:

ifort --version

Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.1.1.258 Build 20111011

0 Kudos
TimP
Honored Contributor III
830 Views
As the MKL documentation implies, which you can open up via the Windows Start menu:
INCLUDE 'mkl_lapack.fi'
would supply the necessary declaration.
If you look at that file, you will see that it supplies Fortran 90 interface blocks, to enable the compiler to check your lapack calls, which is at variance with the comment about Fortran 77 in the documentation. Maybe it should have said "compatible with free and fixed format."
Another nit: If I double click on that file name in Windows explorer, it starts to bring up VS2010, but that dies. Maybe it's necessary to change the default file associations for .fi.

I suppose
USE lapack95
also might do the job. Unlike past ifort versions, I don't find the source code for lapack95, only the compiled .mod file.

Default INCLUDE path for recent ifort versions includes the .fi files but not the USE (.mod) files. For the latter, you must add the relevant one (32-bit, or, for 64-bit, lp64 or ilp64).
0 Kudos
nestoklon
Beginner
830 Views
Thank you for the hint.
USE lapack95
does not help though it seems that compiler is able to find the module.
INCLUDE 'mkl_lapack.fi'
produces errors:
mkl_lapack.fi(36): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: *
Could you help me to find where this is explained in documentation?
0 Kudos
nestoklon
Beginner
830 Views
I was sure that explicit definition of extrnal functions is something from fortran 77 and should be avoided in fortran 90. Thank you for the working code.

Compilation is just with /Qmkl (or -mkl at linux) switch.
Intel Visual Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.2.278 Build 20111128
0 Kudos
mecej4
Honored Contributor III
831 Views
Two comments, about pulling in type and argument list declarations for functions and subroutines such as dlamch:

1. If your code calls only the F77 interface names, adding USE lapack95 will have no effect.

2. The MKL include files such as mkl_lapack.fi are in fixed format, so that they can be included in old fixed-format code. Simply adding an INCLUDE for such a file will cause compilation errors with a free-format source file, because of the mismatch. The fix is to do

[fortran]!DEC$ NOFREEFORM
include 'mkl_lapack.fi'
!DEC$ FREEFORM
[/fortran]

0 Kudos
Reply