Retro68/gcc/libgomp/testsuite/libgomp.fortran/examples-4/device-1.f90

57 lines
1.2 KiB
Fortran
Raw Normal View History

2015-08-28 15:33:40 +00:00
! { dg-do run }
2017-04-10 11:32:00 +00:00
! { dg-require-effective-target offload_device_nonshared_as }
2015-08-28 15:33:40 +00:00
program e_57_1
use omp_lib, only: omp_is_initial_device
integer :: a, b
logical :: c, d
a = 100
b = 0
!$omp target map(from: c) if(a > 200 .and. a < 400)
2015-08-28 15:33:40 +00:00
c = omp_is_initial_device ()
!$omp end target
!$omp target data map(to: b) if(a > 200 .and. a < 400)
!$omp target map(from: b, d)
2015-08-28 15:33:40 +00:00
b = 100
d = omp_is_initial_device ()
!$omp end target
!$omp end target data
2018-12-28 15:30:48 +00:00
if (b /= 100 .or. .not. c .or. d) STOP 1
2015-08-28 15:33:40 +00:00
a = a + 200
b = 0
!$omp target map(from: c) if(a > 200 .and. a < 400)
2015-08-28 15:33:40 +00:00
c = omp_is_initial_device ()
!$omp end target
!$omp target data map(to: b) if(a > 200 .and. a < 400)
!$omp target map(from: b, d)
2015-08-28 15:33:40 +00:00
b = 100
d = omp_is_initial_device ()
!$omp end target
!$omp end target data
2018-12-28 15:30:48 +00:00
if (b /= 0 .or. c .or. d) STOP 2
2015-08-28 15:33:40 +00:00
a = a + 200
b = 0
!$omp target map(from: c) if(a > 200 .and. a < 400)
2015-08-28 15:33:40 +00:00
c = omp_is_initial_device ()
!$omp end target
!$omp target data map(to: b) if(a > 200 .and. a < 400)
!$omp target map(from: b, d)
2015-08-28 15:33:40 +00:00
b = 100
d = omp_is_initial_device ()
!$omp end target
!$omp end target data
2018-12-28 15:30:48 +00:00
if (b /= 100 .or. .not. c .or. d) STOP 3
2015-08-28 15:33:40 +00:00
end program