brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 2348c2e Raw
51 lines · plain
1! Common source for CUF parse tree and unparsing tests.2!@cuf subroutine atcuf;3end4 5#ifdef _CUDA6    subroutine cudadefd;7end8#endif9 10module m11  real, allocatable, pinned ::pa(:)12 contains13  attributes(device) subroutine devicesub; end14  attributes(device) real function devicefunc(); devicefunc = 1.; end15  attributes(global) subroutine globalsub; end16  attributes(grid_global) subroutine gridglobalsub; end17  attributes(host) subroutine hostsub; end18  attributes(global) launch_bounds(1, 2) subroutine lbsub; end19  attributes(global) cluster_dims(1, 2, 3) subroutine cdsub; end20  attributes(device) subroutine attrs21    attributes(device) :: devx122    real, device :: devx223  end subroutine24  subroutine test25    logical isPinned26    real, device :: a(10)27    real :: x, y, z28    !$cuf kernel do(1) <<<*, *, stream = 1>>>29    do j = 1, 1030    end do31    !$cuf kernel do <<<1, (2, 3), stream = 1>>>32    do j = 1, 1033    end do34    !$cuf kernel do35    do j = 1, 1036    end do37    !$cuf kernel do <<<*, *>>> reduce(+:x,y) reduce(*:z)38    do j = 1, 1039      x = x + a(j)40      y = y + a(j)41      z = z * a(j)42    end do43    call globalsub<<<1, 2>>>44    call globalsub<<<1, 2, 3>>>45    call globalsub<<<1, 2, 3, 4>>>46    call globalsub<<<1, 2, 0.9*10, 4>>>47    call globalsub<<<*,5>>>48    allocate(pa(32), pinned = isPinned)49  end subroutine50end module51