title: Pthreads in MPI
body: <p>Hi, I have written an MPI quicksort program which works like this:</p>
  
  <p>In my cluster 'Master' will divide the integer data and send these to 'Slave nodes'. Upon receiving at the Slave nodes, each slave will perform individual sorting operations and send the sorted data back to Master.
  Now my problem is I'm interested in introducing hyper-threading for the slaves.</p>
  
  <p>I have data coming from master</p>
  
  <ol>
  <li>sub (which denotes the array)</li>
  <li>count (size of an array)</li>
  </ol>
  
  <p>Now I have initialized Pthreads as where</p>
  
  <pre><code> num_threads=12.
      pthread_attr_init(&amp;attr);
     pthread_attr_setdetachstate(&amp;attr, PTHREAD_CREATE_JOINABLE);
    for (i = 0; i &lt; num_pthreads; i++) {
      if (pthread_create(&amp;thread[i], &amp;attr, new_thread, (void *) &amp;sub[i])) 
      {
         printf("error creating a new thread \n");
         exit(1);
      }
      else
      {
          printf(" threading is successful %d  at node %d \n \t ",i,rank);
      }       
  </code></pre>
  
  <p>and in a new thread function</p>
  
  <pre><code>void * new_thread(int *sub)
  {
  
      quick_sort(sub,0, count-1);
      }
      return(0);
  }
  </code></pre>
  
  <p>I don't understand whether my way is correct or not. Can anyone help me with this problem?</p>