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
synchronization
reduction
tree_reduce.c
Go to the documentation of this file.
1
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
2
// RUN: %libomp-compile -DNOWAIT && %libomp-run | %sort-threads | FileCheck %s
3
// REQUIRES: ompt
4
// UNSUPPORTED: gcc
5
#include "
callback.h
"
6
#include <omp.h>
7
8
#ifdef NOWAIT
9
#define FOR_CLAUSE nowait
10
#else
11
#define FOR_CLAUSE
12
#endif
13
14
int
main
() {
15
int
sum
= 0,
a
= 0,
b
= 0;
16
int
i
;
17
#pragma omp parallel num_threads(5)
18
// for 32-bit architecture we need at least 3 variables to trigger tree
19
#pragma omp for reduction(+ : sum, a, b) FOR_CLAUSE
20
for
(
i
= 0;
i
< 10000;
i
++) {
21
a
=
b
=
sum
+=
i
;
22
}
23
24
25
printf(
"%i\n"
,
sum
);
26
// CHECK: 0: NULL_POINTER=[[NULL:.*$]]
27
28
// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin:
29
// CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]]
30
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin:
31
// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID:[0-9]+]]
32
33
// order and distribution to threads not determined
34
// CHECK: {{^}}{{[0-f]+}}: ompt_event_reduction_begin:
35
// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}
36
// CHECK: {{^}}{{[0-f]+}}: ompt_event_reduction_end:
37
// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}
38
// CHECK: {{^}}{{[0-f]+}}: ompt_event_reduction_begin:
39
// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}
40
// CHECK: {{^}}{{[0-f]+}}: ompt_event_reduction_end:
41
// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}
42
// CHECK: {{^}}{{[0-f]+}}: ompt_event_reduction_begin:
43
// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}
44
// CHECK: {{^}}{{[0-f]+}}: ompt_event_reduction_end:
45
// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}
46
// CHECK: {{^}}{{[0-f]+}}: ompt_event_reduction_begin:
47
// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}
48
// CHECK: {{^}}{{[0-f]+}}: ompt_event_reduction_end:
49
// CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}
50
51
return
0;
52
}
callback.h
b
int b
Definition:
kmp_set_dispatch_buf.c:27
i
#define i
Definition:
kmp_stub.cpp:87
a
int a
Definition:
llvm-issue-80664.c:20
sum
int sum
Definition:
omp_for_schedule_runtime.c:19
main
int main()
Definition:
tree_reduce.c:14
Generated on Mon Jun 16 2025 04:18:24 for LLVM OpenMP by
1.9.6