Commit 4c5651ec authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Fix issues affecting CCE 10.x and 11.x when not compiling with OpenMP.

parent 2167449b
......@@ -54,6 +54,13 @@ CONTAINS
INTEGER :: i, j, n, r1
LOGICAL :: p
#if defined _CRAYFTN && ! defined _OPENMP
# if _RELEASE_MAJOR == 10 || _RELEASE_MAJOR == 11
! in non-OpenMP mode, crayftn 10 and 11 botch this function (incorrect
! index computations when strt has large absolute value
!DIR$ OPTIMIZE (-O0)
# endif
#endif
!$omp do
DO j = strt(2), ends(2)
......@@ -104,6 +111,13 @@ CONTAINS
INTENT(inout) :: accum, accum_ref
INTEGER :: i, j, k, r1, indices(3)
LOGICAL :: p
#if defined _CRAYFTN && ! defined _OPENMP
# if _RELEASE_MAJOR == 10 || _RELEASE_MAJOR == 11
! in non-OpenMP mode, crayftn 10 and 11 botch this function (incorrect
! index computations when strt has large absolute value
!DIR$ OPTIMIZE (-O0)
# endif
#endif
! since older intel compilers cannot parallelize WHERE correctly,
! use an explicit DO
!$omp do
......
......@@ -78,6 +78,29 @@ CONTAINS
msg='result of WHERE(mask) and index iteration differs')
END SUBROUTINE test_smi_equiv_1d
SUBROUTINE where_add_2d(strt, ends, mask, a, y)
INTEGER, INTENT(in) :: strt(2), ends(2)
LOGICAL, INTENT(in) :: mask(strt(1):ends(1), strt(2):ends(2))
REAL, INTENT(inout) :: a(strt(1):ends(1), strt(2):ends(2))
REAL, INTENT(in) :: y
INTEGER :: i, j
#if defined _CRAYFTN && ! defined _OPENMP
# if _RELEASE_MAJOR == 10 || _RELEASE_MAJOR == 11
! in non-OpenMP mode, crayftn 10 and 11 botch this function (incorrect
! index computations when strt has large absolute value
!DIR$ OPTIMIZE (-O0)
# endif
#endif
!$omp do
DO j = strt(2), ends(2)
DO i = strt(1), ends(1)
IF (mask(i, j)) a(i, j) = a(i, j) + y
END DO
END DO
!$omp end do nowait
END SUBROUTINE where_add_2d
SUBROUTINE test_smi_equiv_2d(idx, strt, ends, sseq, &
mask_2d, accum_2d, accum_ref_2d)
INTEGER, INTENT(in) :: strt(2), ends(2), sseq(2)
......@@ -89,13 +112,7 @@ CONTAINS
INTEGER :: i, j, n, r1, r2, iblock
LOGICAL :: p
!$omp do
DO j = strt(2), ends(2)
DO i = strt(1), ends(1)
IF (mask_2d(i, j)) accum_ref_2d(i, j) = accum_ref_2d(i, j) + 1.0
END DO
END DO
!$omp end do
CALL where_add_2d(strt, ends, mask_2d, accum_ref_2d, 1.0)
n = 2 * idx%tl_ranges
IF (sseq(1) == 1) THEN
......@@ -145,14 +162,16 @@ CONTAINS
INTEGER :: i, j, k, r1, r2, r3, n, jblock, iblock, indices(3)
LOGICAL :: p
#if defined _CRAYFTN && ! defined _OPENMP
# if _RELEASE_MAJOR == 10 || _RELEASE_MAJOR == 11
! in non-OpenMP mode, crayftn 10 and 11 botch this function (incorrect
! index computations when strt has large absolute value
!DIR$ OPTIMIZE (-O0)
# endif
#endif
!$omp do
DO k = strt(3), ends(3)
DO j = strt(2), ends(2)
DO i = strt(1), ends(1)
IF (mask(i, j, k)) accum_ref(i, j, k) = accum_ref(i, j, k) + 1.0
END DO
END DO
CALL where_add_2d(strt, ends, mask(:, :, k), accum_ref(:, :, k), 1.0)
END DO
n = 2 * idx%tl_ranges
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment