[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / openmp / runtime / test / api / omp_get_num_threads.c
blobdaf286d1313c5c3e6fc87201a33f5a5adb7f9923
1 // RUN: %libomp-compile-and-run
2 #include <stdio.h>
3 #include "omp_testsuite.h"
5 int test_omp_get_num_threads()
7 /* checks that omp_get_num_threads is equal to the number of
8 threads */
9 int nthreads_lib;
10 int nthreads = 0;
12 nthreads_lib = -1;
14 #pragma omp parallel
16 #pragma omp critical
18 nthreads++;
19 } /* end of critical */
20 #pragma omp single
22 nthreads_lib = omp_get_num_threads ();
23 } /* end of single */
24 } /* end of parallel */
25 return (nthreads == nthreads_lib);
28 int main()
30 int i;
31 int num_failed=0;
33 for(i = 0; i < REPETITIONS; i++) {
34 if(!test_omp_get_num_threads()) {
35 num_failed++;
38 return num_failed;