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
parallel
omp_parallel_shared.c
Go to the documentation of this file.
1
// RUN: %libomp-compile-and-run
2
#include <stdio.h>
3
#include "
omp_testsuite.h
"
4
5
int
test_omp_parallel_shared
()
6
{
7
int
i
;
8
int
sum
;
9
int
known_sum;
10
11
sum
= 0;
12
known_sum = (
LOOPCOUNT
* (
LOOPCOUNT
+ 1)) / 2 ;
13
14
#pragma omp parallel private(i) shared(sum)
15
{
16
17
int
mysum = 0;
18
#pragma omp for
19
for
(
i
= 1;
i
<=
LOOPCOUNT
;
i
++) {
20
mysum = mysum +
i
;
21
}
22
#pragma omp critical
23
{
24
sum
=
sum
+ mysum;
25
}
26
27
28
}
29
if
(known_sum !=
sum
) {
30
fprintf(stderr,
"KNOWN_SUM = %d; SUM = %d\n"
, known_sum,
sum
);
31
}
32
return
(known_sum ==
sum
);
33
}
34
35
int
main
()
36
{
37
int
i
;
38
int
num_failed=0;
39
40
for
(
i
= 0;
i
<
REPETITIONS
;
i
++) {
41
if
(!
test_omp_parallel_shared
()) {
42
num_failed++;
43
}
44
}
45
return
num_failed;
46
}
i
#define i
Definition:
kmp_stub.cpp:87
sum
int sum
Definition:
omp_for_schedule_runtime.c:19
test_omp_parallel_shared
int test_omp_parallel_shared()
Definition:
omp_parallel_shared.c:5
main
int main()
Definition:
omp_parallel_shared.c:35
omp_testsuite.h
LOOPCOUNT
#define LOOPCOUNT
Definition:
omp_testsuite.h:12
REPETITIONS
#define REPETITIONS
Definition:
omp_testsuite.h:13
Generated on Mon Jun 9 2025 17:00:15 for LLVM OpenMP by
1.9.6