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
master
omp_master_3.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_master_3
()
6
{
7
int
nthreads;
8
int
executing_thread;
9
int
tid_result = 0;
/* counts up the number of wrong thread no. for
10
the master thread. (Must be 0) */
11
nthreads = 0;
12
executing_thread = -1;
13
14
#pragma omp parallel
15
{
16
#pragma omp master
17
{
18
int
tid = omp_get_thread_num();
19
if
(tid != 0) {
20
#pragma omp critical
21
{ tid_result++; }
22
}
23
#pragma omp critical
24
{
25
nthreads++;
26
}
27
executing_thread = omp_get_thread_num ();
28
}
/* end of master*/
29
}
/* end of parallel*/
30
return
((nthreads == 1) && (executing_thread == 0) && (tid_result == 0));
31
}
32
33
int
main
()
34
{
35
int
i
;
36
int
num_failed=0;
37
38
for
(
i
= 0;
i
<
REPETITIONS
;
i
++) {
39
if
(!
test_omp_master_3
()) {
40
num_failed++;
41
}
42
}
43
return
num_failed;
44
}
i
#define i
Definition:
kmp_stub.cpp:87
test_omp_master_3
int test_omp_master_3()
Definition:
omp_master_3.c:5
main
int main()
Definition:
omp_master_3.c:33
omp_testsuite.h
REPETITIONS
#define REPETITIONS
Definition:
omp_testsuite.h:13
Generated on Fri Jun 13 2025 09:43:49 for LLVM OpenMP by
1.9.6