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

Exception support in prange body #2811

Open
ehsantn opened this issue Mar 12, 2018 · 2 comments
Open

Exception support in prange body #2811

ehsantn opened this issue Mar 12, 2018 · 2 comments

Comments

@ehsantn
Copy link
Collaborator

ehsantn commented Mar 12, 2018

prange doesn't support exceptions in body since the loop can have multiple exits (check done here). However, at least the exception case can be handled I think. Is there a problem with threads raising exceptions?

import numpy as np
from numba import njit, prange

@njit(parallel=True)
def f(X, N):
    acc = 0
    for i in prange(N):
        assert X[i] == 1
        acc += X[i]
    return acc

N = 9
X = np.ones(N)
print(f(X, N))
@sklam
Copy link
Member

sklam commented Mar 15, 2018

Yes, parallel ufunc is not propagating an error. There is a stalled patch: #2307

@slayoo
Copy link

slayoo commented Apr 18, 2021

Would be great if a warning would be issued (during compilation) if parallel=True is used and an exception is being raised from within a parallel block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Minor Features
Needs Design
Development

No branches or pull requests

4 participants