Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ program rt003_reduction
iarr = (/ 258, 290, 320, 258 /)

imax_result = -huge(imax_result)
!$omp target
!$omp teams loop collapse(1) default(shared) private(i) reduction(MAX: imax_result)
!$omp target teams loop collapse(1) default(shared) private(i) reduction(MAX: imax_result)
do i = 1, n, 1
imax_result = max(imax_result, iarr(i))
end do
!$omp end teams loop
!$omp end target
!$omp end target teams loop

write(*,'(a,i0,a,i0)') "Test 1 int MAX (n=4): result=", imax_result, " expected=", 320
if (imax_result /= 320) then
Expand All @@ -47,13 +45,11 @@ program rt003_reduction
iarr(512) = 99999

imax_result = -huge(imax_result)
!$omp target
!$omp teams loop collapse(1) default(shared) private(i) reduction(MAX: imax_result)
!$omp target teams loop collapse(1) default(shared) private(i) reduction(MAX: imax_result)
do i = 1, n, 1
imax_result = max(imax_result, iarr(i))
end do
!$omp end teams loop
!$omp end target
!$omp end target teams loop

write(*,'(a,i0,a,i0)') "Test 2 int MAX (n=1024): result=", imax_result, " expected=", 99999
if (imax_result /= 99999) then
Expand All @@ -75,13 +71,11 @@ program rt003_reduction
iarr(100) = -42

imin_result = huge(imin_result)
!$omp target
!$omp teams loop collapse(1) default(shared) private(i) reduction(MIN: imin_result)
!$omp target teams loop collapse(1) default(shared) private(i) reduction(MIN: imin_result)
do i = 1, n, 1
imin_result = min(imin_result, iarr(i))
end do
!$omp end teams loop
!$omp end target
!$omp end target teams loop

write(*,'(a,i0,a,i0)') "Test 3 int MIN (n=256): result=", imin_result, " expected=", -42
if (imin_result /= -42) then
Expand All @@ -102,13 +96,11 @@ program rt003_reduction
end do

isum_result = 0
!$omp target
!$omp teams loop collapse(1) default(shared) private(i) reduction(+: isum_result)
!$omp target teams loop collapse(1) default(shared) private(i) reduction(+: isum_result)
do i = 1, n, 1
isum_result = isum_result + iarr(i)
end do
!$omp end teams loop
!$omp end target
!$omp end target teams loop

write(*,'(a,i0,a,i0)') "Test 4 int SUM (n=100): result=", isum_result, " expected=", 5050
if (isum_result /= 5050) then
Expand All @@ -130,13 +122,11 @@ program rt003_reduction
darr(256) = 9999.0d0

dmax_result = -huge(dmax_result)
!$omp target
!$omp teams loop collapse(1) default(shared) private(i) reduction(MAX: dmax_result)
!$omp target teams loop collapse(1) default(shared) private(i) reduction(MAX: dmax_result)
do i = 1, n, 1
dmax_result = max(dmax_result, darr(i))
end do
!$omp end teams loop
!$omp end target
!$omp end target teams loop

write(*,'(a,f12.2,a,f12.2)') "Test 5 dp MAX (n=512): result=", dmax_result, " expected=", 9999.0d0
if (abs(dmax_result - 9999.0d0) > 1.0d-6) then
Expand All @@ -158,13 +148,11 @@ program rt003_reduction
darr(300) = -7777.0d0

dmin_result = huge(dmin_result)
!$omp target
!$omp teams loop collapse(1) default(shared) private(i) reduction(MIN: dmin_result)
!$omp target teams loop collapse(1) default(shared) private(i) reduction(MIN: dmin_result)
do i = 1, n, 1
dmin_result = min(dmin_result, darr(i))
end do
!$omp end teams loop
!$omp end target
!$omp end target teams loop

write(*,'(a,f12.2,a,f12.2)') "Test 6 dp MIN (n=512): result=", dmin_result, " expected=", -7777.0d0
if (abs(dmin_result - (-7777.0d0)) > 1.0d-6) then
Expand All @@ -185,13 +173,11 @@ program rt003_reduction
end do

dsum_result = 0.0d0
!$omp target
!$omp teams loop collapse(1) default(shared) private(i) reduction(+: dsum_result)
!$omp target teams loop collapse(1) default(shared) private(i) reduction(+: dsum_result)
do i = 1, n, 1
dsum_result = dsum_result + darr(i)
end do
!$omp end teams loop
!$omp end target
!$omp end target teams loop

write(*,'(a,f12.2,a,f12.2)') "Test 7 dp SUM (n=1000): result=", dsum_result, " expected=", 1000.0d0
if (abs(dsum_result - 1000.0d0) > 1.0d-6) then
Expand All @@ -210,15 +196,13 @@ program rt003_reduction
iarr = (/ 258, 290, 320, 258 /)

imax_result = -huge(imax_result)
!$omp target
!$omp teams loop collapse(1) default(shared) private(i) reduction(MAX: imax_result)
!$omp target teams loop collapse(1) default(shared) private(i) reduction(MAX: imax_result)
do i = 1, n, 1
if (iarr(i) > 0) then
imax_result = max(imax_result, iarr(i))
end if
end do
!$omp end teams loop
!$omp end target
!$omp end target teams loop

write(*,'(a,i0,a,i0)') "Test 8 int MAX cond (n=4): result=", imax_result, " expected=", 320
if (imax_result /= 320) then
Expand Down
1 change: 0 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,6 @@ add_test(NAME OpenMP_Language_Constructs_Fortran_Reduction_Array COMMAND ../open
set_property(TEST OpenMP_Language_Constructs_Fortran_Reduction_Array PROPERTY PASS_REGULAR_EXPRESSION "Form 1 \\(whole array\\) : ce\\(1\\) = 1000.000000000000 ce\\(2\\) = 1000.000000000000")
set_property(TEST OpenMP_Language_Constructs_Fortran_Reduction_Array PROPERTY SKIP_REGULAR_EXPRESSION "module spider")

# Expected failure -- not implemented in amdflang-new yet
add_test(NAME OpenMP_Language_Constructs_Fortran_Reduction_Array_Min_Max_Sum COMMAND ../openmp_language_constructs_fortran_2_reduction_array_min_max_sum.sh )
set_property(TEST OpenMP_Language_Constructs_Fortran_Reduction_Array_Min_Max_Sum PROPERTY PASS_REGULAR_EXPRESSION "ALL TESTS PASSED")
set_property(TEST OpenMP_Language_Constructs_Fortran_Reduction_Array_Min_Max_Sum PROPERTY SKIP_REGULAR_EXPRESSION "module spider")
Expand Down