-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__cuda_array_interface__ #2860
__cuda_array_interface__ #2860
Conversation
…party cuda arrays
Codecov Report
@@ Coverage Diff @@
## master #2860 +/- ##
==========================================
- Coverage 85.84% 85.79% -0.06%
==========================================
Files 326 327 +1
Lines 68311 68422 +111
Branches 7721 7729 +8
==========================================
+ Hits 58643 58703 +60
- Misses 8428 8481 +53
+ Partials 1240 1238 -2 |
I can confirm this works in combination with cupy/cupy#1144. import cupy
from numba import cuda
@cuda.jit
def add(x, y, out):
start = cuda.grid(1)
stride = cuda.gridsize(1)
for i in range(start, x.shape[0], stride):
out[i] = x[i] + y[i]
a = cupy.arange(10)
b = a * 2
out = cupy.empty_like(a)
print('out before:', out)
add[1, 32](a, b, out)
print('out after:', out)
print('array types:', type(a), type(b), type(out)) Output:
|
It looks like support for |
I think you forgot to check in |
Oops, added missing file now |
docs/source/cuda/memory.rst
Outdated
@@ -20,6 +20,17 @@ transfer: | |||
.. autofunction:: numba.cuda.to_device | |||
:noindex: | |||
|
|||
In addition to the device arrays, numba can consume any object that implements | |||
:ref:`cuda array interface <cuda-array-interface>`. These objects can be | |||
converted into a device array by creating a view of the GPU buffer using the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should phrase this as "These objects also can be manually converted into a Numba device array by creating a view of the GPU buffer using the following APIs:"
docs/source/cuda/memory.rst
Outdated
@@ -20,6 +20,17 @@ transfer: | |||
.. autofunction:: numba.cuda.to_device | |||
:noindex: | |||
|
|||
In addition to the device arrays, numba can consume any object that implements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/numba/Numba/
Two minor documentation nits, and then this looks good to merge. |
for interop with 3rd party CUDA array.