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
critical
omp_critical_with_hint.c
Go to the documentation of this file.
1
// RUN: %libomp-compile-and-run
2
// critial with hint was introduced with icc 19
3
// UNSUPPORTED: icc-18
4
5
#include <stdio.h>
6
#include <omp.h>
7
#include "
omp_testsuite.h
"
8
9
int
test_omp_critical
(
int
iter) {
10
int
sum
;
11
int
known_sum;
12
13
sum
= 0;
14
#pragma omp parallel
15
{
16
int
mysum = 0;
17
int
i
;
18
#pragma omp for
19
for
(
i
= 0;
i
< 1000;
i
++)
20
mysum = mysum +
i
;
21
22
switch
(iter % 4) {
23
case
0:
24
#pragma omp critical(c0) hint(omp_sync_hint_uncontended)
25
sum
= mysum +
sum
;
26
break
;
27
case
1:
28
#pragma omp critical(c1) hint(omp_sync_hint_contended)
29
sum
= mysum +
sum
;
30
break
;
31
case
2:
32
#pragma omp critical(c2) hint(omp_sync_hint_nonspeculative)
33
sum
= mysum +
sum
;
34
break
;
35
case
3:
36
#pragma omp critical(c3) hint(omp_sync_hint_speculative)
37
sum
= mysum +
sum
;
38
break
;
39
default
:;
40
}
41
}
42
known_sum = 999 * 1000 / 2;
43
return
(known_sum ==
sum
);
44
}
45
46
int
main
() {
47
int
i
;
48
int
num_failed = 0;
49
50
for
(
i
= 0;
i
< 4 *
REPETITIONS
;
i
++) {
51
if
(!
test_omp_critical
(
i
)) {
52
num_failed++;
53
}
54
}
55
return
num_failed;
56
}
i
#define i
Definition:
kmp_stub.cpp:87
test_omp_critical
int test_omp_critical()
Definition:
omp_critical.c:5
main
int main()
Definition:
omp_critical_with_hint.c:46
sum
int sum
Definition:
omp_for_schedule_runtime.c:19
omp_testsuite.h
REPETITIONS
#define REPETITIONS
Definition:
omp_testsuite.h:13
Generated on Wed Jul 2 2025 19:34:03 for LLVM OpenMP by
1.9.6