LLVM OpenMP
20.0.0git
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
c
d
e
g
h
i
m
n
p
r
s
t
u
Functions
c
d
e
g
i
m
n
p
r
s
u
Variables
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
w
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
_
a
b
c
d
e
i
k
l
m
n
o
p
r
t
u
Enumerations
_
b
c
d
f
k
l
n
o
s
t
Enumerator
_
a
b
c
d
e
f
k
l
n
o
p
r
s
t
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
runtime
test
ompt
cancel
cancel_worksharing.c
Go to the documentation of this file.
1
// RUN: %libomp-compile && env OMP_CANCELLATION=true %libomp-run | %sort-threads | FileCheck %s
2
// REQUIRES: ompt
3
// Current GOMP interface implementation does not support cancellation; icc 16 does not distinguish between sections and loops
4
// XFAIL: icc-16
5
6
#include "
callback.h
"
7
#include <unistd.h>
8
9
int
main
()
10
{
11
int
condition
=0;
12
#pragma omp parallel num_threads(2)
13
{
14
int
x = 0;
15
int
i
;
16
#pragma omp for
17
for
(
i
= 0;
i
< 2;
i
++)
18
{
19
if
(
i
== 0)
20
{
21
x++;
22
OMPT_SIGNAL
(
condition
);
23
#pragma omp cancel for
24
}
25
else
26
{
27
x++;
28
OMPT_WAIT
(
condition
,1);
29
delay
(10000);
30
#pragma omp cancellation point for
31
}
32
}
33
}
34
#pragma omp parallel num_threads(2)
35
{
36
#pragma omp sections
37
{
38
#pragma omp section
39
{
40
OMPT_SIGNAL
(
condition
);
41
#pragma omp cancel sections
42
}
43
#pragma omp section
44
{
45
OMPT_WAIT
(
condition
,2);
46
delay
(10000);
47
#pragma omp cancellation point sections
48
}
49
}
50
}
51
52
53
// Check if libomp supports the callbacks for this test.
54
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task'
55
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_cancel'
56
57
// CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
58
// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_initial_task_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, actual_parallelism=1, index=1, flags=1
59
60
// cancel for and sections
61
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_cancel: task_data=[[TASK_ID:[0-9]+]], flags=ompt_cancel_loop|ompt_cancel_activated=20, codeptr_ra={{0x[0-f]*}}
62
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_cancel: task_data=[[TASK_ID:[0-9]+]], flags=ompt_cancel_sections|ompt_cancel_{{activated=18|detected=34}}, codeptr_ra={{0x[0-f]*}}
63
// CHECK: {{^}}[[OTHER_THREAD_ID:[0-9]+]]: ompt_event_cancel: task_data=[[TASK_ID:[0-9]+]], flags=ompt_cancel_loop|ompt_cancel_detected=36, codeptr_ra={{0x[0-f]*}}
64
// CHECK: {{^}}[[OTHER_THREAD_ID:[0-9]+]]: ompt_event_cancel: task_data=[[TASK_ID:[0-9]+]], flags=ompt_cancel_sections|ompt_cancel_{{activated=18|detected=34}}, codeptr_ra={{0x[0-f]*}}
65
66
return
0;
67
}
callback.h
main
int main()
Definition:
cancel_worksharing.c:9
condition
int condition
Definition:
interoperability.cpp:15
i
#define i
Definition:
kmp_stub.cpp:87
OMPT_WAIT
#define OMPT_WAIT(s, v)
Definition:
ompt-signal.h:20
delay
#define delay(t)
Definition:
ompt-signal.h:6
OMPT_SIGNAL
#define OMPT_SIGNAL(s)
Definition:
ompt-signal.h:12
Generated on Thu Mar 13 2025 07:38:13 for LLVM OpenMP by
1.9.6