Skip to content

Commit 74644bf

Browse files
authored
Cleanup fortran examples for flang-new (ROCm#1244)
1 parent 4ec22e2 commit 74644bf

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

examples/fortran/bigloop/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ endif
4545

4646
FORT =$(LLVM_INSTALL_DIR)/bin/flang
4747
LFLAGS =
48-
FFLAGS = -O3 -m64 -i8 -fopenmp
48+
FFLAGS = -O3 -fopenmp
4949

5050
# ----- Demo compile and link in one step, no object code saved
5151
$(TESTNAME): $(TESTSRC)

examples/fortran/bigloop/bigloop.f95

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ subroutine foo(a,b,c)
3535
end do
3636
end do
3737
end do
38-
!$omp end target teams distribute parallel do
38+
! !$omp end target teams distribute parallel do
3939
return
4040
end
4141

examples/fortran/declare_target/declare_target.f95

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
subroutine decrement_val(i, beta)
22
!$omp declare target
3-
integer, dimension(*), intent(out) :: beta
3+
real, dimension(*), intent(out) :: beta
44
integer, value :: i
55
beta(i) = beta(i) - 1
66
end subroutine
@@ -19,7 +19,7 @@ program main
1919
call foo(a,b,c)
2020

2121
write(6,*)"a(1)=", a(1), " a(2)=", a(2)
22-
if (a(1).ne.11 .or. a(2).ne.22) then
22+
if (a(1).ne.10 .or. a(2).ne.21) then
2323
write(6,*)"ERROR: wrong answers"
2424
stop 2
2525
endif
@@ -30,6 +30,13 @@ subroutine foo(a,b,c)
3030
parameter (nsize=1000000)
3131
real a(nsize), b(nsize), c(nsize)
3232
integer i
33+
INTERFACE
34+
SUBROUTINE decrement_val(i,beta)
35+
real, dimension(*), intent(out) :: beta
36+
integer, value :: i
37+
END SUBROUTINE
38+
END INTERFACE
39+
3340
!$omp declare target(decrement_val)
3441
!$omp target map(from:a) map(to:b,c)
3542
!$omp parallel do

examples/fortran/fortran_hip_interop/fortran_hip_interop.f95

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
program main
22

33
use omp_lib
4+
use iso_c_binding
45
implicit none
56
interface
67
subroutine fortran_callable_init(a,N) bind(c)
@@ -26,7 +27,7 @@ subroutine fortran_callable_init(a,N) bind(c)
2627

2728
!$OMP TARGET DATA MAP(tofrom:arr1) MAP(from:crr1)
2829

29-
!$OMP TARGET DATA USE_DEVICE_PTR(arr1)
30+
!$OMP TARGET DATA USE_DEVICE_ADDR(arr1)
3031
call fortran_callable_init(c_loc(arr1),nx)
3132
!$OMP END TARGET DATA
3233

0 commit comments

Comments
 (0)