title: Task based programming : #pragma omp task versus #pragma omp parallel for
body: <p>Considering :</p>
  
  <pre><code>    void saxpy_worksharing(float* x, float* y, float a, int N) {
        #pragma omp parallel for
        for (int i = 0; i &lt; N; i++) {
           y[i] = y[i]+a*x[i];
        }
      }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>    void saxpy_tasks(float* x, float* y, float a, int N) {
        #pragma omp parallel
        {
           for (int i = 0; i &lt; N; i++) {
           #pragma omp task
           {
             y[i] = y[i]+a*x[i];
           }
        }
     }
  </code></pre>
  
  <p>What is the difference using tasks and the omp parallel directive ? Why can we write recursive algorithms such as merge sort with tasks, but not with worksharing ?</p>