question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lowering Error while trying to run parallel with prange

See original GitHub issue

Hello. Whenever I run this code:

from numba import njit, prange

@njit(parallel=True)
def s(n):
    lis=[]
    for i in prange(n+1):
        lis.append(i)
    return lis

s(1)

It gives me LoweringError: And if I make lis into an empty np array:

from numba import njit, prange
import numpy as np

@njit(parallel=True)
def s(n):
    lis=np.empty(0)
    for i in prange(n+1):
        lis=np.append(lis,i)
    return lis

It gives ‘ValueError: Failed in nopython mode pipeline (step: convert to parfors) Use of reduction variable lis in an unsupported reduction function.’ And checking the internet I didnt find any solution to this. Thanks in advance

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
stuartarchibaldcommented, Oct 29, 2020

No problem RE: open/close.

As the above sample involving triplePartition is a more general question, I’d recommend asking it on the Numba discourse forum https://numba.discourse.group/ 😃 Thanks!

0reactions
chococookies131commented, Oct 29, 2020

Also, sorry for closing and opening, I misclicked

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parallel prange gives LoweringError · Issue #4903 - GitHub
It is kind of a delicate error, and further simplification of my MWE leads to a successful parallel compile. I use the environment....
Read more >
Parallelize with numba's prange and passing along a tuple
LoweringError : Failed at nopython (nopython mode backend) scalar type tuple(array(int64, 1d, C) x 2) given for non scalar argument #2 File "< ......
Read more >
Automatic parallelization with @jit - Numba
parallel =True ) is support for explicit parallel loops. One can use Numba's ; prange instead of ; range to specify that a...
Read more >
Frequently Asked Questions - Numba documentation
Why are the typed containers slower when used from the interpreter? Does Numba automatically parallelize code? Can Numba speed up short-running functions? There ......
Read more >
Parallel computing in Cython - threads - Neal Hughes
How to run multiple threads in Cython. ... from cython.parallel import prange def c_array_f_multi(double[:] X): cdef int N = X.shape[0] cdef ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found