| 1 |
! Common source for CUF parse tree and unparsing tests. |
| 2 |
!@cuf subroutine atcuf; |
| 3 |
end |
| 4 |
|
| 5 |
#ifdef _CUDA |
| 6 |
subroutine cudadefd; |
| 7 |
end |
| 8 |
#endif |
| 9 |
|
| 10 |
module m |
| 11 |
real, allocatable, pinned ::pa(:) |
| 12 |
contains |
| 13 |
attributes(device) subroutine devicesub; end |
| 14 |
attributes(device) real function devicefunc(); devicefunc = 1.; end |
| 15 |
attributes(global) subroutine globalsub; end |
| 16 |
attributes(grid_global) subroutine gridglobalsub; end |
| 17 |
attributes(host) subroutine hostsub; end |
| 18 |
attributes(global) launch_bounds(1, 2) subroutine lbsub; end |
| 19 |
attributes(global) cluster_dims(1, 2, 3) subroutine cdsub; end |
| 20 |
attributes(device) subroutine attrs |
| 21 |
attributes(device) :: devx1 |
| 22 |
real, device :: devx2 |
| 23 |
end subroutine |
| 24 |
subroutine test |
| 25 |
logical isPinned |
| 26 |
real a(10), x, y, z |
| 27 |
!$cuf kernel do(1) <<<*, *, stream = 1>>> |
| 28 |
do j = 1, 10 |
| 29 |
end do |
| 30 |
!$cuf kernel do <<<1, (2, 3), stream = 1>>> |
| 31 |
do j = 1, 10 |
| 32 |
end do |
| 33 |
!$cuf kernel do <<<*, *>>> reduce(+:x,y) reduce(*:z) |
| 34 |
do j = 1, 10 |
| 35 |
x = x + a(j) |
| 36 |
y = y + a(j) |
| 37 |
z = z * a(j) |
| 38 |
end do |
| 39 |
call globalsub<<<1, 2>>> |
| 40 |
call globalsub<<<1, 2, 3>>> |
| 41 |
call globalsub<<<1, 2, 3, 4>>> |
| 42 |
allocate(pa(32), pinned = isPinned) |
| 43 |
end subroutine |
| 44 |
end module |