Home | History | Annotate | Download | only in jni
      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 #include <omp.h>
      4 
      5 int main(int argc, char *argv[])
      6 {
      7     int iam = 0, np = 1;
      8 
      9     if (!getenv("OMP_NUM_THREADS"))
     10         omp_set_num_threads(4);
     11 
     12   #pragma omp parallel default(shared) private(iam, np)
     13     {
     14       #if defined(_OPENMP)
     15         np = omp_get_num_threads();
     16         iam = omp_get_thread_num();
     17       #endif
     18         printf("Hello from thread %d out of %d\n", iam, np);
     19     }
     20 
     21     return 0;
     22 }
     23