Skip to content

Commit f330bb2

Browse files
authored
Test flang-539234 (#1496)
1 parent 5d0e93c commit f330bb2

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
include ../../Makefile.defs
2+
3+
TESTNAME = split_teams_distribute_parallel_do
4+
TESTSRC_MAIN = split_teams_distribute_parallel_do.f90
5+
TESTSRC_AUX =
6+
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
7+
8+
FLANG ?= flang
9+
OMP_BIN = $(AOMP)/bin/$(FLANG)
10+
CC = $(OMP_BIN) $(VERBOSE)
11+
#-ccc-print-phases
12+
#"-\#\#\#"
13+
14+
include ../Makefile.rules
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
! compile with:
2+
!
3+
! amdflang -O2 -fopenmp --offload-arch=gfx90a -o split_teams_distribute_parallel_do split_teams_distribute_parallel_do.f90
4+
5+
module foo_mod
6+
implicit none
7+
contains
8+
subroutine foo(ib,val,arr)
9+
implicit none
10+
integer, intent(in) :: ib, val
11+
integer, dimension(:), intent(inout) :: arr
12+
integer :: i
13+
!$omp declare target(foo)
14+
15+
!$omp parallel do
16+
do i=1,ib
17+
arr(i)=arr(i)+val
18+
end do
19+
end subroutine foo
20+
end module foo_mod
21+
22+
program hierarchical
23+
use foo_mod
24+
implicit none
25+
integer :: i, j, val
26+
integer :: a(10,10)
27+
28+
a=1
29+
val=2
30+
!$omp target enter data map(to:a)
31+
32+
!$omp target teams distribute
33+
do j=1,10
34+
call foo(10,val,a(:,j))
35+
end do
36+
37+
!$omp target update from(a)
38+
do j=1,10
39+
do i=1,10
40+
if (a(i,j)/=3) then
41+
print *, 'Error for indexes', i, j
42+
print *, 'Value is', a(i,j)
43+
stop 1
44+
end if
45+
end do
46+
end do
47+
print *, 'Success!!!'
48+
end program hierarchical

0 commit comments

Comments
 (0)