Skip to content

Commit d87a53a

Browse files
[NFC][OpenMP][Flang] Add test for OpenMP target parallel do (#77776)
Added test which proves that end-to-end compilation of `omp target parallel do` costruct is successful for Flang compiler.
1 parent 07abde2 commit d87a53a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
! Basic offloading test with a target region
2+
! REQUIRES: flang
3+
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
4+
! UNSUPPORTED: aarch64-unknown-linux-gnu
5+
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
6+
! UNSUPPORTED: x86_64-pc-linux-gnu
7+
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
8+
9+
! RUN: %libomptarget-compile-fortran-generic
10+
! RUN: env LIBOMPTARGET_INFO=16 %libomptarget-run-generic 2>&1 | %fcheck-generic
11+
program main
12+
use omp_lib
13+
integer :: x(100)
14+
integer :: errors = 0
15+
integer :: i
16+
17+
!$omp target parallel do map(from: x)
18+
do i = 1, 100
19+
x(i) = i
20+
end do
21+
!$omp end target parallel do
22+
do i = 1, 100
23+
if ( x(i) .ne. i ) then
24+
errors = errors + 1
25+
end if
26+
end do
27+
28+
print *,"number of errors: ", errors
29+
30+
end program main
31+
32+
! CHECK: "PluginInterface" device {{[0-9]+}} info: Launching kernel {{.*}}
33+
! CHECKi: number of errors: 0

0 commit comments

Comments
 (0)