Hello all,
I am trying to use cuSPARSE Dgtsv function to accelerate my tridiagonal Solving part in my code and I am currently trying out the function in an example program which I have attached below.
The compile command is
pgf90 -Mcudalib=cusparse -o test_cuda_cusparse.exe cuda_tdma.cuf
and i get this error
PGF90-S-0084-Illegal use of symbol cusparsedgtsv - attempt to CALL a FUNCTION (cuda_tdma.cuf: 45)
PGF90-S-0450-Argument number 4 to cusparsedgtsv: kind mismatch (cuda_tdma.cuf: 45)
PGF90-S-0450-Argument number 5 to cusparsedgtsv: kind mismatch (cuda_tdma.cuf: 45)
PGF90-S-0450-Argument number 6 to cusparsedgtsv: kind mismatch (cuda_tdma.cuf: 45)
PGF90-S-0450-Argument number 7 to cusparsedgtsv: kind mismatch (cuda_tdma.cuf: 45)
0 inform, 0 warnings, 5 severes, 0 fatal for tdma
The whole code is
!********** cuda_tdma.cuf ************!
PROGRAM TDMA
use iso_C_binding
use cudafor
use cusparse
implicit none
! atri - sub-diagonal (means it is the diagonal below the main diagonal)
! btri - the main diagonal
! ctri - sup-diagonal (means it is the diagonal above the main diagonal)
! dtri - right part
! npts - number of equations
integer npts,i,istat
parameter (npts=3)
real,target, dimension(npts) :: atri,btri,ctri,dtri
real, device :: dl(npts), d(npts), du(npts), B(npts)
type(cusparseHandle) :: handle
!***** TEST VALUES INITIALIZATION *****!
atri(1)=0
atri(2)=-1
atri(3)=-1
btri(1)=3
btri(2)=3
btri(3)=3
ctri(1)=-1
ctri(2)=-1
ctri(3)=0
dtri(1)=-1
dtri(2)=7
dtri(3)=7
!***** memcpy() HtoD *****!
dl = atri
d = btri
du = ctri
B = dtri
!***** Calling Dgtsv *****!
call cusparseDgtsv(handle,npts,1,dl,d,du,B,1)
!***** memcpy() DtoH *****!
dtri = B
!***** Printing solution *****!
print*,'The solution is: '
do i=1,npts
print*,'X(',i,'):',dtri(i)
end do
END PROGRAM TDMA
Can someone sort this out ?