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

Calling vectorize with parallel target inside njit #4045

Open
2 tasks done
ehsantn opened this issue May 2, 2019 · 1 comment
Open
2 tasks done

Calling vectorize with parallel target inside njit #4045

ehsantn opened this issue May 2, 2019 · 1 comment
Labels
Blocked awaiting long term feature For PRs/Issues that require the implementation of a long term plan feature feature_request

Comments

@ehsantn
Copy link
Collaborator

ehsantn commented May 2, 2019

Reporting a bug

Calling a vectorize function with the parallel target inside an njit function fails:

import numpy as np
import numba as nb

# @nb.vectorize([nb.float64(nb.float64, nb.float64)]) # works
@nb.vectorize([nb.float64(nb.float64, nb.float64)], target="parallel")
def g(a, b):
    return (a * b + 1)

@nb.njit
def f(A, B):
    return g(A, B)

print(f(np.ones(4), np.zeros(4)))
@stuartarchibald
Copy link
Contributor

Thanks for the report. I think this is because the standard target for @vectorize would return a Numba DUFunc instance whereas the parallel target would return a NumPy ufunc instance. The former can be consumed by the compiler, the latter cannot.

import numba as nb

@nb.vectorize([nb.float64(nb.float64, nb.float64)])
def gs(a, b):
    return (a * b + 1)

print(type(gs))

@nb.vectorize([nb.float64(nb.float64, nb.float64)], target="parallel")
def gp(a, b):
    return (a * b + 1)

print(type(gp))

gives:

<class 'numba.npyufunc.dufunc.DUFunc'>
<class 'numpy.ufunc'>

related: #2469

@stuartarchibald stuartarchibald added Blocked awaiting long term feature For PRs/Issues that require the implementation of a long term plan feature feature_request labels May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked awaiting long term feature For PRs/Issues that require the implementation of a long term plan feature feature_request
Projects
None yet
Development

No branches or pull requests

2 participants