title: Use Thust OMP to parallelize a Monte Carlo on CPU
body: <p>The goal is to parallelize a Monte Carlo process using thrust::omp</p>
  
  <pre><code>int main()
  {
    unsigned Nsimulations = 1000;
    // construct some objects here that will be required for Monte Carlo
    A a;
    B b;
    C c;
  
    /*
     * use thrust::omp to run the simulation Nsimulation times
     * and write a custom reduction function (a sum for objects of type R)
     */
  }
  
  // this is the Monte Carlo function - it needs the global variables a, b, c
  // passed by reference because they are very large; the return type is R
  R monteCarlo(A&amp; a, B&amp; b, C&amp; c)
  {
     // something supercomplicated here
     return r;
  }
  </code></pre>
  
  <p>I need to know:</p>
  
  <ol>
  <li>if/how can I access the global variables a, b, c (read only so no race condition problems here)</li>
  <li>how to set the number of threads (Nsimulations is in the thousands maybe more, so I wouldn't want an overkill for that.</li>
  <li>I want to run the monteCarlo function Nsimulation times and possibly store them in a vector and eventually either a thrust reduction or a serial reduction as this is not the time consuming part. </li>
  </ol>