Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

LAPACK compilation

Stephen_Sutcliffe
New Contributor II
234 Views

I am trying to compile source code utilising the Intel Math Kernel Library Version 11.3 and the latest Parallel Studio V16.0. When I add the following statement:

include 'lapack.f90'

in the variable declaration section of the file and try to compile the file I get the following error messages:

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016\windows\mkl\include\lapack.f90(31): error #6617: The END statement for a CONTAINed procedure is missing.
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016\windows\mkl\include\lapack.f90(31): error #6702: END statement confusion.
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016\windows\mkl\include\lapack.f90(39): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [F95_PRECISION]
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016\windows\mkl\include\lapack.f90(41): error #6683: A kind type parameter must be a compile-time constant.   [WP]
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016\windows\mkl\include\lapack.f90(39): error #6581: Unresolved rename.   [WP]
C

etc 

What am I doing wrong?

0 Kudos
6 Replies
Kevin_D_Intel
Employee
234 Views

This MKL file defines some modules so you insert it outside any existing subprogram scope. Something like the following works.

include 'lapack.f90'

program test
end

 

Stephen_Sutcliffe
New Contributor II
234 Views

Ah I see, thanks Kevin.

It works fine now.

Kevin_D_Intel
Employee
234 Views

You're welcome. Glad to hear it works.

Stephen_Sutcliffe
New Contributor II
234 Views

Kevin, I spoke too soon. I've managed to compile the source but the program fails to link. I've set the library properties to Sequential (/Qmkl:sequential) in the IDE but I'm still getting  error LNK2019: unresolved external symbol SGESVX_F95 referenced in function MKL_SOLVELU. The source file I added to my main project is listed below. It is based on the MKL example driver routine gesvxab. I've tried it with and without the include 'lapack.f90' statement but neither option will link. Have I missed something else?

! Math Kernel Files
include 'lapack.f90'

subroutine MKL_SolveLU(n,LU,B,X,ier)

!**********************************************************************
! Solve LU.X = B
!**********************************************************************

USE f95_precision, ONLY: WP => SP
USE lapack95, ONLY: GESVX

implicit none

! Arguments
integer,intent(in)  :: n
real(8),intent(in)  :: LU(n,n)
real(8),intent(in)  :: B(n)
real(8),intent(out) :: X(n)
integer,intent(out) :: ier

! Local Variables
real(WP),allocatable :: mLU(:,:)
real(WP),allocatable :: mB(:,:)
real(WP),allocatable :: mX(:,:)

allocate(mLU(n,n),mB(n,1),mX(n,1),stat=ier)
if(ier.eq.0) then
  
  mLU = LU
  mB(1:n,1) = B
  
  call GESVX(mLU,mB,mX,info=ier)
  if(ier.eq.0) then
    X = mX(1:n,1)
  endif
  
  deallocate(mLU,mB,mX)
  
endif

return
end subroutine

The build log file confirms that the mkl libraries have been included. (extract below)

 /OUT:"x64\ExpDbg\FEM2000_x64.exe" /VERSION:2.4 /INCREMENTAL /NOLOGO /LIBPATH:"C:\Program Files (x86)\VNI\imsl\fnl600\Intel64\lib" /LIBPATH:"x64\ExpDbg" /LIBPATH:"C:\Win\MgnLib\x64\Debug" /LIBPATH:"C:\Win\NASTRANXDB\IVF64" /LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Lib\x64" /NODEFAULTLIB:"libc.lib" /NODEFAULTLIB:"libcd.lib" /MANIFEST:NO /DEBUG /PDB:"C:\Win\FEM2000-XE\x64\ExpDbg\FEM2000_x64_IVFdbg.pdb" /SUBSYSTEM:WINDOWS /STACK:8000000 /LARGEADDRESSAWARE kernel32.lib user32.lib gdi32.lib iphlpapi.lib uxtheme.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib geomconv.lib f90gl.lib f90glu.lib glut32.lib MgnLib.lib libdbio_irc_x64.lib HtmlHelp.lib JPeg\x64\ExpDbg\JPeg_lib.lib Windows\x64\ExpDbg\Windows_lib.lib "Third Party"\x64\ExpDbg\"Third Party_lib.lib" -qnoipo /qoffload-ldopts="-mkl=sequential"
]
mecej4
Black Belt
234 Views

You have to specify that the Lapack95 (and BLAS95) libraries should be used at link time, since these libraries are not linked in by default, even if the /Qmkl compiler option has been specified. You may wish to use the MKL Link Line Advisor, https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ , for help with this. The four libraries in question, for 64-bit compiles, are

    mkl_blas95_lp64.lib, mkl_blas95_ilp64.lib

    mkl_lapack95_lp64.lib, mkl_lapack95_ilp64.lib  

Choose the ...ILP64 libraries if integer arguments to MKL routines are 8-byte integers, otherwise choose the ...LP64 libraries.

andrew_4619
Honored Contributor II
234 Views

You would think the module lapack95 should have an objcomment to pull in the required libs??

Reply