LLVM OpenMP
20.0.0git
runtime
test
master
omp_master.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
()
6
{
7
int
nthreads;
8
int
executing_thread;
9
10
nthreads = 0;
11
executing_thread = -1;
12
13
#pragma omp parallel
14
{
15
#pragma omp master
16
{
17
#pragma omp critical
18
{
19
nthreads++;
20
}
21
executing_thread = omp_get_thread_num();
22
}
/* end of master*/
23
}
/* end of parallel*/
24
return
((nthreads == 1) && (executing_thread == 0));
25
}
26
27
int
main
()
28
{
29
int
i
;
30
int
num_failed=0;
31
32
for
(
i
= 0;
i
<
REPETITIONS
;
i
++) {
33
if
(!
test_omp_master
()) {
34
num_failed++;
35
}
36
}
37
return
num_failed;
38
}
i
#define i
Definition:
kmp_stub.cpp:87
test_omp_master
int test_omp_master()
Definition:
omp_master.c:5
main
int main()
Definition:
omp_master.c:27
omp_testsuite.h
REPETITIONS
#define REPETITIONS
Definition:
omp_testsuite.h:13
Generated on Wed Feb 5 2025 10:57:20 for LLVM OpenMP by
1.9.6