You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Rocgdb/README.md
+23-9Lines changed: 23 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,21 @@ You can see some information on the GPU you will be running on by doing:
26
26
rocm-smi
27
27
```
28
28
29
-
To introduce an error in your program, comment out the `hipMalloc` calls at line 71 and 72, then compile with:
29
+
To introduce an error in your program, comment out the `hipMalloc` calls at lines 81 and 82 in `saxpy.hip`. You can do this manually or use the following `sed` commands:
Since the code uses the `hipCheck` error-checking macro on the `hipMemcpy` calls at lines 83 and 84, you also need to remove these wrappers. Otherwise, the invalid pointer error will be caught at the `hipMemcpy` stage before reaching the kernel launch:
@@ -60,10 +74,10 @@ For the latter command above, you need to have `cgdb` installed on your system.
60
74
In the debugger, type `run` (or just `r`) and you will get an error similar to this one:
61
75
62
76
```bash
63
-
Thread 3"saxpy" received signal SIGSEGV, Segmentation fault.
64
-
[Switching to thread 3, lane 0 (AMDGPU Lane 1:2:1:1/0 (0,0,0)[0,0,0])]
65
-
0x00007ffff7ec1094insaxpy() at saxpy.cpp:57
66
-
57 y[i] += a*x[i];
77
+
Thread 5"saxpy" received signal SIGSEGV, Segmentation fault.
78
+
[Switching to thread 5, lane 0 (AMDGPU Lane 1:1:1:1/0 (0,0,0)[0,0,0])]
79
+
0x00007ffff623198cinsaxpy() at saxpy.hip:67
80
+
67 y[i] += a*x[i];
67
81
```
68
82
69
83
Note that the cmake build type is set to `RelWithDebInfo` (see line 8 in CMakeLists.txt). With this build type, the debugger will be aware of the debug symbols. If that was not the case (for instance if compiling in `Release` mode), running the code with the debugger you would get an error message ***without*** line info, and also a warning like this one:
@@ -81,7 +95,7 @@ th 1
81
95
where
82
96
```
83
97
84
-
You can add breakpoints with `break` (or `b`) followed by the line number. For instance to put a breakpoint right after the `hipMalloc` lines do `b 72`.
98
+
You can add breakpoints with `break` (or `b`) followed by the line number. For instance to put a breakpoint right after the `hipMalloc` lines do `b 83`.
85
99
86
100
When possible, it is also advised to compile without optimization flags (so using `-O0`) to avoid seeing breakpoints placed on lines different than those specified with the breakpoint command.
87
101
@@ -92,11 +106,11 @@ To list all the breakpoints that have been inserted type `info break` (or `i b`)
92
106
```bash
93
107
(gdb) i b
94
108
Num Type Disp Enb Address What
95
-
1 breakpoint keep y 0x000000000020b334 inmain() at /HPCTrainingExamples/HIP/saxpy/saxpy.hip:74
96
-
2 breakpoint keep y 0x000000000020b350 inmain() at /HPCTrainingExamples/HIP/saxpy/saxpy.hip:78
109
+
1 breakpoint keep y 0x000000000020b334 inmain() at /HPCTrainingExamples/HIP/saxpy/saxpy.hip:85
110
+
2 breakpoint keep y 0x000000000020b350 inmain() at /HPCTrainingExamples/HIP/saxpy/saxpy.hip:88
97
111
```
98
112
99
-
A breakpoint can be removed with `delete <Num>` (or `d <Num>`): note that `<Num>` is the breakpoint ID displayed above. For instance, to remove the breakpoint at line 74, you have to do `d 1`.
113
+
A breakpoint can be removed with `delete <Num>` (or `d <Num>`): note that `<Num>` is the breakpoint ID displayed above. For instance, to remove the breakpoint at line 85, you have to do `d 1`.
100
114
101
115
To proceed to the next line you can do `next` (or `n`). To step into a function, do `step` (or `s`) and to get out do `finish`. Note that if a breakpoint is at a kernel, doing `n` or `s` will switch between different threads. To avoid this behavior, it is necessary to disable the breakpoint at the kernel with `disable <Num>`.
0 commit comments