Skip to content

Commit d9694a3

Browse files
authored
Tools/ApplicationDebugger update (#2347)
* Tools/ApplicationDebugger: add -g flag explicitly for debug builds. * Tools/ApplicationDebugger: remove "$" before bash commands in README. * Tools/ApplicationDebugger: use ONEAPI_DEVICE_SELECTOR to choose the device. * Tools/ApplicationDebugger: update guided_matrix_mult_SLMSize.
1 parent f3a8d5f commit d9694a3

File tree

12 files changed

+121
-150
lines changed

12 files changed

+121
-150
lines changed

Tools/ApplicationDebugger/array-transform/README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ To learn more about the extensions, see the
8282
> Linux*:
8383
> - For system wide installations: `. /opt/intel/oneapi/setvars.sh`
8484
> - For private installations: `. ~/intel/oneapi/setvars.sh`
85-
> - For non-POSIX shells, like csh, use the following command: `$ bash -c 'source <install-dir>/setvars.sh ; exec csh'`
85+
> - For non-POSIX shells, like csh, use the following command: `bash -c 'source <install-dir>/setvars.sh ; exec csh'`
8686
>
8787
> Windows*:
8888
> - `C:\"Program Files (x86)"\Intel\oneAPI\setvars.bat`
@@ -112,7 +112,7 @@ batch or interactive mode. For the array transform sample, a node
112112
with GPU and an interactive shell is recommended.
113113

114114
```
115-
$ qsub -I -l nodes=1:gpu:ppn=2
115+
qsub -I -l nodes=1:gpu:ppn=2
116116
```
117117

118118
For more information, see the Intel® oneAPI
@@ -127,12 +127,12 @@ offloaded to the GPU can be debugged conveniently. Auto-attach is
127127
by default enabled. To turn this feature off, if desired (e.g., if
128128
interested in debugging CPU or FPGA-emu only), do:
129129
```
130-
$ export INTELGT_AUTO_ATTACH_DISABLE=1
130+
export INTELGT_AUTO_ATTACH_DISABLE=1
131131
```
132132

133133
To turn the feature back on:
134134
```
135-
$ unset INTELGT_AUTO_ATTACH_DISABLE
135+
unset INTELGT_AUTO_ATTACH_DISABLE
136136
```
137137

138138
### On a Linux* System
@@ -141,33 +141,33 @@ Perform the following steps:
141141

142142
1. Build the program using the following `cmake` commands.
143143
```
144-
$ cd array-transform
145-
$ mkdir build
146-
$ cd build
147-
$ cmake ..
148-
$ make
144+
cd array-transform
145+
mkdir build
146+
cd build
147+
cmake ..
148+
make
149149
```
150150
> Note: The cmake configuration enforces the `Debug` build type.
151151
152152
2. Run the program:
153153
```
154-
$ ./array-transform
154+
./array-transform
155155
```
156156
> Note: to specify a device type to offload the kernel, use
157157
> the `ONEAPI_DEVICE_SELECTOR` environment variable.
158158
> E.g. to restrict the offload only to CPU devices use:
159159
```
160-
$ ONEAPI_DEVICE_SELECTOR=*:cpu ./array-transform
160+
ONEAPI_DEVICE_SELECTOR=*:cpu ./array-transform
161161
```
162162
163163
3. Start a debugging session:
164164
```
165-
$ gdb-oneapi array-transform
165+
gdb-oneapi array-transform
166166
```
167167
168168
4. Clean the program using:
169169
```
170-
$ make clean
170+
make clean
171171
```
172172
173173
By default, CMake configures the build for Just-in-Time (JIT)
@@ -182,7 +182,7 @@ compiler.
182182
For example, to do AoT compilation for a specific GPU device ID:
183183
184184
```
185-
$ cmake .. -DSYCL_COMPILE_TARGET=<device id>
185+
cmake .. -DSYCL_COMPILE_TARGET=<device id>
186186
```
187187
where the `<device id>` specifies the target device, e.g., "xe".
188188
@@ -233,7 +233,7 @@ please see [Get Started with Intel® Distribution for GDB* on Windows* OS Host](
233233
### Example Outputs
234234
235235
```
236-
$ ONEAPI_DEVICE_SELECTOR=*:cpu gdb-oneapi -q ./array-transform
236+
ONEAPI_DEVICE_SELECTOR=*:cpu gdb-oneapi -q ./array-transform
237237
Reading symbols from ./array-transform...
238238
(gdb) break 54
239239
Breakpoint 1 at 0x4057b7: file array-transform.cpp, line 54.
@@ -248,7 +248,7 @@ Thread 4 "array-transform" hit Breakpoint 1, main::{lambda(auto:1&)#1}::operator
248248
```
249249
250250
```
251-
$ ONEAPI_DEVICE_SELECTOR=*:fpga gdb-oneapi -q ./array-transform
251+
ONEAPI_DEVICE_SELECTOR=*:fpga gdb-oneapi -q ./array-transform
252252
Reading symbols from ./array-transform...
253253
(gdb) break 54
254254
Breakpoint 1 at 0x4057b7: file array-transform.cpp, line 54.
@@ -263,7 +263,7 @@ Thread 6 "array-transform" hit Breakpoint 1, main::{lambda(auto:1&)#1}::operator
263263
```
264264
265265
```
266-
$ ONEAPI_DEVICE_SELECTOR=level_zero:gpu gdb-oneapi -q ./array-transform
266+
ONEAPI_DEVICE_SELECTOR=level_zero:gpu gdb-oneapi -q ./array-transform
267267
Reading symbols from ./array-transform...
268268
(gdb) break 54
269269
Breakpoint 1 at 0x4057b7: file array-transform.cpp, line 54.

Tools/ApplicationDebugger/guided_matrix_mult_BadBuffers/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
1212
message (STATUS "Build Type is changed to 'Debug'.")
1313
endif ()
1414

15-
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsycl -O0")
15+
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsycl -g -O0")
1616
message (STATUS "Optimization level is set to -O0.")
1717

1818
# Check that debugger executables exist in PATH

Tools/ApplicationDebugger/guided_matrix_mult_BadBuffers/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ In `a1_matrix_mul_zero_buff`, a zero-element buffer is passed to a SYCL submit `
178178
179179
2. Start the debugger to watch the application failure and find out where it failed.
180180
```
181-
$ gdb-oneapi ./a1_matrix_mul_zero_buff
181+
gdb-oneapi ./a1_matrix_mul_zero_buff
182182
```
183183
184184
3. You should get the prompt `(gdb)`.
@@ -297,7 +297,7 @@ You will run the application and review what happens when the program is run usi
297297
298298
1. Run the program on the GPU using Level Zero.
299299
```
300-
SYCL_DEVICE_FILTER=level_zero:gpu ./b1_matrix_mul_null_usm
300+
ONEAPI_DEVICE_SELECTOR=level_zero:gpu ./b1_matrix_mul_null_usm
301301
```
302302
This run produces troublesome output.
303303
```
@@ -310,14 +310,14 @@ You will run the application and review what happens when the program is run usi
310310
311311
2. Check the output if we run on the GPU again but using OpenCL.
312312
```
313-
SYCL_DEVICE_FILTER=opencl:gpu ./b1_matrix_mul_null_usm
313+
ONEAPI_DEVICE_SELECTOR=opencl:gpu ./b1_matrix_mul_null_usm
314314
```
315315
316316
The results should be the same as the Level Zero output.
317317
318318
3. Check the output we get by bypassing the GPU entirely and using the OpenCL driver for CPU.
319319
```
320-
SYCL_DEVICE_FILTER=opencl:cpu ./b1_matrix_mul_null_usm
320+
ONEAPI_DEVICE_SELECTOR=opencl:cpu ./b1_matrix_mul_null_usm
321321
```
322322
```
323323
Problem size: c(150,600) = a(150,300) * b(300,600)
@@ -333,7 +333,7 @@ Let's see what caused the problem by running in the debugger using the OpenCL dr
333333
334334
1. Start the debugger using OpenCL™ on the CPU.
335335
```
336-
SYCL_DEVICE_FILTER=opencl:cpu gdb-oneapi ./b1_matrix_mul_null_usm
336+
ONEAPI_DEVICE_SELECTOR=opencl:cpu gdb-oneapi ./b1_matrix_mul_null_usm
337337
```
338338
2. You should get the prompt `(gdb)`.
339339

Tools/ApplicationDebugger/guided_matrix_mult_Exceptions/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
1212
message (STATUS "Build Type is changed to 'Debug'.")
1313
endif ()
1414

15-
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsycl -O0")
15+
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsycl -g -O0")
1616
message (STATUS "Optimization level is set to -O0.")
1717

1818
# Check that debugger executables exist in PATH

Tools/ApplicationDebugger/guided_matrix_mult_InvalidContexts/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
1212
message (STATUS "Build Type is changed to 'Debug'.")
1313
endif ()
1414

15-
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsycl -O0")
15+
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsycl -g -O0")
1616
message (STATUS "Optimization level is set to -O0.")
1717

1818
# Check that debugger executables exist in PATH

Tools/ApplicationDebugger/guided_matrix_mult_InvalidContexts/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ You must download the [Tracing and Profiling Tool](https://github.com/intel/pti-
159159

160160
2. Check the results on a **GPU** with OpenCL.
161161
```
162-
SYCL_DEVICE_FILTER=opencl:gpu ./1_matrix_mul_invalid_contexts
162+
ONEAPI_DEVICE_SELECTOR=opencl:gpu ./1_matrix_mul_invalid_contexts
163163
```
164164
The output might look similar to the following:
165165
```
@@ -176,7 +176,7 @@ You must download the [Tracing and Profiling Tool](https://github.com/intel/pti-
176176
```
177177
3. Check the results on the **CPU** using OpenCL. You should see similar problems.
178178
```
179-
SYCL_DEVICE_FILTER=opencl:cpu ./1_matrix_mul_invalid_contexts
179+
ONEAPI_DEVICE_SELECTOR=opencl:cpu ./1_matrix_mul_invalid_contexts
180180
```
181181
The output might look like the following:
182182
```
@@ -199,7 +199,7 @@ In this section, you will use the Intel® Distribution for GDB* to determine wha
199199

200200
1. Start the debugger using OpenCL™ on the **GPU**.
201201
```
202-
SYCL_DEVICE_FILTER=opencl:gpu gdb-oneapi ./1_matrix_mul_invalid_contexts
202+
ONEAPI_DEVICE_SELECTOR=opencl:gpu gdb-oneapi ./1_matrix_mul_invalid_contexts
203203
```
204204
2. You should get the prompt `(gdb)`.
205205

@@ -319,7 +319,7 @@ One of the things that the Tracing and Profiling utility can help us identify is
319319
>**Note**: You must modify the command shown below to include the path to where you installed the `onetrace` utility.
320320
321321
```
322-
SYCL_DEVICE_FILTER=opencl:gpu [path]/onetrace -c ./1_matrix_mul_invalid_contexts
322+
ONEAPI_DEVICE_SELECTOR=opencl:gpu [path]/onetrace -c ./1_matrix_mul_invalid_contexts
323323
```
324324

325325
The `onetrace` utility outputs extensive results. A few key excerpts with areas of interest are shown below.
@@ -343,7 +343,7 @@ One of the things that the Tracing and Profiling utility can help us identify is
343343

344344
2. Look at the output from Level Zero, and see if we could have detected the issue.
345345
```
346-
SYCL_DEVICE_FILTER=level_zero:gpu [path]onetrace -c ./1_matrix_mul_invalid_contexts
346+
ONEAPI_DEVICE_SELECTOR=level_zero:gpu [path]onetrace -c ./1_matrix_mul_invalid_contexts
347347
```
348348
Your output might be similar to the following:
349349
```

Tools/ApplicationDebugger/guided_matrix_mult_RaceCondition/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
1212
message (STATUS "Build Type is changed to 'Debug'.")
1313
endif ()
1414

15-
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsycl -O0")
15+
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsycl -g -O0")
1616
message (STATUS "Optimization level is set to -O0.")
1717

1818
# Check that debugger executables exist in PATH

Tools/ApplicationDebugger/guided_matrix_mult_RaceCondition/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,14 @@ But what if the developer didn't delete `c_back`, and let program termination cl
290290
Is the behavior different if you run it on OpenCL or Level 0? The default is to use the Level Zero run time, but we can explicitly force the use of either Level Zero or OpenCL, which can be helpful when troubleshooting.
291291
292292
```
293-
$ SYCL_DEVICE_FILTER=level_zero:gpu ./1_matrix_mul_race_condition
294-
$ SYCL_DEVICE_FILTER=opencl:gpu ./1_matrix_mul_race_condition
293+
ONEAPI_DEVICE_SELECTOR=level_zero:gpu ./1_matrix_mul_race_condition
294+
ONEAPI_DEVICE_SELECTOR=opencl:gpu ./1_matrix_mul_race_condition
295295
```
296296
Unfortunately not; pretty much the same thing happens.
297297
298298
Similarly, we specify targeting the CPU, which sometimes can avoid problems in your code that are specific to offloading to the GPU.
299299
```
300-
$ SYCL_DEVICE_FILTER=CPU ./1_matrix_mul_race_condition
300+
ONEAPI_DEVICE_SELECTOR=*:cpu ./1_matrix_mul_race_condition
301301
```
302302
This also has problems, but if you run this in the debugger you will see lots of threads all running in the third `q.submit` kernel, but no thread running `main`. This is because these threads have been abandoned when `main` deleted `c_back` and exited!
303303

Tools/ApplicationDebugger/guided_matrix_mult_SLMSize/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
1212
message (STATUS "Build Type is changed to 'Debug'.")
1313
endif ()
1414

15-
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsycl -O0")
15+
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsycl -g -O0")
1616
message (STATUS "Optimization level is set to -O0.")
1717

1818
# Check that debugger executables exist in PATH

0 commit comments

Comments
 (0)