Closed paleolimbot closed 3 months ago
Apologies for the two additional changes, but:
DeviceType
, it was pretty clear that the CDevice
was never going to get a Device
wrapper in not-Cython. Interacting with the device is something that mostly happens in the classes that live in Cython, and the only thing that anybody needs to know about it otherwise is to print it or know if it's the CPU or not. For the other classes there's some payoff to wrapping them in Python (better IDE documentation + completion, iteration time), but the Device
doesn't benefit from any of those.
When device support was first added, the
CArrayView
was device-aware but theCArray
was not. This worked well until it was clear that__arrow_c_array__
needed to error if it did not represent a CPU array (and theCArray
had no way to check). Now, theCArray
has adevice_type
anddevice_id
. A nice side-effect of this is that we get back theview()
method (whose removal @jorisvandenbossche had lamented!).This also implements the device array protocol to help test https://github.com/apache/arrow/pull/40717 . This protocol isn't finalized yet and I could remove that part until it is (although it doesn't seem likely to change).
The non-cpu case is still hard to test without real-world CUDA support...this PR is just trying to get the right information in the right place as early as possible.