About CublasCgemv

      module a_m
      use cudafor
      contains
       subroutine loop(a,b,c)
        complex(4) a(2,2),b(2),c(2)
        integer k
        complex(4),device::a_d(2,2),b_d(2),c_d(2)
        k=2
        a_d=a
        b_d=b
        c_d=c
        call cu_loop<<<1,1>>>(a_d,b_d,c_d,k)
        c=c_d
        b=b_d
        a=a_d
       end subroutine loop

!---------------------------------------------------

       attributes(global) subroutine cu_loop(a_d,b_d,c_d)
        use cublas_device
        complex(4), device::a_d(2,2),b_d(2),c_d(2)
        integer istat
        complex(4), parameter:: cone=cmplx(1.0,0.0)
        type(cublasHandle)::h
        istat=cublasCreate(h)
        istat=cublasCgemv(h,cublas_op_t,2,2,cone,a_d,2,b_d,2,cone,c_d,2)
        istat=cublasDestroy(h)
       end subroutine cu_loop
       end a_m

compile with " pgf90 -c a_m.cuf "
PGF90-F-0155-Compiler failed to translate accelerator region (see -Minfo messages): Unexpected address of constant (a_m.cuf: 1)
PGF90/x86-64 Linux 19.4-0: compilation aborted

I don’t know where the problem is ,when I use CublasSgemv(the corresponding variables are also modified),there is no problem,but cublasCgemv has this problem. Any idea?

Looks like it’s “cone” that’s causing the problem since it’s a parameter and the routine is expecting a variable. Try something like:

      attributes(global) subroutine cu_loop(a_d,b_d,c_d)
        use cublas_device
        complex(4), device::a_d(2,2),b_d(2),c_d(2)
        integer istat
        complex(4) :: cone=cmplx
        type(cublasHandle)::h
         cone=cmplx(1.0,0.0)
        istat=cublasCreate(h)
        istat=cublasCgemv(h,cublas_op_t,2,2,cone,a_d,2,b_d,2,cone,c_d,2)
        istat=cublasDestroy(h)
       end subroutine cu_loop
       end a_m

Hope this helps,
Mat