title: Easy parallelization of numpy.apply_along_axis()?
body: <p>How could the application of a function to the elements of a NumPy array through <code>numpy.apply_along_axis()</code> be parallelized so as to take advantage of multiple cores? This seems to be a natural thing to do, in the common case where all the calls to the function being applied are independent.</p>
  
  <p>In my particular case—if this matters—, the axis of application is axis 0: <code>np.apply_along_axis(func, axis=0, arr=param_grid)</code> (<code>np</code> being NumPy).</p>
  
  <p>I had a quick look at <strong>Numba</strong>, but I can't seem to get this parallelization, with a loop like:</p>
  
  <pre><code>@numba.jit(parallel=True)
  result = np.empty(shape=params.shape[1:])
  for index in np.ndindex(*result.shape)):  # All the indices of params[0,...]
      result[index] = func(params[(slice(None),) + index])  # Applying func along axis 0
  </code></pre>
  
  <p>There is also apparently a <strong>compilation option in NumPy</strong> for parallelization through OpenMP, but it does not seem to be accessible through MacPorts.</p>
  
  <p>One can also think of maybe cutting the array in a few pieces and using <strong>threads</strong> (so as to avoid copying the data) and applying the function on each piece in parallel. This is more complex than what I am looking for (and might not work if the Global Interpreter Lock is not released enough).</p>
  
  <p>It would be very nice to be able to use multiple cores in a simple way for simple parallelizable tasks like applying a function to all the elements of an array (which is essentially what is needed here, with the small complication that function <code>func()</code> takes a 1D array of parameters).</p>