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

Strange behaviour when using ZGETRF

nicop
Beginner
1,000 Views
When trying to use the subroutine ZGETRF we get
MKL ERROR: Parameter 4 was incorrect on entry to ZGETRF

Our code is:
[plain]*     ZGETRF (F07ARF) Example Program Text
*     Mark 15 Release. NAG Copyright 1991.
*     .. Parameters ..
      INTEGER          NIN, NOUT
      PARAMETER        (NIN=5,NOUT=6)
      INTEGER          MMAX, NMAX, LDA
      PARAMETER        (MMAX=8,NMAX=8,LDA=MMAX)
*     .. Local Scalars ..
      INTEGER          I, IFAIL, INFO, J, M, N
*     .. Local Arrays ..
      COMPLEX*16       A(LDA,NMAX)
      COMPLEX*16       B(LDA,NMAX)
      INTEGER          IPIV(NMAX)
      CHARACTER        CLABS(1), RLABS(1)
*     .. External Subroutines ..
      EXTERNAL         ZGETRF, X04DBF
*     .. Intrinsic Functions ..
      INTRINSIC        MIN
*     .. Executable Statements ..
      WRITE (NOUT,*) 'ZGETRF Example Program Results'
*     Skip heading in data file
      READ (NIN,*)
      READ (NIN,*) M, N
      IF (M.LE.MMAX .AND. N.LE.NMAX) THEN
*
*        Read A from data file
*
         READ (NIN,*) ((A(I,J),J=1,N),I=1,M)
         B(1:M,1:N)=A(1:M,1:N)
*
*        Factorize A
*
         CALL ZGETRF(M,N,A,LDA,IPIV,INFO)
*
      END IF
      STOP
      END
[/plain]
which is the code provided in the examples directory. Our change is an assignment of the matrix A to B.
The code works fine without the assignment.

The input was taken from the examples directory too.

compilation command:
mpif90 -L/opt/intel/Compiler/11.1/046/mkl/lib/em64t -lmkl_core -lmkl_sequential -lmkl_lapack -lmkl_intel_ilp64 zgetrfx.f

execution command:
./a.out < zgetrfx.d

Help would be highly appreciated.
Best regards
Nico Parragh
0 Kudos
2 Replies
Alexander_K_Intel3
1,000 Views
Hello Nico,

You are linking ilp64 libraries by -lmkl_intel_ilp64. It assumes that all input integers are 8byte long. In Fortran default integer length is 4byte. So you need one of:
1. Add -i8 flagwhile compiling Fortran sources, so the default integer length will become 8byte.

2. Link with -lmkl_intel_lp64, which assumes 4byte integers on input.

--Alexander

0 Kudos
nicop
Beginner
1,000 Views
Thank you, this solved the problem!
Best
Nico
0 Kudos
Reply