Does Numba use multiple cores?

0 views
Skip to first unread message

cassi...@hotmail.com

unread,
Nov 1, 2017, 3:30:01 PM11/1/17
to Numba Public Discussion - Public
Guys, I'm doing a search and I could not find material on Numba's official website.

Does the Numba library use when compiling the program in Python just a core of a CPU, or does it use multiple CPU cores?

Grateful.

Stanley Seibert

unread,
Nov 1, 2017, 3:33:20 PM11/1/17
to Numba Public Discussion - Public
Numba's compiler is single threaded and in fact has quite a bit of locking to avoid multiple threads compiling simultaneously.  Your compiled function can be used in multiple threads, and if you release the GIL with @jit(nogil=True), the function can run in parallel from different Python threads, but you will have to manage the threads.

Numba also includes some experimental automatic multithreading described here:


--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users+unsubscribe@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/933a8f52-81bb-4a7d-8145-232fce63d400%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

cassi...@hotmail.com

unread,
Nov 7, 2017, 1:55:38 PM11/7/17
to Numba Public Discussion - Public
I understand, but then if I create a simple factorial function and use @jit, I can say that the compiler will only use 1 processor core, correct? Or am I wrong?


Em quarta-feira, 1 de novembro de 2017 17:33:20 UTC-2, Stanley Seibert escreveu:
Numba's compiler is single threaded and in fact has quite a bit of locking to avoid multiple threads compiling simultaneously.  Your compiled function can be used in multiple threads, and if you release the GIL with @jit(nogil=True), the function can run in parallel from different Python threads, but you will have to manage the threads.

Numba also includes some experimental automatic multithreading described here:

On Wed, Nov 1, 2017 at 2:03 PM, <cassi...@hotmail.com> wrote:
Guys, I'm doing a search and I could not find material on Numba's official website.

Does the Numba library use when compiling the program in Python just a core of a CPU, or does it use multiple CPU cores?

Grateful.

--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.

Stanley Seibert

unread,
Nov 7, 2017, 2:00:17 PM11/7/17
to Numba Public Discussion - Public
You are correct.  @jit does not generate code with automatic multithreading by default.  @jit(parallel=True) will do some automatic multithreading, but only of array expressions, which doesn't help the factorial calculation.  @jit(parallel=True) also enables the use of prange, which allows a for loop to be executed in parallel.


To unsubscribe from this group and stop receiving emails from it, send an email to numba-users+unsubscribe@continuum.io.

To post to this group, send email to numba...@continuum.io.
Reply all
Reply to author
Forward
0 new messages