aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/task-in-explicit-1.f90
blob: b6fa21b2c22b8b0c5114b880febc32aa8b58f997 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
! { dg-do run }

program main
  use omp_lib
  implicit none
  integer :: i

  if (omp_in_explicit_task ()) &
    error stop
  !$omp task
  if (.not. omp_in_explicit_task ()) &
    error stop
  !$omp end task

  !$omp task final (.true.)
    if (.not. omp_in_explicit_task ()) &
      error stop
    !$omp task
    if (.not. omp_in_explicit_task ()) &
      error stop
    !$omp end task
  !$omp end task

  !$omp parallel
    if (omp_in_explicit_task ()) &
      error stop
    !$omp task if (.false.)
        if (.not. omp_in_explicit_task ()) &
          error stop
        !$omp task if (.false.)
          if (.not. omp_in_explicit_task ()) &
            error stop
        !$omp end task
    !$omp end task
    !$omp task final (.true.)
      if (.not. omp_in_explicit_task ()) &
        error stop
    !$omp end task
    !$omp barrier
    if (omp_in_explicit_task ()) &
      error stop
    !$omp taskloop num_tasks (24)
    do i = 1, 32
      if (.not. omp_in_explicit_task ()) &
        error stop
    end do
    !$omp masked
    !$omp task
    if (.not. omp_in_explicit_task ()) &
      error stop
    !$omp end task
    !$omp end masked
    !$omp barrier
    if (omp_in_explicit_task ()) &
      error stop
  !$omp end parallel

  !$omp target
    if (omp_in_explicit_task ()) &
      error stop
    !$omp task if (.false.)
    if (.not. omp_in_explicit_task ()) &
      error stop
    !$omp end task
    !$omp task
    if (.not. omp_in_explicit_task ()) &
      error stop
    !$omp end task
  !$omp end target

  !$omp target teams
    !$omp distribute
    do i = 1, 4
      if (omp_in_explicit_task ()) then
        error stop
      else
          !$omp parallel
            if (omp_in_explicit_task ()) &
              error stop
            !$omp task
            if (.not. omp_in_explicit_task ()) &
              error stop
            !$omp end task
            !$omp barrier
            if (omp_in_explicit_task ()) &
              error stop
          !$omp end parallel
      end if
    end do
  !$omp end target teams

  !$omp teams
    !$omp distribute
    do i = 1, 4
      if (omp_in_explicit_task ()) then
        error stop
      else
          !$omp parallel
            if (omp_in_explicit_task ()) &
              error stop
            !$omp task
            if (.not. omp_in_explicit_task ()) &
              error stop
            !$omp end task
            !$omp barrier
            if (omp_in_explicit_task ()) &
              error stop
          !$omp end parallel
      end if
    end do
    !$omp end distribute
  !$omp end teams
end