title: Is there a way to control partitioning of OpenMP parallel_for construct?
body: <p>I use OpenMP (OMP) for parallelizing a for loop. However, it seems that OMP will partition my for loop in equal interval sizes, e.g.</p>
  
  <pre><code>for( int i = 0; i &lt; n; ++i ) {
   ...
  }
  </code></pre>
  
  <p>there are <code>NUM_THREADS</code> blocks each sized <code>n/NUM_THREADS</code>. Unfortunately, I use this to parallelize a sweep over a triangular matrix, hence the last blocks have much more work to do than the first blocks. So what I really want to ask is how to perform load balancing in such a scenario. I could imagine, that <code>if ( i % THREAD_NUMBER == 0) ..</code>  would be fine (in other words, each run in the loop is assigned to a different thread). I know this is not optimal, as caching then would be corrupted, however, is there a way to control the loop partitioning with OMP?</p>