LLVM OpenMP
runtime
test
tasking
omp_untied_taskloop.f90
Go to the documentation of this file.
1
! An untied taskloop leaves its pattern task untied. The runtime starts that
2
! pattern task and finishes it immediately without executing the loop body, so
3
! it briefly becomes the thread's current task and needs td_last_tied
4
! initialized like any other untied task.
5
!
6
! This is written in Fortran on purpose: flang honours the untied clause on
7
! taskloop, whereas clang currently drops it and emits a tied pattern task, so
8
! the path is not reachable from C.
9
!
10
! It does not fault on its own -- the task scheduling constraint only reads
11
! td_last_tied when a thread's deque is full -- so this is coverage rather than
12
! a reproducer: in an assertions-enabled build it exercises the
13
! KMP_DEBUG_ASSERT() in __kmp_task_start() that guards the initialization.
14
15
! RUN: %flang %flags %openmp_flags %s -o %t.exe
16
! RUN: %t.exe | FileCheck %s
17
18
program
untied_taskloop
19
implicit none
20
integer
,
parameter
:: n = 2048, reps = 10
21
integer
:: a(n),
i
, r
22
23
a = 0
24
25
do
r = 1, reps
26
!$omp parallel
27
!$omp single
28
!$omp taskloop untied grainsize(7)
29
do
i
= 1, n
30
a(
i
) = a(
i
) + 1
31
end do
32
!$omp end taskloop
33
34
!$omp taskloop untied num_tasks(13)
35
do
i
= 1, n
36
a(
i
) = a(
i
) + 1
37
end do
38
!$omp end taskloop
39
!$omp end single
40
!$omp end parallel
41
end do
42
43
if
(any(a /= 2 * reps))
then
44
print *,
'failed'
45
else
46
print *,
'passed'
47
end if
48
end program
49
50
! CHECK: passed
i
#define i
Definition
kmp_stub.cpp:88
untied_taskloop
program untied_taskloop
Definition
omp_untied_taskloop.f90:18
Generated on
for LLVM OpenMP by
1.14.0