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

Failed in nopython mode pipeline (step: nopython mode backend) #3932

Closed
MainzKCL opened this issue Apr 2, 2019 · 4 comments
Closed

Failed in nopython mode pipeline (step: nopython mode backend) #3932

MainzKCL opened this issue Apr 2, 2019 · 4 comments

Comments

@MainzKCL
Copy link

MainzKCL commented Apr 2, 2019

Cannot cast array(bool, 1d, C) to bool: %".1784" = load {i8*, i8*, i64, i64, i8*, [1 x i64], [1 x i64]}, {i8*, i8*, i64, i64, i8*, [1 x i64], [1 x i64]}* %"$222.6"

File "", line 31:
def stabilitySelect(lambdaNeed,x,y,numIter,mask):

for i in prange(0,b.shape[0]):
if(b[i]>0):
^

[1] During: lowering "branch $222.6, 236, 305" at (31)

This should not have happened, a problem has occurred in Numba's internals.

Please report the error message and traceback, along with a minimal reproducer
at: https://github.com/numba/numba/issues/new

If more help is needed please feel free to speak to the Numba core developers
directly at: https://gitter.im/numba/numba

Thanks in advance for your help in improving Numba!

@stuartarchibald
Copy link
Contributor

Thanks for the report. Whilst there is no minimal working reproducer present I can guess from the lowering error that this is a case of trying to do this:

from numba import njit
import numpy as np

@njit
def foo():
    a = np.ones(1, np.bool_)
    if a > 0:
        print('truebr')
    else:
        print('falsebr')

foo()

and the root cause is that a > 0 is not a predicate but rather a conditional. #3901 is WIP to fix.

@MainzKCL
Copy link
Author

MainzKCL commented Apr 3, 2019 via email

@stuartarchibald stuartarchibald pinned this issue Apr 3, 2019
@stuartarchibald stuartarchibald unpinned this issue Apr 3, 2019
@stuartarchibald
Copy link
Contributor

Thanks for the update. If you could produce a sample that reproduces the error I'd be happy to take a look. The sample is invalid without Numba being involved as the np.ones calls is incorrect (shape should be a tuple):

import numpy as np

def foo():
    A = np.ones(1, 10)
    if(A[0,0]<0):
        print()

foo()

and if that is fixed then:

from numba import njit
import numpy as np

@njit(parallel=True, fastmath=True)
def foo():
    A = np.ones((1, 10))
    if(A[0,0]<0):
        print()

foo()

compiles and executes fine.

@stuartarchibald
Copy link
Contributor

Closing this issue due to lack of information. If more information becomes available please add it and reopen the issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants