#include <omp.h>
#define CHUNKSIZE 1 
#define N 10
main () { 

int i, tid, chunk, nthreads, nprocs; 
float a[N], b[N], c[N], sum; 

/* Some initializations */ 
for (i=0; i < N; i++) 
  a[i] = b[i] = i*1.0; 
chunk = CHUNKSIZE; 
sum = 0.;

nthreads = 2;
omp_set_num_threads(nthreads); 
#pragma omp parallel shared(a,b,c,chunk) private(i,tid) 
  { 
   tid = omp_get_thread_num(); 
   #pragma omp for schedule(static,chunk) nowait 
    for (i=0; i < N; i++) {
      c[i] = a[i]*b[i];
      sum = sum + c[i];
    }

   printf("Hello from thread = %d\n", tid); 

   if (tid == 0) 
    { 
      nthreads = omp_get_num_threads(); 
      printf("Number of threads = %d\n", nthreads); 
      nprocs = omp_get_num_procs(); 
      printf("Number of procs = %d\n", nprocs); 
      printf("Dot Product is = %f\n", sum); 
    }

   } /* end of parallel section */ 

