summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ctest_memcheck/testCudaMemcheck.cmake
blob: adc7a1a36aa6775f2fa34d16c979403e94c1350d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# this file simulates an execution of cuda-memcheck

set(LOG_FILE "$ENV{PSEUDO_LOGFILE}")
message("LOG_FILE=[${LOG_FILE}]")

# clear the log file
file(REMOVE "${LOG_FILE}")

# create an error of each type of sanitizer tool and failure

# initcheck
file(APPEND "${LOG_FILE}"
"========= CUDA-MEMCHECK
========= Uninitialized __global__ memory read of size 4
=========     at 0x00000020 in test(int*, int*)
=========     by thread (0,0,0) in block (0,0,0)
=========     Address 0x1303d80000
=========     Saved host backtrace up to driver entry point
=========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
=========     Host Frame:./uninit-read [0x101d9]
=========     Host Frame:./uninit-read [0x10267]
=========     Host Frame:./uninit-read [0x465b5]
=========     Host Frame:./uninit-read [0x3342]
=========     Host Frame:./uninit-read [0x3143]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./uninit-read [0x31e2]
=========
========= Unused memory in allocation 0x1303d80000 of size 16 bytes
=========     Not written any memory.
=========     100.00% of allocation were unused.
=========     Saved host backtrace up to driver entry point
=========     Host Frame:/lib64/libcuda.so.1 (cuMemAlloc_v2 + 0x1b7) [0x26ec97]
=========     Host Frame:./uninit-read [0x2bbd3]
=========     Host Frame:./uninit-read [0x71ab]
=========     Host Frame:./uninit-read [0x3c84f]
=========     Host Frame:./uninit-read [0x3111]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./uninit-read [0x31e2]
=========
========= Host API memory access error at host access to 0x1303fd1400 of size 25600 bytes
=========     Uninitialized access at 0x1303fd4600 on access by cudaMemcopy source.
=========     Saved host backtrace up to driver entry point at error
=========     Host Frame:/usr/lib/x86_64-linux-gnu/libcuda.so.1 (cuMemcpyDtoH_v2 + 0x1ec) [0x29200c]
=========     Host Frame:/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.10.1 [0x38aaa]
=========     Host Frame:/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.10.1 [0x18946]
=========     Host Frame:/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.10.1 (cudaMemcpy + 0x1a2) [0x3b8c2]
=========     Host Frame:/something/somewhere [0xcafe]
=========
========= ERROR SUMMARY: 2 errors
")


# synccheck
file(APPEND "${LOG_FILE}"
"========= CUDA-MEMCHECK
========= Barrier error detected. Divergent thread(s) in warp
=========     at 0x00000058 in test(int*, int*)
=========     by thread (1,0,0) in block (0,0,0)
=========     Device Frame:test(int*, int*) (test(int*, int*) : 0x60)
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
=========     Host Frame:./sync [0x101d9]
=========     Host Frame:./sync [0x10267]
=========     Host Frame:./sync [0x465b5]
=========     Host Frame:./sync [0x3342]
=========     Host Frame:./sync [0x314a]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./sync [0x31e2]
=========
========= Barrier error detected. Divergent thread(s) in warp
=========     at 0x00000058 in test(int*, int*)
=========     by thread (0,0,0) in block (0,0,0)
=========     Device Frame:test(int*, int*) (test(int*, int*) : 0x60)
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
=========     Host Frame:./sync [0x101d9]
=========     Host Frame:./sync [0x10267]
=========     Host Frame:./sync [0x465b5]
=========     Host Frame:./sync [0x3342]
=========     Host Frame:./sync [0x314a]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./sync [0x31e2]
=========
========= ERROR SUMMARY: 2 errors
")

# memcheck
file(APPEND "${LOG_FILE}"
"========= CUDA-MEMCHECK
========= Invalid __global__ read of size 4
=========     at 0x00000020 in test(int*, int*)
=========     by thread (0,0,0) in block (0,0,0)
=========     Address 0x00000000 is out of bounds
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
=========     Host Frame:./invalid-read [0x101d9]
=========     Host Frame:./invalid-read [0x10267]
=========     Host Frame:./invalid-read [0x465b5]
=========     Host Frame:./invalid-read [0x3342]
=========     Host Frame:./invalid-read [0x3142]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./invalid-read [0x31e2]
=========
========= Program hit cudaErrorLaunchFailure (error 719) due to \"unspecified launch failure\" on CUDA API call to cudaDeviceSynchronize.
=========     Saved host backtrace up to driver entry point at error
=========     Host Frame:/lib64/libcuda.so.1 [0x3ac5a3]
=========     Host Frame:./invalid-read [0x2e576]
=========     Host Frame:./invalid-read [0x3147]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./invalid-read [0x31e2]
=========
========= Program hit cudaErrorLaunchFailure (error 719) due to \"unspecified launch failure\" on CUDA API call to cudaFree.
=========     Saved host backtrace up to driver entry point at error
=========     Host Frame:/lib64/libcuda.so.1 [0x3ac5a3]
=========     Host Frame:./invalid-read [0x3c106]
=========     Host Frame:./invalid-read [0x3150]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./invalid-read [0x31e2]
=========
========= Fatal UVM GPU fault of type invalid pde due to invalid address
=========     during atomic access to address 0x20be00000
=========
========= Fatal UVM CPU fault due to invalid operation
=========     during read access to address 0x1357c92000
=========
========= LEAK SUMMARY: 0 bytes leaked in 0 allocations
========= ERROR SUMMARY: 3 errors
")

# memcheck with leak-check full
file(APPEND "${LOG_FILE}"
"========= CUDA-MEMCHECK
========= Leaked 10 bytes at 0x1303d80000
=========     Saved host backtrace up to driver entry point at cudaMalloc time
=========     Host Frame:/lib64/libcuda.so.1 (cuMemAlloc_v2 + 0x1b7) [0x26ec97]
=========     Host Frame:./leak [0x2bab3]
=========     Host Frame:./leak [0x708b]
=========     Host Frame:./leak [0x3c72f]
=========     Host Frame:./leak [0x3113]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./leak [0x3174]
=========
========= LEAK SUMMARY: 10 bytes leaked in 1 allocations
========= ERROR SUMMARY: 1 error
")

# racecheck with racecheck-report all
file(APPEND "${LOG_FILE}"
"========= CUDA-MEMCHECK
========= WARN:(Warp Level Programming) Potential WAR hazard detected at __shared__ 0x3 in block (0, 0, 0) :
=========     Read Thread (31, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
=========     Write Thread (0, 0, 0) at 0x000001a8 in ./race.cu:4:test(int*, int*)
=========     Current Value : 0, Incoming Value : 0
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
=========     Host Frame:./race [0x101d9]
=========     Host Frame:./race [0x10267]
=========     Host Frame:./race [0x465b5]
=========     Host Frame:./race [0x3342]
=========     Host Frame:./race [0x314a]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./race [0x31e2]
=========
========= WARN:(Warp Level Programming) Potential WAR hazard detected at __shared__ 0x2 in block (0, 0, 0) :
=========     Read Thread (31, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
=========     Write Thread (0, 0, 0) at 0x000001a8 in ./race.cu:4:test(int*, int*)
=========     Current Value : 0, Incoming Value : 0
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
=========     Host Frame:./race [0x101d9]
=========     Host Frame:./race [0x10267]
=========     Host Frame:./race [0x465b5]
=========     Host Frame:./race [0x3342]
=========     Host Frame:./race [0x314a]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./race [0x31e2]
=========
========= WARN:(Warp Level Programming) Potential WAR hazard detected at __shared__ 0x1 in block (0, 0, 0) :
=========     Read Thread (31, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
=========     Write Thread (0, 0, 0) at 0x000001a8 in ./race.cu:4:test(int*, int*)
=========     Current Value : 0, Incoming Value : 0
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
=========     Host Frame:./race [0x101d9]
=========     Host Frame:./race [0x10267]
=========     Host Frame:./race [0x465b5]
=========     Host Frame:./race [0x3342]
=========     Host Frame:./race [0x314a]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./race [0x31e2]
=========
========= WARN:(Warp Level Programming) Potential WAR hazard detected at __shared__ 0x0 in block (0, 0, 0) :
=========     Read Thread (31, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
=========     Write Thread (0, 0, 0) at 0x000001a8 in ./race.cu:4:test(int*, int*)
=========     Current Value : 0, Incoming Value : 1
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
=========     Host Frame:./race [0x101d9]
=========     Host Frame:./race [0x10267]
=========     Host Frame:./race [0x465b5]
=========     Host Frame:./race [0x3342]
=========     Host Frame:./race [0x314a]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./race [0x31e2]
=========
========= WARN:(Warp Level Programming) Potential RAW hazard detected at __shared__ 0x3 in block (0, 0, 0) :
=========     Write Thread (31, 0, 0) at 0x00000148 in ./race.cu:3:test(int*, int*)
=========     Read Thread (0, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
=========     Current Value : 0
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
=========     Host Frame:./race [0x101d9]
=========     Host Frame:./race [0x10267]
=========     Host Frame:./race [0x465b5]
=========     Host Frame:./race [0x3342]
=========     Host Frame:./race [0x314a]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./race [0x31e2]
=========
========= WARN:(Warp Level Programming) Potential RAW hazard detected at __shared__ 0x2 in block (0, 0, 0) :
=========     Write Thread (31, 0, 0) at 0x00000148 in ./race.cu:3:test(int*, int*)
=========     Read Thread (0, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
=========     Current Value : 0
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
=========     Host Frame:./race [0x101d9]
=========     Host Frame:./race [0x10267]
=========     Host Frame:./race [0x465b5]
=========     Host Frame:./race [0x3342]
=========     Host Frame:./race [0x314a]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./race [0x31e2]
=========
========= WARN:(Warp Level Programming) Potential RAW hazard detected at __shared__ 0x1 in block (0, 0, 0) :
=========     Write Thread (31, 0, 0) at 0x00000148 in ./race.cu:3:test(int*, int*)
=========     Read Thread (0, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
=========     Current Value : 0
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
=========     Host Frame:./race [0x101d9]
=========     Host Frame:./race [0x10267]
=========     Host Frame:./race [0x465b5]
=========     Host Frame:./race [0x3342]
=========     Host Frame:./race [0x314a]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./race [0x31e2]
=========
========= WARN:(Warp Level Programming) Potential RAW hazard detected at __shared__ 0x0 in block (0, 0, 0) :
=========     Write Thread (31, 0, 0) at 0x00000148 in ./race.cu:3:test(int*, int*)
=========     Read Thread (0, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
=========     Current Value : 0
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
=========     Host Frame:./race [0x101d9]
=========     Host Frame:./race [0x10267]
=========     Host Frame:./race [0x465b5]
=========     Host Frame:./race [0x3342]
=========     Host Frame:./race [0x314a]
=========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
=========     Host Frame:./race [0x31e2]
=========
========= WARN: Race reported between Read access at 0x00000170 in ./race.cu:4:test(int*, int*)
=========     and Write access at 0x00000148 in ./race.cu:3:test(int*, int*) [4 hazards]
=========     and Write access at 0x000001a8 in ./race.cu:4:test(int*, int*) [4 hazards]
=========
========= WARN: Race reported between Write access at 0x00000148 in ./race.cu:3:test(int*, int*)
=========     and Write access at 0x00000148 in ./race.cu:3:test(int*, int*) [124 hazards]
=========     and Read access at 0x00000170 in ./race.cu:4:test(int*, int*) [4 hazards]
=========
========= WARN: Race reported between Write access at 0x000001a8 in ./race.cu:4:test(int*, int*)
=========     and Write access at 0x000001a8 in ./race.cu:4:test(int*, int*) [124 hazards]
=========     and Read access at 0x00000170 in ./race.cu:4:test(int*, int*) [4 hazards]
=========
========= WARN: Race reported between Write access at 0x00000148 in ./race.cu:3:test(int*, int*)
=========     and Write access at 0x00000148 in ./race.cu:3:test(int*, int*) [124 hazards]
=========     and Read access at 0x00000170 in ./race.cu:4:test(int*, int*) [4 hazards]
=========
========= RACECHECK SUMMARY: 12 hazards displayed (0 errors, 12 warnings)
")