title: Unrolling a trivially parallelizable for loop in python with CUDA
body: <p>I have a for loop in python that I want to unroll onto a GPU.  I imagine there has to be a simple solution but I haven't found one yet.</p>
  
  <p>Our function loops over elements in a numpy array and does some math storing the result in another numpy array. Each iteration adds some to this result array. A possible large simplification of our code might look something like this:</p>
  
  <pre><code>import numpy as np
  
  a = np.arange(100)
  out = np.array([0, 0])
  for x in xrange(a.shape[0]):
    out[0] += a[x]
    out[1] += a[x]/2.0
  </code></pre>
  
  <p>How can I unroll a loop like this in Python to run on a GPU?</p>