| 1 |
! { dg-do run } |
| 2 |
|
| 3 |
! Test of attach/detach with "acc data". |
| 4 |
|
| 5 |
program dtype |
| 6 |
implicit none |
| 7 |
integer, parameter :: n = 512 |
| 8 |
type mytype |
| 9 |
integer, allocatable :: a(:) |
| 10 |
end type mytype |
| 11 |
integer i |
| 12 |
|
| 13 |
type(mytype) :: var |
| 14 |
|
| 15 |
allocate(var%a(1:n)) |
| 16 |
|
| 17 |
!$acc data copy(var) |
| 18 |
!$acc data copy(var%a) |
| 19 |
|
| 20 |
!$acc parallel loop |
| 21 |
do i = 1,n |
| 22 |
var%a(i) = i |
| 23 |
end do |
| 24 |
!$acc end parallel loop |
| 25 |
|
| 26 |
!$acc end data |
| 27 |
!$acc end data |
| 28 |
|
| 29 |
do i = 1,n |
| 30 |
if (i .ne. var%a(i)) stop 1 |
| 31 |
end do |
| 32 |
|
| 33 |
deallocate(var%a) |
| 34 |
|
| 35 |
end program dtype |