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

MKL erro when using IMSL

iljungqvist
Beginner
934 Views
Hi,

i am using IMSL with intel virtual fortran+mkl.

I tried to use a routine from IMSL. It was compiled fine, but when I try to execute the file, it came up with an error saying:

MKL ERROR: Parameter 7 was incorrect on entry to SGEEVX

*** TERMINAL ERROR 2 from EVCRG.  The required storage cannot be allocated.
***          The specified N may be too large, where N = 1064682127.

The following is the code I am using:

PROGRAM test_evcrg
include 'link_fnl_static.h'  
!DEC$ OBJCOMMENT lib:'libiomp5mt.lib'

IMPLICIT NONE
REAL, Dimension(2,2) :: p,vr
REAL, Dimension(2) :: w

p = RESHAPE([0.7, 0.3, 0.5,0.5],[2,2])

CALL EVCRG (p,w,vr) 

WRITE (*,*), w
WRITE (*,*)
WRITE (*,*), vr

END PROGRAM test_evcrg

How can I fix this problem? Thanks!


0 Kudos
1 Solution
Steven_L_Intel1
Employee
934 Views
If you don't have the USE xxx_INT line, then you must use the "F77 interface" as documented. The documentation says:

Required Arguments
A - Floating-point array containing the matrix. (Input)
EVAL - Complex array of size N containing the eigenvalues of A in decreasing order of
magnitude. (Output)
EVEC - Complex array containing the matrix of eigenvectors. (Output)
The J-th eigenvector, corresponding to EVAL(J), is stored in the J-th column. Each
vector is normalized to have Euclidean length equal to the value one.

You gave REAL arrays for the EVAL and EVEC arguments, hence the compile error when you add the USE.

If you change the declarations to be:

REAL, Dimension(2,2) :: p
COMPLEX, Dimension(2,2) :: vr
COMPLEX, Dimension(2) :: w

Then it works. I will also recommend that you change the OBJCOMMENT directive to reference 'libiomp5md.lib' as the 'mt' version will go away in the next release.

I don't see any MKL usage here - perhaps it's incidental.

View solution in original post

0 Kudos
6 Replies
Les_Neilson
Valued Contributor II
934 Views
According to the IMSL Fortran 90 MP Library Users Guide
itshould be calledwith something like EVCRG( N, A, N, EVAL, EVEC, N )

I assume your "p" should equate to A; "w" equate to EVAL and "vr" equate to EVEC ?
In that case you missed out the "N"

So it appearsthat your REAL variableis beingpassed toanINTEGER N and used to dimension some (possibly automatic) arrays in EVCRG

Les
0 Kudos
iljungqvist
Beginner
934 Views
Thanks, Les.

I had a look at the IMSL library User's Guide. The fortran90 interface is said to be

FORTRAN 90 Interface
Generic: CALL EVCRG (A, EVAL, EVEC [,])
Specific: The specific interface names are S_EVCRG and D_EVCRG.


So I think I actually called the routine in a correct way.

Besides, I added "USE EVCRG_INT" into my code,

It now gives me another error message:

test_evcrg.f90(14): error #6285: There is no matching specific subroutine for th
is generic subroutine call. [EVCRG]
CALL EVCRG(p,w,vr)
---------^
compilation aborted for test_evcrg.f90 (code 1)


Acoording to the information given, I guess there might be some mismatch of the dummy arguments (maybe I am wrong). I checked the example given the USER'S GUIDE, but I still cannot find any.


0 Kudos
Les_Neilson
Valued Contributor II
934 Views
Interesting. The document I was looking at is at http://ires.ku.edu/imsl/F9040.pdf but it talks about "the F77 interface".


"Note that the computation of the complex matrix X and the diagonal matrix D is performed using the IMSL MATH/LIBRARY FORTRAN 77 routine EVCRG.This is an illustration of combining parts of FORTRAN 77 and Fortran 90 code. The information is made available to the Fortran 90 compiler by using the FORTRAN 77 interface for EVCRG."

and the sample code shows :
! Use IMSL Numerical Libraries F77 subroutine for the

! eigenvalue-eigenvector calculation.
CALL EVCRG(N, A, N, EVAL, EVEC, N)

It also hasa "use Numerial_Libraries" at the top of the code.

Looking at another web reference (on the RogueWave website) the variables "N" are optional, and the sample code has aUSEEVCRG_INT andCALL EVCRG(A, EVAL, EVEC) whichis the sameas your code.

SoI'm not sure what is wrong with your code as shown.
:-(

Les


EDIT
The RogueWave sample code has EVAL and EVEC as COMPLEX not REAL
A is REAL

Is this the problem?




0 Kudos
Steven_L_Intel1
Employee
935 Views
If you don't have the USE xxx_INT line, then you must use the "F77 interface" as documented. The documentation says:

Required Arguments
A - Floating-point array containing the matrix. (Input)
EVAL - Complex array of size N containing the eigenvalues of A in decreasing order of
magnitude. (Output)
EVEC - Complex array containing the matrix of eigenvectors. (Output)
The J-th eigenvector, corresponding to EVAL(J), is stored in the J-th column. Each
vector is normalized to have Euclidean length equal to the value one.

You gave REAL arrays for the EVAL and EVEC arguments, hence the compile error when you add the USE.

If you change the declarations to be:

REAL, Dimension(2,2) :: p
COMPLEX, Dimension(2,2) :: vr
COMPLEX, Dimension(2) :: w

Then it works. I will also recommend that you change the OBJCOMMENT directive to reference 'libiomp5md.lib' as the 'mt' version will go away in the next release.

I don't see any MKL usage here - perhaps it's incidental.
0 Kudos
iljungqvist
Beginner
934 Views
Wow, it works!

I should have read the routine description in the USER'S GUIDE more carefully.

Required Arguments
A - Floating-point array containing the matrix. (Input)
EVAL - Complex array of size N containing the eigenvalues of A in decreasing order of
magnitude. (Output)
EVEC - Complex array containing the matrix of eigenvectors. (Output)
The J-th eigenvector, corresponding to EVAL(J), is stored in the J-th column. Each
vector is normalized to have Euclidean length equal to the value one.


Thank you very much! You might have saved me several hours on the problem.

So, the lessons to me are:
Read the document more carefully.
If there is a given example, try to run it on your own, it might help track where the bugs are hiding in (by comparing the differece between the codes.)
:)
0 Kudos
iljungqvist
Beginner
934 Views
Hi Steve,
Just saw your reply. Problem sovled. Thanks for the detailed instruction. (I learned many from your replies to others' questions).
Thanks,


0 Kudos
Reply