<div dir="ltr"><div><div><div><div>HI<br><br></div>I am new in Open MP and willing to learn . I am reading the Open MP documentation and this tutorial <br><br><a href="https://computing.llnl.gov/tutorials/openMP/exercise.html" target="_blank">https://computing.llnl.gov/tutorials/openMP/exercise.html</a><br><br>I
 am really new to parallel programming , I have been searching over 
diferent examples and at the end I am trying to create a simple loop 
faster in omp than without, here is my code: <br><br> #include <omp.h>                                                                <br> #include <stdio.h>                                                              <br> #define N     100000                                                            <br>                                                                                  <br>  main ()                                                                         <br>  {                                                                               <br>                                                                                  <br>      int i;                                                                      <br>      float a[N], b[N], c[N];                                                     <br>                                                                                  <br>      /* Some initializations */                                                  <br>      for (i=0; i < N; i++)                                                       <br>            a[i] = b[i] = i * 1.0;                                                <br>                                                                                  <br>      double start = omp_get_wtime();                                             <br>                                                                                  <br>      omp_set_dynamic(0);                                                         <br>      omp_set_num_threads(4);                                                     <br>                                                                                  <br>      #pragma omp parallel shared(a,b,c) private(i)                               <br>        {                                                                         <br>                                                                                  <br>              #pragma omp for schedule(static)                                    <br>              for (i=0; i < N; i++)                                               <br>                      c[i] = a[i] + b[i];                                         <br>                                                                                  <br>                }  /* end of parallel section */                                  <br>                                                                                  <br>      double end = omp_get_wtime();                                               <br>                                                                                  <br>      printf("%f\n",start);                                                       <br>      printf("%f\n",end);                                                         <br>      printf("%f\n",end - start);                                                 <br>                                                                                  <br>  }                                                    <br><br></div>Same
 code but with out the #pragma sections , the problem is that is not 
always faster than serial code, some times serial code is even faster . <br><br></div>Any
 clue is more than welcome, if this is not he mailing list to post this 
please tell me. I am really interested to lear Open MP <br><br></div>Thanks a lot and regards<div class=""><div id=":1k4" class="" tabindex="0"><img class="" src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif"></div></div></div>