OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [libgomp/] [testsuite/] [libgomp.fortran/] [omp_parse1.f90] - Diff between revs 154 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 154 Rev 816
! { dg-do run }
! { dg-do run }
use omp_lib
use omp_lib
  call test_parallel
  call test_parallel
  call test_do
  call test_do
  call test_sections
  call test_sections
  call test_single
  call test_single
contains
contains
  subroutine test_parallel
  subroutine test_parallel
    integer :: a, b, c, e, f, g, i, j
    integer :: a, b, c, e, f, g, i, j
    integer, dimension (20) :: d
    integer, dimension (20) :: d
    logical :: h
    logical :: h
    a = 6
    a = 6
    b = 8
    b = 8
    c = 11
    c = 11
    d(:) = -1
    d(:) = -1
    e = 13
    e = 13
    f = 24
    f = 24
    g = 27
    g = 27
    h = .false.
    h = .false.
    i = 1
    i = 1
    j = 16
    j = 16
!$omp para&
!$omp para&
!$omp&llel &
!$omp&llel &
!$omp if (a .eq. 6) private (b, c) shared (d) private (e) &
!$omp if (a .eq. 6) private (b, c) shared (d) private (e) &
  !$omp firstprivate(f) num_threads (a - 1) first&
  !$omp firstprivate(f) num_threads (a - 1) first&
!$ompprivate(g)default (shared) reduction (.or. : h) &
!$ompprivate(g)default (shared) reduction (.or. : h) &
!$omp reduction(*:i)
!$omp reduction(*:i)
    if (i .ne. 1) h = .true.
    if (i .ne. 1) h = .true.
    i = 2
    i = 2
    if (f .ne. 24) h = .true.
    if (f .ne. 24) h = .true.
    if (g .ne. 27) h = .true.
    if (g .ne. 27) h = .true.
    e = 7
    e = 7
    b = omp_get_thread_num ()
    b = omp_get_thread_num ()
    if (b .eq. 0) j = 24
    if (b .eq. 0) j = 24
    f = b
    f = b
    g = f
    g = f
    c = omp_get_num_threads ()
    c = omp_get_num_threads ()
    if (c .gt. a - 1 .or. c .le. 0) h = .true.
    if (c .gt. a - 1 .or. c .le. 0) h = .true.
    if (b .ge. c) h = .true.
    if (b .ge. c) h = .true.
    d(b + 1) = c
    d(b + 1) = c
    if (f .ne. g .or. f .ne. b) h = .true.
    if (f .ne. g .or. f .ne. b) h = .true.
!$omp endparallel
!$omp endparallel
    if (h) call abort
    if (h) call abort
    if (a .ne. 6) call abort
    if (a .ne. 6) call abort
    if (j .ne. 24) call abort
    if (j .ne. 24) call abort
    if (d(1) .eq. -1) call abort
    if (d(1) .eq. -1) call abort
    e = 1
    e = 1
    do g = 1, d(1)
    do g = 1, d(1)
      if (d(g) .ne. d(1)) call abort
      if (d(g) .ne. d(1)) call abort
      e = e * 2
      e = e * 2
    end do
    end do
    if (e .ne. i) call abort
    if (e .ne. i) call abort
  end subroutine test_parallel
  end subroutine test_parallel
  subroutine test_do_orphan
  subroutine test_do_orphan
    integer :: k, l
    integer :: k, l
!$omp parallel do private (l)
!$omp parallel do private (l)
    do 600 k = 1, 16, 2
    do 600 k = 1, 16, 2
600   l = k
600   l = k
  end subroutine test_do_orphan
  end subroutine test_do_orphan
  subroutine test_do
  subroutine test_do
    integer :: i, j, k, l, n
    integer :: i, j, k, l, n
    integer, dimension (64) :: d
    integer, dimension (64) :: d
    logical :: m
    logical :: m
    j = 16
    j = 16
    d(:) = -1
    d(:) = -1
    m = .true.
    m = .true.
    n = 24
    n = 24
!$omp parallel num_threads (4) shared (i, k, d) private (l) &
!$omp parallel num_threads (4) shared (i, k, d) private (l) &
!$omp&reduction (.and. : m)
!$omp&reduction (.and. : m)
    if (omp_get_thread_num () .eq. 0) then
    if (omp_get_thread_num () .eq. 0) then
      k = omp_get_num_threads ()
      k = omp_get_num_threads ()
    end if
    end if
    call test_do_orphan
    call test_do_orphan
!$omp do schedule (static) firstprivate (n)
!$omp do schedule (static) firstprivate (n)
    do 200 i = 1, j
    do 200 i = 1, j
      if (i .eq. 1 .and. n .ne. 24) call abort
      if (i .eq. 1 .and. n .ne. 24) call abort
      n = i
      n = i
200   d(n) = omp_get_thread_num ()
200   d(n) = omp_get_thread_num ()
!$omp enddo nowait
!$omp enddo nowait
!$omp do lastprivate (i) schedule (static, 5)
!$omp do lastprivate (i) schedule (static, 5)
    do 201 i = j + 1, 2 * j
    do 201 i = j + 1, 2 * j
201   d(i) = omp_get_thread_num () + 1024
201   d(i) = omp_get_thread_num () + 1024
    ! Implied omp end do here
    ! Implied omp end do here
    if (i .ne. 33) m = .false.
    if (i .ne. 33) m = .false.
!$omp do private (j) schedule (dynamic)
!$omp do private (j) schedule (dynamic)
    do i = 33, 48
    do i = 33, 48
      d(i) = omp_get_thread_num () + 2048
      d(i) = omp_get_thread_num () + 2048
    end do
    end do
!$omp end do nowait
!$omp end do nowait
!$omp do schedule (runtime)
!$omp do schedule (runtime)
    do i = 49, 4 * j
    do i = 49, 4 * j
      d(i) = omp_get_thread_num () + 4096
      d(i) = omp_get_thread_num () + 4096
    end do
    end do
    ! Implied omp end do here
    ! Implied omp end do here
!$omp end parallel
!$omp end parallel
    if (.not. m) call abort
    if (.not. m) call abort
    j = 0
    j = 0
    do i = 1, 64
    do i = 1, 64
      if (d(i) .lt. j .or. d(i) .ge. j + k) call abort
      if (d(i) .lt. j .or. d(i) .ge. j + k) call abort
      if (i .eq. 16) j = 1024
      if (i .eq. 16) j = 1024
      if (i .eq. 32) j = 2048
      if (i .eq. 32) j = 2048
      if (i .eq. 48) j = 4096
      if (i .eq. 48) j = 4096
    end do
    end do
  end subroutine test_do
  end subroutine test_do
  subroutine test_sections
  subroutine test_sections
    integer :: i, j, k, l, m, n
    integer :: i, j, k, l, m, n
    i = 9
    i = 9
    j = 10
    j = 10
    k = 11
    k = 11
    l = 0
    l = 0
    m = 0
    m = 0
    n = 30
    n = 30
    call omp_set_dynamic (.false.)
    call omp_set_dynamic (.false.)
    call omp_set_num_threads (4)
    call omp_set_num_threads (4)
!$omp parallel num_threads (4)
!$omp parallel num_threads (4)
!$omp sections private (i) firstprivate (j, k) lastprivate (j) &
!$omp sections private (i) firstprivate (j, k) lastprivate (j) &
!$omp& reduction (+ : l, m)
!$omp& reduction (+ : l, m)
!$omp section
!$omp section
    i = 24
    i = 24
    if (j .ne. 10 .or. k .ne. 11 .or. m .ne. 0) l = 1
    if (j .ne. 10 .or. k .ne. 11 .or. m .ne. 0) l = 1
    m = m + 4
    m = m + 4
!$omp section
!$omp section
    i = 25
    i = 25
    if (j .ne. 10 .or. k .ne. 11) l = 1
    if (j .ne. 10 .or. k .ne. 11) l = 1
    m = m + 6
    m = m + 6
!$omp section
!$omp section
    i = 26
    i = 26
    if (j .ne. 10 .or. k .ne. 11) l = 1
    if (j .ne. 10 .or. k .ne. 11) l = 1
    m = m + 8
    m = m + 8
!$omp section
!$omp section
    i = 27
    i = 27
    if (j .ne. 10 .or. k .ne. 11) l = 1
    if (j .ne. 10 .or. k .ne. 11) l = 1
    m = m + 10
    m = m + 10
    j = 271
    j = 271
!$omp end sections nowait
!$omp end sections nowait
!$omp sections lastprivate (n)
!$omp sections lastprivate (n)
!$omp section
!$omp section
    n = 6
    n = 6
!$omp section
!$omp section
    n = 7
    n = 7
!$omp endsections
!$omp endsections
!$omp end parallel
!$omp end parallel
    if (j .ne. 271 .or. l .ne. 0) call abort
    if (j .ne. 271 .or. l .ne. 0) call abort
    if (m .ne. 4 + 6 + 8 + 10) call abort
    if (m .ne. 4 + 6 + 8 + 10) call abort
    if (n .ne. 7) call abort
    if (n .ne. 7) call abort
  end subroutine test_sections
  end subroutine test_sections
  subroutine test_single
  subroutine test_single
    integer :: i, j, k, l
    integer :: i, j, k, l
    logical :: m
    logical :: m
    i = 200
    i = 200
    j = 300
    j = 300
    k = 400
    k = 400
    l = 500
    l = 500
    m = .false.
    m = .false.
!$omp parallel num_threads (4), private (i, j), reduction (.or. : m)
!$omp parallel num_threads (4), private (i, j), reduction (.or. : m)
    i = omp_get_thread_num ()
    i = omp_get_thread_num ()
    j = omp_get_thread_num ()
    j = omp_get_thread_num ()
!$omp single private (k)
!$omp single private (k)
    k = 64
    k = 64
!$omp end single nowait
!$omp end single nowait
!$omp single private (k) firstprivate (l)
!$omp single private (k) firstprivate (l)
    if (i .ne. omp_get_thread_num () .or. i .ne. j) then
    if (i .ne. omp_get_thread_num () .or. i .ne. j) then
      j = -1
      j = -1
    else
    else
      j = -2
      j = -2
    end if
    end if
    if (l .ne. 500) j = -1
    if (l .ne. 500) j = -1
    l = 265
    l = 265
!$omp end single copyprivate (j)
!$omp end single copyprivate (j)
    if (i .ne. omp_get_thread_num () .or. j .ne. -2) m = .true.
    if (i .ne. omp_get_thread_num () .or. j .ne. -2) m = .true.
!$omp endparallel
!$omp endparallel
    if (m) call abort
    if (m) call abort
  end subroutine test_single
  end subroutine test_single
end
end
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.