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

mkl libraries compiling and not compiling

diedro
Beginner
658 Views

Dear all,

I have a strange problem. I wrote two programs where I use MKL libraries. 

I compile them with the following command:

ifort -r8 *.f90 -lmkl_blas95_lp64 -lmkl_lapack95_lp64 -mkl=sequential

and this is my bash file:

source /opt/intel/bin/compilervars.sh intel64
source /opt/intel/mkl/bin/mklvars.sh intel64 mod lp64
export PATH

I use the following MKL subroutines in both program:

USE lapack95
IMPLICIT NONE
...
...
..
..
 CALL GETRF(A,B,info)  

The compilation of the first program works fine. However, when i compile the second one i get:

There is no matching specific subroutine for this generic subroutine call.   [GETRF]
 CALL GETRF(A,B,info)

In the second program all the subroutines and functions are inside a module while in the first one only the functions have a module.

what I get it wrong?

Thanks a lot

0 Kudos
3 Replies
mecej4
Honored Contributor III
658 Views

It is not possible to answer questions about argument mismatches when you do not show the declarations of the MKL subroutine arguments in question. In particular, what is the declaration of the second argument, B, in the two programs? Or, perhaps better still, can you post the two programs, if they are not too long?

0 Kudos
Martyn_C_Intel
Employee
658 Views

When a subroutine is inside a module, and you "USE" the module, the compiler can see the interface and emit an error at compile time if there is an argument mismatch between caller and callee.  If the subroutine is not in a module, the compiler can't see the interface (unless you code one explicitly), and so can't detect any argument mismatches. These are likely to show up as link-time or run-time errors instead, and may be much harder to debug. In the long term, it's better to get descriptive error messages at compile time.

       In the case where you don't use modules, it's good practice to compile with -gen-interfaces and -warn interfaces, so that you can still get messages about argument mismatches at compile time. This doesn't save you from carefully checking argument types against the documentation and/or header files.

For GETRF,  is your second argument "B" declared as an integer array?

0 Kudos
diedro
Beginner
658 Views

Dear all,

I am sorry, Martyn you are right. I have forgotten to decleare B as integer. 

Here the sample  program, correct this time.

Thanks again

program testmkl
use LAPACK95
implicit none
real    ,allocatable,dimension(:,:)::AA
integer ,allocatable,dimension(:)::BB
integer :: info,n

n=10
allocate(AA(n,n))
allocate(BB(n))

 call GETRF(AA,BB,info)

endprogram

 

0 Kudos
Reply