Print when compiling?

Is there a way to make an njit function or jitclass print when it’s compiling? I’m troubleshooting a parallelization issue of a jitclass, and it’d be helpful to see a print statement like “jitclass is compiling” or something whenever that happens to make sure it’s not being repeated for each new thread.

Hi @calbaker,

You can switch on the tracer which will show you the compilation pipeline entries for the function names. For example:

from numba import njit, types
from numba.experimental import jitclass

@jitclass({'a':types.int64})
class Foo(object):
    def __init__(self, a):
        self.a = a

@njit
def make_foo():
    return Foo(1)

@njit
def main():
    return make_foo()

main()

then run with:

$ NUMBA_TRACE=1 python di34.py 2>&1 |grep Pipeline
== Pipeline: nopython for __main__.main
== Pipeline: nopython for __main__.make_foo
== Pipeline: nopython for __main__.Foo.__init__
== Pipeline: nopython for <dynamic>.accessor

For standard @jit decorated function there’s some more suggestions in this thread Create log message on Numba compilation / Find out if given arguments lead to compilation.

Hope this helps?