Configure debugging environment

  1. Activate the debugger and compiler:

    export ONEAPI_ROOT=/path/to/oneapi
    source $ONEAPI_ROOT/debugger/latest/env/vars.sh
    source $ONEAPI_ROOT/compiler/latest/env/vars.sh
    
  2. Create and activate conda environment with the installed numba-dpex:

    conda create numba-dpex-dev numba-dpex
    conda activate numba-dpex-dev
    
  3. Activate NEO drivers (optional).

    If you want to use the local NEO driver, activate the variables for it. See the NEO driver.

  4. Check debugging environment.

    You can check the correctness of the work with the following example:

    15
    16
    17global_size = 10
    18N = global_size
    19
    20a = np.array(np.random.random(N), dtype=np.float32)
    21b = np.array(np.random.random(N), dtype=np.float32)
    22c = np.ones_like(a)
    23
    24data_parallel_sum[ndpx.Range(global_size)](a, b, c)
    25
    26print("Done...")
    

    Launch the Intel® Distribution for GDB* and set a breakpoint in the kernel:

    $ gdb-oneapi -q --args python simple_sum.py
    (gdb) break simple_sum.py:22
    No source file named simple_sum.py.
    Make breakpoint pending on future shared library load? (y or [n]) y
    Breakpoint 1 (simple_sum.py:22) pending.
    (gdb) run
    

    In the output you can see that the breakpoint was hit successfully:

    Thread 2.2 hit Breakpoint 1, with SIMD lanes [0-7], __main__::data_parallel_sum () at simple_sum.py:22
    22           i = dpex.get_global_id(0)
    (gdb) continue
    Done...
    ...