Basic arithmetic quality-of-life array methods? #740
-
Hi there! I am looking into options to speed up some hypothetical numpy code - I don't have anything in particular in mind, I'm just preparing for the future. And so I've stumbled upon this wonderful package, but I quickly understood it was developed by people who know what they are doing for people who know what they are doing. However, as I'm not one of those, I do ML so I feel proud for knowing what a register is - I would like to have some quality of life stuff, for a mere mortal, so to speak. The way I envision it is an ability to send numpy arrays to GPU devices and to receive some overgrown smart pointer in return, that would know how to schedule binary and unary math operations. Even better if it helps me to keep those arrays on said devices, do inplace operations and only retrieve the results of long chains of math! The questions are:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
There's https://documen.tician.de/pyopencl/array.html. But beware that while this code can store multi-d metadata just like numpy, arrays must be contiguous, and non-scalar broadcasting and arrays with differing strides will not work. |
Beta Was this translation helpful? Give feedback.
Here's a simple example:
https://github.com/inducer/pyopencl/blob/58717882517e49b451980437074f560cdb823a85/examples/demo_array.py
Generally, that's OK, though I would strongly suggest
to_device
overset
.