Skip to content
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: Support passing tuples to ufuncs #6878

Merged
merged 2 commits into from May 11, 2021
Merged

Conversation

gmarkall
Copy link
Member

This PR adds support for use cases like the following to CUDA ufuncs created with @vectorize:

from numba import vectorize, float64
import math

@vectorize([float64(float64)], target='cuda')
def cuda_cos(x):
    return math.cos(x)

print(cuda_cos((1.0, 2.0, 3.0)))

Passing tuples, namedtuples, tuples of arrays, and nesting of these is supported - tests are added to cover some of these cases.

It seems that this already worked for gufuncs, so some tests are added for the equivalent in gufuncs, but no functional change is made there.

Fixes #6563.

This commit adds support for use cases like the following to CUDA ufuncs
created with `@vectorize`:

```
from numba import vectorize, float64
import math

@vectorize([float64(float64)], target='cuda')
def cuda_cos(x):
    return math.cos(x)

print(cuda_cos((1.0, 2.0, 3.0)))
```

Passing tuples, namedtuples, tuples of arrays, and nesting of these is
supported - tests are added to cover some of these cases.

It seems that this already worked for gufuncs, so some tests are added
for the equivalent in gufuncs, but no functional change is made there.

Fixes numba#6563.
Copy link
Contributor

@stuartarchibald stuartarchibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch, one minor query else looks good.

numba/np/ufunc/deviceufunc.py Outdated Show resolved Hide resolved
@stuartarchibald stuartarchibald added 4 - Waiting on author Waiting for author to respond to review and removed 3 - Ready for Review labels Apr 9, 2021
@gmarkall gmarkall added 4 - Waiting on reviewer Waiting for reviewer to respond to author and removed 4 - Waiting on author Waiting for author to respond to review labels Apr 13, 2021
@stuartarchibald stuartarchibald added 4 - Waiting on author Waiting for author to respond to review and removed 4 - Waiting on reviewer Waiting for reviewer to respond to author labels Apr 14, 2021
@gmarkall gmarkall added 4 - Waiting on reviewer Waiting for reviewer to respond to author and removed 4 - Waiting on author Waiting for author to respond to review labels Apr 22, 2021
Copy link
Contributor

@stuartarchibald stuartarchibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch and fixes.

@stuartarchibald stuartarchibald added 4 - Waiting on CI Review etc done, waiting for CI to finish and removed 4 - Waiting on reviewer Waiting for reviewer to respond to author labels May 10, 2021
@stuartarchibald
Copy link
Contributor

Buildfarm ID: numba_smoketest_cuda_yaml_56.

@stuartarchibald
Copy link
Contributor

Buildfarm ID: numba_smoketest_cuda_yaml_56.

Passed

@stuartarchibald stuartarchibald added 5 - Ready to merge Review and testing done, is ready to merge and removed 4 - Waiting on CI Review etc done, waiting for CI to finish labels May 10, 2021
@sklam sklam merged commit 751dc1a into numba:master May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to merge Review and testing done, is ready to merge CUDA CUDA related issue/PR Effort - medium Medium size effort needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CUDA: Add support for passing tuples to kernels via vectorize
3 participants