[llvm] Stop including unordered_map (NFC)
[llvm-project.git] / openmp / runtime / test / worksharing / single / omp_single_private.c
bloba27f8de21b89bc5f02bb60d2cda5ead72bbd9984
1 // RUN: %libomp-compile-and-run
2 #include <stdio.h>
3 #include "omp_testsuite.h"
5 int myit = 0;
6 #pragma omp threadprivate(myit)
7 int myresult = 0;
8 #pragma omp threadprivate(myresult)
10 int test_omp_single_private()
12 int nr_threads_in_single;
13 int result;
14 int nr_iterations;
15 int i;
17 myit = 0;
18 nr_threads_in_single = 0;
19 nr_iterations = 0;
20 result = 0;
22 #pragma omp parallel private(i)
24 myresult = 0;
25 myit = 0;
26 for (i = 0; i < LOOPCOUNT; i++) {
27 #pragma omp single private(nr_threads_in_single) nowait
29 nr_threads_in_single = 0;
30 #pragma omp flush
31 nr_threads_in_single++;
32 #pragma omp flush
33 myit++;
34 myresult = myresult + nr_threads_in_single;
37 #pragma omp critical
39 result += nr_threads_in_single;
40 nr_iterations += myit;
43 return ((result == 0) && (nr_iterations == LOOPCOUNT));
44 } /* end of check_single private */
46 int main()
48 int i;
49 int num_failed=0;
51 for(i = 0; i < REPETITIONS; i++) {
52 if(!test_omp_single_private()) {
53 num_failed++;
56 return num_failed;