[llvm] Stop including unordered_map (NFC)
[llvm-project.git] / openmp / runtime / test / parallel / omp_parallel_default.c
blob0a8e09e66448eaffdfb9627c62948fdf9d5abd24
1 // RUN: %libomp-compile-and-run
2 #include <stdio.h>
3 #include "omp_testsuite.h"
5 int test_omp_parallel_default()
7 int i;
8 int sum;
9 int mysum;
10 int known_sum;
11 sum =0;
12 known_sum = (LOOPCOUNT * (LOOPCOUNT + 1)) / 2 ;
14 #pragma omp parallel default(shared) private(i) private(mysum)
16 mysum = 0;
17 #pragma omp for
18 for (i = 1; i <= LOOPCOUNT; i++) {
19 mysum = mysum + i;
21 #pragma omp critical
23 sum = sum + mysum;
24 } /* end of critical */
25 } /* end of parallel */
26 if (known_sum != sum) {
27 fprintf(stderr, "KNOWN_SUM = %d; SUM = %d\n", known_sum, sum);
29 return (known_sum == sum);
32 int main()
34 int i;
35 int num_failed=0;
37 for(i = 0; i < REPETITIONS; i++) {
38 if(!test_omp_parallel_default()) {
39 num_failed++;
42 return num_failed;