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.

numba parallel on mac, not working

See original GitHub issue
import numba
print(numba.__version__)
numba.set_num_threads(4)
numba.config.NUMBA_NUM_THREADS = 4
import time

@numba.njit(parallel=True)
def f(n):
    s = 0
    for i in numba.prange(n):
        for j in range(n):
            for k in range(n):
                s += (i * k < j * j) - (i * k > j * j)
    return s


t1 = time.time()
f(5000)
t2 = time.time()
print(t2-t1)
image

my test code as above. numba==0.55.0 I have run on my mac, and linux

  1. on mac, only use 1 cpu = 100%
  2. on linux, can use 400%

how to use multi cpus on mac? thanks!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
RunxingZhongcommented, Jun 21, 2022

try python -m numba -s

hi, sorry reply late. after I uninstall and conda install everything work!

thanks

0reactions
guilhermeleobascommented, Jun 21, 2022

Closing as the issue seems to be solved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Threading Layers — Numba 0.50.1 documentation
This section is about the Numba threading layer, this is the library that is used internally to perform the parallel execution that occurs...
Read more >
parallel flag in @jit does not work in my code with numpy 2D ...
Judging from the error message, I assume numba has an issue figuring out the reference of the result array to write into. Note...
Read more >
Parallel Computing Principles in Python - GitHub Pages
The function prange tells Numba that the corresponding for-loop can be parallelised. Numba automatically splits this for-loop into threads that work ...
Read more >
Compiling Python classes with @jitclass
Not all compiling features are exposed or implemented, yet. Numba ... operations of jitclasses work in both the interpreter and Numba compiled functions:....
Read more >
14. Parallelization
We just saw one approach to parallelization in Numba, using the parallel flag in @vectorize . This is neat but, it turns out,...
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