Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
121 Views

Intel Fortran and MKL: How to include lapack.f90 and mkl.fi

I need to use a subroutine from MKL LAPACK in my program. I was reading that, in orden to use that subroutine in my program, I need to include lapack.f90 and mkl.fi in my program an then use -mkl option when I compile it. But this is not quite easy thing to do it (for me). Because I read that those files are precompiled and I need to compile it, and this is the question: how I compile those files? and how to use those files in my program?. I need exactly the code to do it, because I'm not a programmer and I don't understand some things, I'm just only a physics graduate student that use only ifort to compile and no more than that. Hope you can help me.

 

0 Kudos
2 Replies
Highlighted
Black Belt
121 Views

You need to worry about those files only if you wish to have interface checking done or if you call an MKL routine that requires an explicit interface to be provided.

You can compile lapack.f90 by itself (i.e., without naming it in an INCLUDE statement in your program). The compilation will produce one or more module files, which you can name in USE statements in your source code if you so desire or need.

I need exactly the code to do it, because I'm not a programmer and I don't understand some things

You are a programmer now. You have to learn these "things", and they are quite logical and well-documented.

 

 

 

0 Kudos
Highlighted
Beginner
121 Views

Hi, thanks for the reply. A further research in the documentation give me the answer. lapack.f90 is already compiled and ready to use under the use statement. One only need to add the following statements in the main program :

use lapack95
use f95_precision

But, adding this is very confusing, because the documentation tells you that you have to include lapack.f90 OR mkl.fi to use the subroutine. So the first thought is use the include statement, but the explanation beyond the idea "include" is hide somewhere in the documentation, exactly in(I post this because could be helpful for someone in the future):  

Fortran 95 Interface Conventions for LAPACK Routines 

Intel® MKL implements the Fortran 95 interface to LAPACK through wrappers that call respective FORTRAN 77 routines. This interface uses such Fortran 95 features as assumed-shape arrays and optional arguments to provide simplified calls to LAPACK routines with fewer arguments.

NOTE

For LAPACK, Intel MKL offers two types of the Fortran 95 interfaces:

  • using mkl_lapack.fi only through the include 'mkl_lapack.fi' statement. Such interfaces allow you to make use of the original LAPACK routines with all their arguments

  • using lapack.f90 that includes improved interfaces. This file is used to generate the module files lapack95.mod and f95_precision.mod. See also the section "Fortran 95 interfaces and wrappers to LAPACK and BLAS" of the Intel® MKL Developer Guide for details. The module files are used to process the FORTRAN use clauses referencing the LAPACK interface: use lapack95 and use f95_precision. 

 

0 Kudos