Does providing a function signature to numba/cuda jit improve performance?

0 megtekintés
Ugrás az első olvasatlan üzenetre

Rémi Lehe

olvasatlan,
2017. aug. 6. 20:02:102017. 08. 06.
– Numba Public Discussion - Public
The Numba documentation (e.g. http://numba.pydata.org/numba-doc/dev/reference/types.html) explains that providing a function signature can be advantageous, in that it allows AOT compilation.

However, is there an advantage to providing a signature, in the case where JIT compilation is used. In particular, is there an advantage in terms of performance and function call overhead, when providing a signature to numba.jit, as opposed to not providing it. (Not considering the first function call of course, but only the subsequent ones.)

Thanks in advance for your help,

Jim Pivarski

olvasatlan,
2017. aug. 6. 21:06:102017. 08. 06.
– numba...@continuum.io
If you don't provide a signature, it will take a little longer the first time you call the function, but all subsequent times will be just as fast as if you had provided a signature. That's because it will compile if you give a signature or if you give it a set of arguments, and the compilation can take a long time (tens to hundreds of milliseconds, maybe whole seconds if LLVM has to be loaded into memory).

There have been some times when I wanted AOT compilation. One was when I was demonstrating Numba performance: I didn't think it would be fair to include the compilation time in the throughput measurement because it's a one-time thing.

Another was because I wanted to create the ELF string (compiled bytecode in a portable format) to transmit to a remote site. I hadn't yet seen any data because they were at the remote sites, but I knew what the types would be.

The following hasn't come up yet for me, but I suppose you could want to force compilation to verify that it will compile, as a sort of type check.

So there are reasons to do AOT compilation, but asymptotic rate is not one of them.

Jim






--
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/919a9387-d634-4184-a7b3-dfd7a0a6459a%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Stanley Seibert

olvasatlan,
2017. aug. 7. 11:35:222017. 08. 07.
– Numba Public Discussion - Public
There isn't going to be any performance advantage in subsequent calls because the same dispatcher code path is used regardless of whether function signatures were provided ahead of time.

We could consider generating a custom dispatcher specialized just for the types in an explicit type signature, but the overhead that would save would only be visible on very short functions.

--

rl...@lbl.gov

olvasatlan,
2017. aug. 7. 14:35:582017. 08. 07.
– Numba Public Discussion - Public
@ Jim and Stanley:
Thanks a lot for your answers. That was exactly what I wanted to know.


On Monday, August 7, 2017 at 8:35:22 AM UTC-7, Stanley Seibert wrote:
There isn't going to be any performance advantage in subsequent calls because the same dispatcher code path is used regardless of whether function signatures were provided ahead of time.

We could consider generating a custom dispatcher specialized just for the types in an explicit type signature, but the overhead that would save would only be visible on very short functions.
On Sun, Aug 6, 2017 at 7:02 PM, Rémi Lehe <remi...@gmail.com> wrote:
The Numba documentation (e.g. http://numba.pydata.org/numba-doc/dev/reference/types.html) explains that providing a function signature can be advantageous, in that it allows AOT compilation.

However, is there an advantage to providing a signature, in the case where JIT compilation is used. In particular, is there an advantage in terms of performance and function call overhead, when providing a signature to numba.jit, as opposed to not providing it. (Not considering the first function call of course, but only the subsequent ones.)

Thanks in advance for your help,

--
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.
Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet