OP2/PyOP2 — pull request #89 by wence- (2012-10-16 15:23:28+00:00)
Title: Cuda backend

This implements most of a CUDA backend. The things that are missing are:

- Iteration spaces (for vectors and matrices)
- Matrix support full stop.

This is enough to run the classic OP2 demos (airfoil, aero and jacobi), but not enough for all our fancy ffc stuff.

In addition to this, I've reworked as much of the common code in the opencl and cuda backends into a shared "device" layer. Hence wanting to land this before the matrix support is included.

This gets you:

- more obvious Plan caching
- we intercept __new__ when initialising a Plan and just return an old object if it matches

- a change to the way Dats are marked as dirty. There are now 5 states

1. DEVICE_UNALLOCATED # no space allocated on device yet
2. HOST # space on device, but host data is current
3. DEVICE # space on device and device data is current
4. HOST_UNALLOCATED # no space on host (for temporary dats)
5. BOTH # both host and device are allocated and current

I've done a little bit of pulling the templates for cuda and opencl together as well, but not much, because I suspect the matrix support will look different in the two cases.