Hi,
I getting numerous linking errors when I call the magma_dsygvd from a fortran code. I am using the Pgf90 compiler.
Here`s my code:
! DSYGVD Example Program Text
! MAGMA INTERFACE
module magmafor
interface dsygvdmagma
subroutine dsygvdDev (ITYPE, JOBZ, UPLO, N, A, LDA, B, LDB, W, WORK, &
LWORK,IWORK, LIWORK, INFO) bind (c, name = 'magma_dsygvd')
use iso_c_binding
integer(c_int), value :: ITYPE, N, LDA, LDB, LWORK, LIWORK, INFO
character(kind = c_char), value :: JOBZ, UPLO
double precision(c_double), device, allocatable :: A(:,:), B(:,:), W(:), WORK(:)
! double precision(c_double), device, dimension (:) :: W(N), WORK(LWORK)
integer(c_int), device, ALLOCATABLE :: IWORK(:)
end subroutine dsygvdDev
end interface
end module magmafor
program main
use magmafor
INTEGER NIN, NOUT
PARAMETER (NIN=5,NOUT=6)
INTEGER NB, NMAX
PARAMETER (NB=64,NMAX=10)
INTEGER LDA, LDB, LIWORK, LWORK, error
PARAMETER (LDA=NMAX,LDB=NMAX,LIWORK=3+5*NMAX,&
LWORK=1+(6+2*NMAX)*NMAX)
! .. Local Scalars ..
DOUBLE PRECISION, allocatable :: A(:,:), B(:,:), &
W(:), WORK(:)
double precision, device, allocatable :: dA(:,:), dB(:,:), &
dW(:), dWORK(:)
INTEGER IWORK(LIWORK)
integer, device, allocatable :: dIWORK(:)
! .. Executable Statements ..
WRITE (NOUT,*) 'DSYGVD Example Program Results'
WRITE (NOUT,*)
! Skip heading in data file
READ (NIN,*)
READ (NIN,*) N
IF (N.LE.NMAX) THEN
!
allocate (A(LDA,NMAX),B(LDA,NMAX), W(NMAX), WORK(LWORK), stat=error)
if(stat1.ne.0) then
print*,'error: couldn`t alloc memory'
end if
! 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)
allocate (dA(LDA,NMAX), dB(LDA,NMAX), dW(NMAX), dWORK(LWORK))
allocate (dIWORK(LIWROK))
dA = A
dB = B
dW = W
dWORK = WORK
! Magma call
call dsygvdmagma(1,'V','U',N,dA,LDA,dB,LDB,dW,dWORK,LWORK,dIWORK,LIWORK,INFO)
!
! Solve the generalized symmetric eigenvalue problem
! A*B*x = lambda*x (ITYPE = 2)
!
! CALL DSYGVD(2,'Vectors','Upper',N,A,LDA,B,LDB,W,WORK,LWORK, &
! IWORK,LIWORK,INFO)
LWOPT = WORK(1)
LIWOPT = IWORK(1)
!
IF (INFO.EQ.0) THEN
!
W = dW
A = dA
! 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,99995) '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)
deallocate(A)
deallocate(B)
deallocate(W,WORK)
deallocate(dA)
deallocate(dB)
deallocate(dW)
deallocate(dWORK)
deallocate(dIWORK)
end program
I compiled with:
dsygvdmagma: dsygvdmagma.f90
pgf90 -Mcuda -c $<
pgf90 -Mcuda -o $@ $@.o -L/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib -R/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.o/lib -lmagma -lmagmablas -lcublas -lm
And I get these errors:
pgf90 -Mcuda -c dsygvdmagma.f90
pgf90 -Mcuda -o dsygvdmagma dsygvdmagma.o -L/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib -lmagma -lmagmablas -lcublas -lm
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagma.a(dsygvd.o): In function `magma_dsygvd':
dsygvd.cpp:(.text+0x8a): undefined reference to `lsame_'
dsygvd.cpp:(.text+0x9d): undefined reference to `lsame_'
dsygvd.cpp:(.text+0x2b9): undefined reference to `lsame_'
dsygvd.cpp:(.text+0x31f): undefined reference to `lsame_'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagma.a(dpotrf_gpu.o): In function `magma_dpotrf_gpu':
dpotrf_gpu.cpp:(.text+0x58): undefined reference to `lsame_'
dpotrf_gpu.cpp:(.text+0x1a8): undefined reference to `dpotrf_'
dpotrf_gpu.cpp:(.text+0x399): undefined reference to `lsame_'
dpotrf_gpu.cpp:(.text+0x3ea): undefined reference to `dpotrf_'
dpotrf_gpu.cpp:(.text+0x508): undefined reference to `dpotrf_'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagma.a(dsygst_gpu.o): In function `magma_dsygst_gpu':
dsygst_gpu.cpp:(.text+0x5c): undefined reference to `lsame_'
dsygst_gpu.cpp:(.text+0x60f): undefined reference to `dsygs2_'
dsygst_gpu.cpp:(.text+0x74e): undefined reference to `lsame_'
dsygst_gpu.cpp:(.text+0xc73): undefined reference to `dsygs2_'
dsygst_gpu.cpp:(.text+0xf19): undefined reference to `dsygs2_'
dsygst_gpu.cpp:(.text+0x16a6): undefined reference to `dsygs2_'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagma.a(xerbla.o): In function `magma_xerbla':
xerbla.cpp:(.text+0x1c): undefined reference to `xerbla_'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagma.a(dsyevd_gpu.o): In function `magma_dsyevd_gpu':
dsyevd_gpu.cpp:(.text+0x86): undefined reference to `lsame_'
dsyevd_gpu.cpp:(.text+0x99): undefined reference to `lsame_'
dsyevd_gpu.cpp:(.text+0x264): undefined reference to `dlamch_'
dsyevd_gpu.cpp:(.text+0x276): undefined reference to `dlamch_'
dsyevd_gpu.cpp:(.text+0x40f): undefined reference to `dsterf_'
dsyevd_gpu.cpp:(.text+0x4c9): undefined reference to `lsame_'
dsyevd_gpu.cpp:(.text+0x4f0): undefined reference to `lsame_'
dsyevd_gpu.cpp:(.text+0x5de): undefined reference to `dstedc_'
dsyevd_gpu.cpp:(.text+0x75c): undefined reference to `dscal_'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagma.a(dsytrd_gpu.o): In function `magma_dsytrd_gpu':
dsytrd_gpu.cpp:(.text+0x62): undefined reference to `lsame_'
dsytrd_gpu.cpp:(.text+0x435): undefined reference to `dsytrd_'
dsytrd_gpu.cpp:(.text+0x524): undefined reference to `lsame_'
dsytrd_gpu.cpp:(.text+0x921): undefined reference to `dsytrd_'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagma.a(dlatrd.o): In function `magma_dlatrd':
dlatrd.cpp:(.text+0xaa): undefined reference to `lsame_'
dlatrd.cpp:(.text+0x160): undefined reference to `dlarfg_'
dlatrd.cpp:(.text+0x344): undefined reference to `dscal_'
dlatrd.cpp:(.text+0x39d): undefined reference to `ddot_'
dlatrd.cpp:(.text+0x3f4): undefined reference to `daxpy_'
dlatrd.cpp:(.text+0x4c9): undefined reference to `dgemv_'
dlatrd.cpp:(.text+0x556): undefined reference to `dgemv_'
dlatrd.cpp:(.text+0x67a): undefined reference to `dgemv_'
dlatrd.cpp:(.text+0x6ed): undefined reference to `dgemv_'
dlatrd.cpp:(.text+0x76e): undefined reference to `dlarfg_'
dlatrd.cpp:(.text+0x9c1): undefined reference to `dgemv_'
dlatrd.cpp:(.text+0xa35): undefined reference to `dgemv_'
dlatrd.cpp:(.text+0xab5): undefined reference to `dgemv_'
dlatrd.cpp:(.text+0xb41): undefined reference to `dgemv_'
dlatrd.cpp:(.text+0xb78): undefined reference to `dscal_'
dlatrd.cpp:(.text+0xbdf): undefined reference to `ddot_'
dlatrd.cpp:(.text+0xc41): undefined reference to `daxpy_'
dlatrd.cpp:(.text+0xcca): undefined reference to `dgemv_'
dlatrd.cpp:(.text+0xd5a): undefined reference to `dgemv_'
dlatrd.cpp:(.text+0xddc): undefined reference to `dgemv_'
dlatrd.cpp:(.text+0xe76): undefined reference to `dgemv_'
dlatrd.cpp:(.text+0xeb3): undefined reference to `daxpy_'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagma.a(dormtr_gpu.o): In function `magma_dormtr_gpu':
dormtr_gpu.cpp:(.text+0x87): undefined reference to `lsame_'
dormtr_gpu.cpp:(.text+0x97): undefined reference to `lsame_'
dormtr_gpu.cpp:(.text+0xc7): undefined reference to `lsame_'
dormtr_gpu.cpp:(.text+0x133): undefined reference to `lsame_'
dormtr_gpu.cpp:(.text+0x1a9): undefined reference to `lsame_'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagma.a(dormtr_gpu.o):dormtr_gpu.cpp:(.text+0x1cc): more undefined references to `lsame_' follow
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagma.a(dormqr2_gpu.o): In function `magma_dormqr2_gpu':
dormqr2_gpu.cpp:(.text+0x547): undefined reference to `dlarft_'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagma.a(dormql2_gpu.o): In function `magma_dormql2_gpu':
dormql2_gpu.cpp:(.text+0x103): undefined reference to `lsame_'
dormql2_gpu.cpp:(.text+0x118): undefined reference to `lsame_'
dormql2_gpu.cpp:(.text+0x1f9): undefined reference to `lsame_'
dormql2_gpu.cpp:(.text+0x221): undefined reference to `lsame_'
dormql2_gpu.cpp:(.text+0x52b): undefined reference to `dlarft_'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagmablas.a(dauxiliary.cu_o): In function `cpu_gpu_ddiff':
tmpxft_0000388c_00000000-1_dauxiliary.cudafe1.cpp:(.text+0x6ad): undefined reference to `daxpy_'
tmpxft_0000388c_00000000-1_dauxiliary.cudafe1.cpp:(.text+0x6d5): undefined reference to `dlange_'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagmablas.a(dauxiliary.cu_o): In function `magmablas_dlaset':
tmpxft_0000388c_00000000-1_dauxiliary.cudafe1.cpp:(.text+0x7b4): undefined reference to `magma_stream'
tmpxft_0000388c_00000000-1_dauxiliary.cudafe1.cpp:(.text+0x801): undefined reference to `magma_stream'
tmpxft_0000388c_00000000-1_dauxiliary.cudafe1.cpp:(.text+0x867): undefined reference to `magma_stream'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagmablas.a(dauxiliary.cu_o): In function `dzero_32x32_block':
tmpxft_0000388c_00000000-1_dauxiliary.cudafe1.cpp:(.text+0xaab): undefined reference to `magma_stream'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagmablas.a(dauxiliary.cu_o): In function `dzero_nbxnb_block':
tmpxft_0000388c_00000000-1_dauxiliary.cudafe1.cpp:(.text+0xb9e): undefined reference to `magma_stream'
/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/libmagmablas.a(dauxiliary.cu_o):tmpxft_0000388c_00000000-1_dauxiliary.cudafe1.cpp:(.text+0xd17): more undefined references to `magma_stream' follow
make: *** [dsygvdmagma] Error 2
