This document specifies an object as implementing the buffer interface by having a number of attributes and methods. If an implementation chooses to implement the buffer interface as a temporary view, the way to obtain the object implementing the BufferInterface is implementation-defined. The user may call BufferInterface.release() to explicitly release any resources associated with the view.
OpenCL: An object that has a int_ptr attribute which is a int representing the cl_mem pointer.
CUDA: An object that is castable to an int representing the numerical value of the CUDA device pointer.
OpenCL: Relative offset from the beginning of :attr`buffer` to the start of the array data.
CUDA: Always zero.
Todo
We should also define a way to access a host pointer for the relevant memory area, if available.
Todo
What type system? numpy.dtype? lltypes?
A shape tuple, just like :attr`numpy.ndarray.shape`.
A strides tuple, just like :attr`numpy.ndarray.strides`.
A strides tuple, just like :attr`numpy.ndarray.strides`.
If self is a proxy to the actual object holding the data then either garbage collection or an explicit release call will free the resources occupied by the proxy. Otherwise, this method is a no-op.
Todo
I would suggest that the CPython-specific interface be as minimal as possible, just providing a hatch to get to the low-level C interface.
Todo
Frédéric/Arnaud–could you paste in the interface that your array object obeys as a starting point?