Hi,
I’m a beginner in OpenACC, CUDA and making a Fortran program using OpenACC. In the program, I’d like to use “cublasDmatinvBatched” to compute an inverse matrix of an N-by-N (N=6 or more) square matrix. After compiling, type mismatch error appeared.
NVFORTRAN-S-0188-Argument number 3 to cublasdmatinvbatched: type mismatch (InverseMatrix.f90: 28)
NVFORTRAN-S-0188-Argument number 5 to cublasdmatinvbatched: type mismatch (InverseMatrix.f90: 28)
Could you tell me how to solve it?
The program I made is shown below and I compiled with
“nvfortran -acc -Minfo=accel -O2 -cudalib=cublas InverseMatrix.f90 -o InverseMatrix”.
module Inverse
use cudafor
use openacc
use cublas
implicit none
contains
SUBROUTINE MATINV(N,A,Ainv)
type(cublasHandle) :: handle !input
integer :: N !input
double precision :: A(N*N) !input
integer :: lda !input
double precision :: Ainv(N*N) !output
integer :: lda_inv !input
integer :: infomatinv(N) !output
integer :: batchCount = 1 !input
integer :: istat
lda = N
lda_inv = N
istat = cublasCreate(handle)
!$acc data copyin(N,A,lda,lda_inv) copyout(Ainv,infomatinv)
!$acc host_data use_device(N,A,lda,Ainv,lda_inv)
istat = istat + cublasDmatinvBatched(handle, N, A, lda, Ainv, lda_inv, infomatinv, batchCount)
!$acc end host_data
!$acc end data
istat = istat + cublasDestroy(handle)
RETURN
END SUBROUTINE
END module Inverse
Program InverseMatrix
use Inverse
implicit none
integer,parameter :: N = 6
integer :: i
double precision :: A(N*N),Ainv(N*N)
DO i=1,N*N
A(i) = i
END DO
call MATINV(N,A,Ainv)
read(*,*)
END Program InverseMatrix