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

Error in Nopython mode during for loop usage #3947

Closed
MainzKCL opened this issue Apr 5, 2019 · 9 comments
Closed

Error in Nopython mode during for loop usage #3947

MainzKCL opened this issue Apr 5, 2019 · 9 comments
Assignees
Labels
needtriage no action required No action was needed to resolve.

Comments

@MainzKCL
Copy link

MainzKCL commented Apr 5, 2019

Here is the error message I am receiving:

LoweringError: Failed in nopython mode pipeline (step: nopython mode backend)
Buffer dtype cannot be buffer

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

vH=0;
for i in prange(0,numIter):
^

[1] During: lowering "id=27[LoopNest(index_variable = parfor_index.2067, range = ($const56.2, numIter, 1))]{154: <ir.Block at (10)>}Var(parfor_index.2067, (10))" at (10)

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

The minimum reproduction:

@njit(parallel=True)
def foo(numIter, vals ):

 for i in prange(0,numIter): #this is the line where I get the error
       print(vals[i])

foo(10,[0,1,2,3,4,5,6,7,8,9])

@luk-f-a
Copy link
Contributor

luk-f-a commented Apr 6, 2019

Hi @MainzKCL , are you using the latest Numba version? I was able to run your reproduction code in v0.43.1

@njit(parallel=True)
def foo(numIter, vals ):
 for i in prange(0,numIter): #this is the line where I get the error
       print(vals[i])
foo(10,[0,1,2,3,4,5,6,7,8,9])

0
4
5
621

3

7
8
9

@MainzKCL
Copy link
Author

MainzKCL commented Apr 6, 2019 via email

@esc
Copy link
Member

esc commented Apr 6, 2019

I can also confirm that the reproducer works fine on current master: b5a7131

@esc
Copy link
Member

esc commented Apr 6, 2019

@MainzKCL thanks for getting back to us with the report. Please don't hesitate to report any issues you have in the future! I'll close this one now.

@esc esc closed this as completed Apr 6, 2019
@esc esc self-assigned this Apr 6, 2019
@esc esc added needtriage no action required No action was needed to resolve. labels Apr 6, 2019
@luk-f-a
Copy link
Contributor

luk-f-a commented Apr 6, 2019

the weird thing is that using a tuple instead of a list does not work

@njit(parallel=True)
def foo(numIter, vals):
    a = 0.
    for i in prange(numIter): 
        a +=vals[i]
    return a
foo(10,(0,1,2,3,4,5,6,7,8,9))

with error

LoweringError: Failed in nopython mode pipeline (step: nopython mode backend)
scalar type tuple(int64 x 10) given for non scalar argument #2

File "<ipython-input-65-ca3529a8403f>", line 6:
def foo(numIter, vals):
    <source elided>
    a = 0
    for i in prange(numIter): 
    ^

[1] During: lowering "id=17[LoopNest(index_variable = parfor_index.1070, range = (0, numIter, 1))]{16: <ir.Block at <ipython-input-65-ca3529a8403f> (6)>}Var(parfor_index.1070, <ipython-input-65-ca3529a8403f> (6))" at <ipython-input-65-ca3529a8403f> (6)
-------------------------------------------------------------------------------
This should not have happened, a problem has occurred in Numba's internals.

@luk-f-a
Copy link
Contributor

luk-f-a commented Apr 6, 2019

@esc, what do you think of the example above? Should I open a new issue?

@esc
Copy link
Member

esc commented Apr 7, 2019

@luk-f-a probably a good idea, I just had a look and discovered, that this works when not using parallel=True.

@luk-f-a
Copy link
Contributor

luk-f-a commented Apr 7, 2019

@esc, I was going to open it but it looks like it would be a duplicate of #2625 and #2651

@esc
Copy link
Member

esc commented Apr 7, 2019

@luk-f-a good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needtriage no action required No action was needed to resolve.
Projects
None yet
Development

No branches or pull requests

3 participants