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

Compiling a program using a LAPACK95 subroutine

curro_p__b_
Beginner
1,284 Views

I have some experience programming Fortran + lapack 95 with a gfortran compiler and I am trying now the intel fortran compiler. I am completely new to this compiler so I hope this is not a completely naive question.

I worked in GNU/Linux (Debian Jessie) and installed  parallel_studio_xe_2016_update1 and then, as the libraries are not included, I installed l_mkl_11.3.0.109 too. Both instalations were flawless and quite smooth. The compiler seems to be running as I have been able to compile some simple programs that do not make any use of libraries. However I cannot neither compile nor link using LAPACK95. I have a program that compiles and run correctly with gfortran and uses the diagonalization subroutine LA_SYEVR. The main program source code starts as follows.

PROGRAM vibron_eigensystem_u3
  !    
  USE nrtype
  !
  USE vibron_u4
  !
  ! Lapack 95
  !USE LA_PRECISION, ONLY: WP => DP
  !USE F95_LAPACK, ONLY: LA_SYEVR
  USE F95_PRECISION, ONLY: WP => DP
  USE LAPACK95, ONLY: LA_SYEVR

At the beginning there was an error stating "Check INCLUDE paths". It was due to the different names of the modules (commented lines in the code). I thought that this was standard, but anyhow I changed the program. If I try to compile my program using the commandline provided by the Intel link line advisor

$ ifort -c vibron_model_eigensystem_U3_ifort.f90 nrtype.f90 defparam_vibron.f90  -I${MKLROOT}/include/intel64/lp64 -I${MKLROOT}/include

the error output is as follows

vibron_model_eigensystem_U3_ifort.f90(16): error #6580: Name in only-list does not exist.   [LA_SYEVR]
  USE LAPACK95, ONLY: LA_SYEVR
----------------------^
vibron_model_eigensystem_U3_ifort.f90(133): error #6632: Keyword arguments are invalid without an explicit interface.  
     CALL SYEVR(A=Ham_U4_mat, W=eigenval_vec, JOBZ='N', UPLO='U', IL=1, IU=1)
----------------^
etc.


I may be doing something incredibly wrong, but LA_SYEVR is the name of the Lapack95 subroutine and it seems it is not found in the include files.

Is there any place where I could get some info about this. I have been looking around and I didn't find any clue.

Regards,

Curro

0 Kudos
1 Solution
mecej4
Honored Contributor III
1,284 Views

To find the correct names as used in MKL Lapack95, please consult the MKL documentation. The name to be used in your example is simply SYEVR, as you can see at https://software.intel.com/en-us/node/469188 . Secondly, when you use the MKL link line advisor be sure to check the "use Lapack95" box. It will give you one or two library names that contain "95" which should be specified at the link stage.

View solution in original post

0 Kudos
7 Replies
mecej4
Honored Contributor III
1,285 Views

To find the correct names as used in MKL Lapack95, please consult the MKL documentation. The name to be used in your example is simply SYEVR, as you can see at https://software.intel.com/en-us/node/469188 . Secondly, when you use the MKL link line advisor be sure to check the "use Lapack95" box. It will give you one or two library names that contain "95" which should be specified at the link stage.

0 Kudos
curro_p__b_
Beginner
1,284 Views

Thanks for your quick answer and for the link to the LAPACK documentation. Probably because of the different format to what I am used and the tons of documentation I find quite difficult to find my place into the intel space.

I have tried what you suggested before, and now the error is different:

$ ifort -c vibron_model_eigensystem_U3_ifort.f90 nrtype.f90 defparam_vibron.f90 -I${MKLROOT}/include/intel64/lp64 -I${MKLROOT}/include

vibron_model_eigensystem_U3_ifort.f90(133): error #6285: There is no matching specific subroutine for this generic subroutine call.   [SYEVR]
     CALL SYEVR(A=Ham_U4_mat, W=eigenval_vec, JOBZ='N', UPLO='U', IL=1, IU=1)
----------^
vibron_model_eigensystem_U3_ifort.f90(241): error #6285: There is no matching specific subroutine for this generic subroutine call.   [SYEVR]
        CALL SYEVR(A=Ham_U4_mat, W=eigenval_vec, JOBZ='V', UPLO='U')
-------------^
vibron_model_eigensystem_U3_ifort.f90(243): error #6285: There is no matching specific subroutine for this generic subroutine call.   [SYEVR]
        CALL SYEVR(A=Ham_U4_mat, W=eigenval_vec, JOBZ='N', UPLO='U')
-------------^
compilation aborted for vibron_model_eigensystem_U3_ifort.f90 (code 1)

It seems that the SYEVR subroutine is not recognized, though the error output is much less verbose than in the previous message. I am also somewhat surprised because I thought that LAPACK95 has a standard way of naming its subroutines, as defined in the LAPACK95 user's guide

Thanks again for your help,

Curro

 

0 Kudos
mecej4
Honored Contributor III
1,284 Views

More precise help could be given if you showed the declarations of the arguments that you pass to syevr.

The message is not saying that SYEVR is an unknown routine, but that from the pattern of arguments given no specific subroutine that matches those could be found.

Note that in the Lapack95 call there is no JobZ argument. Indeed, such an argument would be redundant because the convention is that when an optional output argument is present the user wants relevant results returned in that argument.

0 Kudos
Gennady_F_Intel
Moderator
1,284 Views

you may also have a look into MKL's example "mklroot_dir\examples\lapack95\source\syevr.f90" to see how to  prepare and pass all needed parameters to this routine. it may help.

0 Kudos
curro_p__b_
Beginner
1,284 Views

Thanks a lot for your comments and replies. I, maybe naively, thought that FORTRAN 95 interfaces to LAPACK from MKL and Netlib were completely compatible. As it is explained in this link: https://software.intel.com/en-us/node/468670, that I have found following your indications there are several changes and I would have to create a different version of the programs I already have ready for gfortran + netlib.

These are the arguments that I passed to the subroutine:

! Example of subroutine call

     CALL SYEVR(A=Ham_U4_mat, W=eigenval_vec, JOBZ='N', UPLO='U', IL=1, IU=1)

! Arguments are defined in a module
  REAL(KIND = DP), DIMENSION(:,:), ALLOCATABLE :: Ham_U4_mat ! Hamiltonian matrix
  !
  REAL(KIND = DP), DIMENSION(:), ALLOCATABLE :: eigenval_vec ! Hamiltonian Eigenvalues

The only change needed was to remove the JOBZ argument and rewrite the subroutine call as

        CALL SYEVR(A=Ham_U4_mat, W=eigenval_vec, UPLO='U')

if only eigenvalues are calculated or as 

        CALL SYEVR(A=Ham_U4_mat, W=eigenval_vec, Z=Ham_U4_mat, UPLO='U')

in case eigenvalues and eigenvectors are needed. 

The downside -imho- of this story is that I will need to keep two versions of the programs, one for gfortran+netlib and other for ifort+mkl. The upside is that now the program, compiled and linked with ifort, takes more or less half the time to complete the calculations compared to the gfortran compiled version.

Thanks again for the help received.

Curro

0 Kudos
mecej4
Honored Contributor III
1,284 Views

It is a bit unfortunate that Lapack95 has not been updated since the year 2000, but that is perhaps because the number of users is small compared to the count of users of Lapack.

I think that Intel has done us a service by providing prebuilt and updated Lapack95 (a few years ago (2012?) only a source package with makefiles and instructions was provided), and by providing additional F95 interfaces to Lapack routines that are not present in the Netlib distribution of Lapack95.

For example, see this recent thread, https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/606702 , in which F95 interfaces to HSEQR and HSEIN allow one to construct a much shorter and easier-to-debug program than the F77 interfaces do. The Netlib Lapack95 does not provide for these two routines. Quite likely, many others are missing, as well, because a number of new routines have been added between Lapack 3.0 (which matches the year 2000) and the current 3.6.

0 Kudos
curro_p__b_
Beginner
1,284 Views

Thanks for the tip, the info, and the link.

I would like to make clear that I didn't want to criticize Intel in my message. I have just landed in the ifort worl d and I do not feel proficient enough to make any criticism. I find somewhat complicate to find my way into intel ifort but this because I have almost always programmed in a gfortran environment and it is always hard to get familiar with new tools and techniques. It seems to be a very powerful tool but also one that is not immediate to master. It's an interesting challenge. Now I will start trying to compile other programs with ifort but with this info I think that it will be much easier than in my first attempt.

 

0 Kudos
Reply