[Numpy-discussion] Direct GPU support on NumPy

Robert Kern robert.kern at gmail.com
Tue Jan 2 16:38:40 EST 2018

On Tue, Jan 2, 2018 at 1:21 PM, Yasunori Endo <jo7ueb at gmail.com> wrote:
> Hi all
> Numba looks so nice library to try.
> Thanks for the information.
>> This suggests a new, higher-level data model which supports replicating
data into different memory spaces (e.g. host and GPU). Then users (or some
higher layer in the software stack) can dispatch operations to suitable
implementations to minimize data movement.
>> Given NumPy's current raw-pointer C API this seems difficult to
implement, though, as it is very hard to track memory aliases.
> I understood modifying numpy.ndarray for GPU is technically difficult.
> So my next primitive question is why NumPy doesn't offer
> ndarray like interface (e.g. numpy.gpuarray)?
> I wonder why everybody making *separate* library, making user confused.

Because there is no settled way to do this. All of those separate library
implementations are trying different approaches. We are learning from each
of their attempts. They can each move at their own pace rather than being
tied down to numpy's slow rate of development and strict backwards
compatibility requirements. They can try new things and aren't limited to
their first mistakes. The user may well be confused by all of the different
options currently available. I don't think that's avoidable: there are lots
of meaningful options. Picking just one to stick into numpy is a disservice
to the community that needs the other options.

> Is there any policy that NumPy refuse standard GPU implementation?

Not officially, but I'm pretty sure that there is no appetite among the
developers for incorporating proper GPU support into numpy (by which I mean
that a user would build numpy with certain settings then make use of the
GPU using just numpy APIs). numpy is a mature project with a relatively
small development team. Much of that effort is spent more on maintenance
than new development.

What there is appetite for is to listen to the needs of the GPU-using
libraries and making sure that numpy's C and Python APIs are flexible
enough to do what the GPU libraries need. This ties into the work that's
being done to make ndarray subclasses better and formalizing the notions of
an "array-like" interface that things like pandas Series, etc. can
implement and play well with the rest of numpy.

Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180102/a91a746c/attachment.html>

More information about the NumPy-Discussion mailing list