/* L-30 MCS 572 Fri 30 March 2006: a second hello world with OpenMP,

   illustrating the nesting of pragmas and pragmas master and single.

   Compile with "cc_r -qsmp=omp -o hello2 hello2.c". */

#include <stdio.h>
#include <omp.h>

int main ( int argc, char *argv[] )
{
   omp_set_num_threads(8);

   #pragma omp parallel
   {
      #pragma omp master
      {
          printf("Hello from the master thread %d!\n",
                 omp_get_thread_num());
      }

      printf("Thread %d says hello.\n",omp_get_thread_num());

      #pragma omp single
      {
          printf("Only one thread %d says more...\n",
                 omp_get_thread_num());
      }

   }

   return 0;
}
