PGF90-S-0038-Symbol, gird, has not been explicitly declared

I’m new in PGI compiler and cudafortran. before i use CUDA C I try to compile and cuf file a get “PGF90-S-0038-Symbol, gird, has not been explicitly declared” message. How can i solve this problem?

module mathOps
contains
    attributes(global) subroutine saxpy(x, y, a)
        implicit none
        real, value :: a
        real :: x(:), y(:)
        integer :: i, n
        n = size(x)
        i = blockDim%x * (blockIdx%x - 1) + threadIdx%x
        if (i <= n) y(i) = y(i) + a*x(i)
    end subroutine saxpy
end module mathOps

program testSaxpy
    use mathOps
    use cudafor
    implicit none    
    integer, parameter :: N = 40000
    real :: x(N), y(N), a
    real, device :: x_d(N), y_d(N)
    type(dim3) :: grid, tBlock

    tBlock = dim3(256, 1, 1)
    gird = dim3(ceiling(real(N)/tBlock%x),1,1)

    x = 1.0; y=2.0; a=2.0
    x_d = x
    y_d = y
    call saxpy<<<grid, tBlock>>>(x_d, y_d, a)
    y = y_d
    write(*,*) 'Max error:', maxval(abs(y-4.0))
end program testSaxpy

[/code]

Hi poyrazkocak,

You have a misspelling. You declared variable as “grid” but used “gird” in one spot.

Hope this helps,
Mat


module mathOps
contains
    attributes(global) subroutine saxpy(x, y, a)
        implicit none
        real, value :: a
        real :: x(:), y(:)
        integer :: i, n
        n = size(x)
        i = blockDim%x * (blockIdx%x - 1) + threadIdx%x
        if (i <= n) y(i) = y(i) + a*x(i)
    end subroutine saxpy
end module mathOps

program testSaxpy
    use mathOps
    use cudafor
    implicit none
    integer, parameter :: N = 40000
    real :: x(N), y(N), a
    real, device :: x_d(N), y_d(N)
    type(dim3) :: grid, tBlock

    tBlock = dim3(256, 1, 1)
!!! This should be "grid" not "gird"
    grid = dim3(ceiling(real(N)/tBlock%x),1,1)

    x = 1.0; y=2.0; a=2.0
    x_d = x
    y_d = y
    call saxpy<<<grid, tBlock>>>(x_d, y_d, a)
    y = y_d
    write(*,*) 'Max error:', maxval(abs(y-4.0))
end program testSaxpy