1 ! Basic offloading test with a target region
2 ! REQUIRES: flang, amdgcn-amd-amdhsa
3 ! UNSUPPORTED: nvptx64-nvidia-cuda
4 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
5 ! UNSUPPORTED: aarch64-unknown-linux-gnu
6 ! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
7 ! UNSUPPORTED: x86_64-pc-linux-gnu
8 ! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
10 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
12 ! Testing simple variables in common block.
15 call commonblock_simple_with_implicit_type
16 call commonblock_simple_with_integer
17 call commonblock_simple_with_real
22 subroutine check_device
25 devices(1) = omp_get_device_num()
26 !$omp target map(tofrom:devices)
27 devices(2) = omp_get_device_num()
29 print *, "devices: ", devices
30 end subroutine check_device
36 subroutine commonblock_simple_with_implicit_type
40 print *, "var1 before target = ", var1
41 !$omp target map(tofrom:var1)
44 print *, "var1 after target = ", var1
47 ! CHECK: var1 before target = 10
48 ! CHECK: var1 after target = 20
52 subroutine commonblock_simple_with_integer
57 print *, "var2 before target = ", var2
58 !$omp target map(tofrom:var2)
61 print *, "var2 after target = ", var2
64 ! CHECK: var2 before target = 10
65 ! CHECK: var2 after target = 20
69 subroutine commonblock_simple_with_real
74 print *, "var3 before target = ", var3
75 !$omp target map(tofrom:var3)
78 print *, "var3 after target = ", var3
81 ! CHECK: var3 before target = 12.5
82 ! CHECK: var3 after target = 14.5