blob: 10c7cecf0841238dd92668f3fc6afeada5df5325 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
! Basic offloading test that makes sure we can use the predominantly host
! pragma threadprivate in the same program as target code
! REQUIRES: flang, amdgpu
! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
implicit none
type dtype
integer :: val(10)
end type dtype
integer :: i
type(dtype), pointer :: pointer1
type(dtype), pointer :: pointer2=>null()
integer, dimension(:), pointer :: data_pointer
!$omp threadprivate(pointer2)
nullify(pointer1)
allocate(pointer1)
pointer2=>pointer1
pointer2%val(:)=1
data_pointer=>pointer2%val
!$omp target
do i = 1, 10
data_pointer(i) = i
end do
!$omp end target
print *, data_pointer
end program main
! CHECK: 1 2 3 4 5 6 7 8 9 10
|