Configure debugging environment
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
Create and activate conda environment with the installed Numba-dppy:
conda create numba-dppy-dev numba-dppy conda activate numba-dppy-dev
Activate NEO drivers (optional).
If you want to use the local NEO driver, activate the variables for it. See the NEO driver.
Check debugging environment.
You can check the correctness of the work with the following example:
15import dpctl 16import numpy as np 17 18import numba_dppy as dppy 19 20 21@dppy.kernel(debug=True) 22def data_parallel_sum(a, b, c): 23 i = dppy.get_global_id(0) 24 c[i] = a[i] + b[i] 25 26 27global_size = 10 28N = global_size 29 30a = np.array(np.random.random(N), dtype=np.float32) 31b = np.array(np.random.random(N), dtype=np.float32) 32c = np.ones_like(a) 33 34device = dpctl.SyclDevice("opencl:gpu") 35with dppy.offload_to_sycl_device(device): 36 data_parallel_sum[global_size, dppy.DEFAULT_LOCAL_SIZE](a, b, c) 37 38print("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 = dppy.get_global_id(0) (gdb) continue Done... ...