[llvm] Stop including unordered_map (NFC)
[llvm-project.git] / openmp / runtime / test / parallel / omp_parallel_firstprivate.c
blobdbee76c639ae8b7acb4b777b227e25ce2cc2f883
1 // RUN: %libomp-compile-and-run
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include "omp_testsuite.h"
6 //static int sum1 = 789;
8 int test_omp_parallel_firstprivate()
10 int sum, num_threads,sum1;
11 int known_sum;
13 sum = 0;
14 sum1=7;
15 num_threads = 0;
17 #pragma omp parallel firstprivate(sum1)
19 /*printf("sum1=%d\n",sum1);*/
20 int i;
21 #pragma omp for
22 for (i = 1; i < 1000; i++) {
23 sum1 = sum1 + i;
24 } /*end of for*/
25 #pragma omp critical
27 sum = sum + sum1;
28 num_threads++;
29 } /*end of critical*/
30 } /* end of parallel*/
31 known_sum = (999 * 1000) / 2 + 7 * num_threads;
32 return (known_sum == sum);
35 int main()
37 int i;
38 int num_failed=0;
40 for(i = 0; i < REPETITIONS; i++) {
41 if(!test_omp_parallel_firstprivate()) {
42 num_failed++;
45 return num_failed;