Debugging Features in Numba 0.55#

Numba 0.55 enables following features:

Added info args#

See info args. In previous versions info args always returns No arguments..

Extended info locals#

See info locals.

Breakpoint with condition by function argument#

Test numba_dpex/tests/debugging/test_breakpoints.py:test_breakpoint_with_condition_by_function_argument.

When set breakpoint on the function or the first line of the function than info locals and info args provide correct values. It makes it posible to use breakpoint with condition by function argument.

Example#

Source code numba_dpex/examples/debug/side-by-side.py:

14def common_loop_body(param_a, param_b):
15    param_c = param_a + numba.float32(10)  # Set breakpoint here
16    param_d = param_b * numba.float32(0.5)
17    result = param_c + param_d
18    return result

Set breakpoint with condition by function argument:

$ NUMBA_OPT=0 gdb-oneapi -q python
...
(gdb) break side-by-side.py:25 if param_a == 3
...
(gdb) run numba_dpex/examples/debug/side-by-side.py --api=numba-dpex-kernel
...
Thread 2.1 hit Breakpoint 1, with SIMD lane 3, __main__::common_loop_body (param_a=3, param_b=3) at side-by-side.py:25
25          param_c = param_a + 10  # Set breakpoint here
(gdb) print param_a
$1 = 3

Added NUMBA_EXTEND_VARIABLE_LIFETIMES#

See Local Variables Lifetime in Numba IR.

:samp:NUMBA_EXTEND_VARIABLE_LIFETIMES=1 works together with :samp:NUMBA_DUMP_ANNOTATION=1.

See Example 2 - Using NUMBA_DUMP_ANNOTATION.

Displaying Complex Data Types#

Numba 0.55 improves displaying of complex data types like arrays. It makes it possible to access data in arrays. It is possible to get array values by commands like :samp:x/10f array.data and :samp:print array.data[5].

See print expr and whatis [arg] and ptype [arg]