Discussion:
[PyCUDA] non-contiguous array support
Syam Gadde
2018-02-23 15:24:58 UTC
Permalink
Sorry if this comes through multiple times, I've been having problems posting from an email alias.


Andreas suggested I mail the mailing list and solicit comments here.

I submitted a pull request that adapts the element-wise kernels to support non-contiguous arrays (including negative-strided arrays):

https://github.com/inducer/pycuda/pull/171

There have been a number of requests for this kind of functionality, so I'm hoping this is useful (at least as a proof-of-concept). It passes all current PyCUDA tests, but I've got some local code that fail for some more complicated cases. (Unfortunately can't reduce it to a unit test yet) But most things work.

In some ways it's an elaborate monkey-patch meant to disturb existing code as little as possible, but if you create your own element-wise kernels, to get the new functionality you have to make a few changes.


More details at the above PR.


Anyway, if anyone is interested in trying it out, I'd be interested to hear how it works for you, or whether you have suggestions for fixes. The code is in my fork:

https://github.com/SyamGadde/pycuda.git

in the 'noncontig' branch.

Cheers,

-syam
Syam Gadde
2018-02-23 14:41:16 UTC
Permalink
Andreas suggested I mail the mailing list and solicit comments here.


I submitted a pull request that adapts the element-wise kernels to support non-contiguous arrays (including negative-strided arrays):


https://github.com/inducer/pycuda/pull/171


There have been a number of requests for this kind of functionality, so I'm hoping this is useful (at least as a proof-of-concept). It passes all current PyCUDA tests, but I've got some local code that fail for some more complicated cases. (Unfortunately can't reduce it to a unit test yet) But most things work.


In some ways it's an elaborate monkey-patch meant to disturb existing code as little as possible, but if you create your own element-wise kernels, to get the new functionality you have to make a few changes.

More details at the above PR.


Anyway, if anyone is interested in trying it out, I'd be interested to hear how it works for you, or whether you have suggestions for fixes. The code is in my fork:


https://github.com/SyamGadde/pycuda.git


in the 'noncontig' branch.


Cheers,


-syam
Andreas Kloeckner
2018-02-23 18:06:40 UTC
Permalink
Post by Syam Gadde
Sorry if this comes through multiple times, I've been having problems posting from an email alias.
Andreas suggested I mail the mailing list and solicit comments here.
https://github.com/inducer/pycuda/pull/171
There have been a number of requests for this kind of functionality, so I'm hoping this is useful (at least as a proof-of-concept). It passes all current PyCUDA tests, but I've got some local code that fail for some more complicated cases. (Unfortunately can't reduce it to a unit test yet) But most things work.
In some ways it's an elaborate monkey-patch meant to disturb existing code as little as possible, but if you create your own element-wise kernels, to get the new functionality you have to make a few changes.
More details at the above PR.
https://github.com/SyamGadde/pycuda.git
in the 'noncontig' branch.
Please help take a look and help review the code. If there's one thing I'm
super short of these days, it's code review bandwidth. And so it helps a
lot if potential issues get highlighted and discussed. Thanks!

Here's that link again:

https://github.com/inducer/pycuda/pull/171

Also, thanks again Syam for working on and submitting this!

Andreas

Loading...