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

Linking problem with magma_dsygvd

kaushik
Beginner
649 Views

Hi,I am getting multiple MKL parameter errors at different runs when I call the magma_dsygvd from a fortran code.
Hope somebody can help fix the bug.

DSYGVD Example Program Results 4LIWORK = 53LWORK = 901LDA = 10LDB = 10MKL ERROR: Parameter 1 was incorrect on entry to magma_dsygvdDSYGVD Example Program Results 4LIWORK = 53LWORK = 901LDA = 10LDB = 10MKL ERROR: Parameter 11 was incorrect on entry to magma_dsygvdOptimum workspace required = ****Workspace provided = 901Please find the source code and makefile enclosed for reference.

0 Kudos
5 Replies
kaushik
Beginner
649 Views
I have tried with intel compilers too and get the same result:

Here`s my code:

program main
integer :: LWORK,LIWORK,NMAX,NIN,NOUT,N,LDA,LDB,NB,error,error1,error2, &
error3,error4
PARAMETER (NMAX=10,NIN=5,NOUT=6,NB=64, &
LDA=NMAX,LDB=NMAX,LIWORK=3+5*NMAX, &
LWORK=1+(NB+6+2*NMAX)*NMAX)
integer*8 ITYPE
DOUBLE PRECISION :: A(LDA,NMAX), B(LDB,NMAX), W(NMAX), WORK(LWORK)
integer :: IWORK(LIWORK)
open(NIN,file='dsygvd.dat',form='formatted')
WRITE (NOUT,*) 'DSYGVD Example Program Results'
WRITE (NOUT,*)
! Skip heading in data file
READ (NIN,*)
READ (NIN,*) N
WRITE(NOUT,*) N
IF (N.LE.NMAX) THEN
WRITE (NOUT,*) 'LIWORK =',LIWORK
WRITE (NOUT,*) 'LWORK = ',LWORK
WRITE (NOUT,*) 'LDA = ',LDA
WRITE (NOUT,*) 'LDB = ',LDB
! Read the upper triangular parts of the matrices A and B
READ (NIN,*) ((A(I,J),J=I,N),I=1,N)
READ (NIN,*) ((B(I,J),J=I,N),I=1,N)
ITYPE=2
call magma_dsygvd(ITYPE,'N','U',N,A,LDA,B,LDB,W,WORK,LWORK, &
IWORK,LIWORK,INFO)
LWOPT = WORK(1)
LIWOPT = IWORK(1)
IF (INFO.EQ.0) THEN
!
! Print solution
!
WRITE (NOUT,*) 'Eigenvalues'
WRITE (NOUT,99999) (W(J),J=1,N)
WRITE (NOUT,*) 'Eigenvectors'
WRITE (NOUT,99999) ((A(I,J),J=1,N),I=1,N)
END IF
! Print workspace information
!
IF (LWORK.LT.LWOPT) THEN
WRITE (NOUT,*)
WRITE (NOUT,99996) 'Optimum workspace required = ', LWOPT, &
'Workspace provided = ', LWORK
END IF
IF (LIWORK.LT.LIWOPT) THEN
WRITE (NOUT,*)
WRITE (NOUT,99995) 'Integer workspace required = ', LIWOPT, &
'Integer workspace provided = ', LIWORK
END IF
ELSE
WRITE (NOUT,*) 'NMAX too small'
END IF
99999 FORMAT (3X,(6F11.4))
99998 FORMAT (4X,1P,6E11.1)
99997 FORMAT (1X,A,I4,A)
99996 FORMAT (1X,A,I4)
99995 FORMAT (1X,A,I5,/1X,A,I5)
end program
Makefile:
magmatest3: magmatest3.f90 makefile
gcc -I/sw/keeneland/cuda/4.0/linux_binary/src/ -I/sw/keeneland/cuda/4.0/linux_binary/include -c fortran.cpp -o fortran.o
ifort -nus -g -c magmatest3.f90 -o magmatest3.o
ifort -g -i8 -I/opt/intel/Compiler/11.1/038/mkl/ magmatest3.o fortran.o -L/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib -lcuda -lmagma -lmagmablas -lmagma -L/opt/intel/Compiler/11.1/038/mkl/lib/em64t -L/sw/keeneland/cuda/4.0/linux_binary/lib64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread -lm -lcublas -o magmatest3
0 Kudos
Gennady_F_Intel
Moderator
649 Views
pls try to link this example with ILP64 library: lmkl_intel_ilp64
0 Kudos
kaushik
Beginner
649 Views
Dear Fedorov,
I still get the same error after replacing lp with ilp64. The errors seem to fluctate at different runs as before.
0 Kudos
mecej4
Honored Contributor III
649 Views
A little tighter focus is probably needed. First get your code working with just CPU code, check that it works correctly. Only after that does it make sense to attempt to migrate the code to work with CUDA processors.

After changing the subroutine call in your posted code to CALL DSYGVD(...), I was able to compile, link and run the program on a 4 X 4 test matrix. The results printed out were in agreement with those given elsewhere.
[bash]WolfDale:~/LANG/Magma> ifort -mkl -traceback magma.f90 WolfDale:~/LANG/Magma> ./a.out DSYGVD Example Program Results N = 4 LIWORK = 53 LWORK = 901 LDA = 10 LDB = 10 Eigenvalues -3.5411 -0.3347 0.2983 2.2544 Eigenvectors 0.1373 0.9473 -0.7098 -0.6202 0.0000 -0.2325 -2.5252 0.4797 0.0000 0.0000 -1.2164 -0.9277 0.0000 0.0000 0.0000 -0.0114 [/bash]
I gather, then, that any problems you have are confined to the CUDA libraries and device drivers that you used. Those libraries are not part of Intel Fortran, C or MKL, and you will be better off looking for CUDA support elsewhere.

Here is the test problem data:
[bash]DSYGVD Example Program Data 4 :Value of N 0.24 0.39 0.42 -0.16 -0.11 0.79 0.63 -0.25 0.48 -0.03 :End of matrix A 4.16 -3.12 0.56 -0.10 5.03 -0.83 1.09 0.76 0.34 1.18 :End of matrix B [/bash]
0 Kudos
kaushik
Beginner
649 Views
Thank you so much.
I have already tested the dsygvd lapack call as per the NAG library example. I get some linking error
There`s no clear view as of yet whether its a CUDA or MAGMA or an MKL linking error, but based on the multiple MKL parameter errors and from the this topichttp://software.intel.com/en-us/forums/showthread.php?t=71275&o=a&s=lrI presumed it to be an MKL issue.
Perhaps further debugging using various gdbs might give an insight of the crash.
Anyway thanks for the timely help!
0 Kudos
Reply