This thread talks about how to use magma with PGI fortran to use those PGI cuda fortran features. But it only gives any example about making use of the MAGMA SGEMM routine in fortran (binding C).
They build interface of sgemm like this:
Code: Select all
interface sgemm
subroutine sgemmDev(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, l
dc) bind(c,name='magmablas_sgemm')
use iso_c_binding
integer(c_int), value :: m, n, k, lda, ldb, ldc
real(c_float), device, dimension(m,n) :: a, b, c
real(c_float), value :: alpha, beta
character(kind=c_char), value :: transa, transb
end subroutine sgemmDev
end interfaceI wrote my interface like this:
Code: Select all
module cgesv_gpu_magma
use cudafor
interface ! cgesvDev
subroutine McgesvDev(n, nrhs, a, lda, ipiv, b, ldb, info) bind(c,name='magma_cgesv_gpu')
use iso_c_binding
integer(c_int), value :: n, nrhs, lda, ldb, info
complex(C_FLOAT_COMPLEX), device, dimension(n,n) :: a
complex(C_FLOAT_COMPLEX), device, dimension(n,nrhs) :: b
integer(c_int), device, dimension(n) :: ipiv
end subroutine McgesvDev
end interface
end module cgesv_gpu_magmaDoes any one know how to solve this problem or have example about using magam complex version device routine in fortran?
The reason I don't use the fortran interface "magmaf_cgesv_gpu" that magma provide is the complex variable's type is a pointer, but I want to use the cuda fortran features to declare complex variable as "complex(b4), device, allocatable :: dA(:,:), dB(:,:)". So If I use the fortran interface that magma provide, I would get the error info that the arguments 3 and 6 are invalid.
Code: Select all
subroutine magmaf_cgesv_gpu( n, nrhs, dA, ldda, ipiv, dB, lddb, info)
integer :: n
integer :: nrhs
magma_devptr_t:: dA
integer :: ldda
integer :: ipiv(*)
magma_devptr_t:: dB
integer :: lddb
integer :: info
end subroutine magmaf_cgesv_gpu