adc7a1a36aa6775f2fa34d16c979403e94c1350d
[platform/upstream/cmake.git] / Tests / RunCMake / ctest_memcheck / testCudaSanitizer.cmake
1 # this file simulates an execution of cuda-memcheck
2
3 set(LOG_FILE "$ENV{PSEUDO_LOGFILE}")
4 message("LOG_FILE=[${LOG_FILE}]")
5
6 # clear the log file
7 file(REMOVE "${LOG_FILE}")
8
9 # create an error of each type of sanitizer tool and failure
10
11 # initcheck
12 file(APPEND "${LOG_FILE}"
13 "========= CUDA-MEMCHECK
14 ========= Uninitialized __global__ memory read of size 4
15 =========     at 0x00000020 in test(int*, int*)
16 =========     by thread (0,0,0) in block (0,0,0)
17 =========     Address 0x1303d80000
18 =========     Saved host backtrace up to driver entry point
19 =========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
20 =========     Host Frame:./uninit-read [0x101d9]
21 =========     Host Frame:./uninit-read [0x10267]
22 =========     Host Frame:./uninit-read [0x465b5]
23 =========     Host Frame:./uninit-read [0x3342]
24 =========     Host Frame:./uninit-read [0x3143]
25 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
26 =========     Host Frame:./uninit-read [0x31e2]
27 =========
28 ========= Unused memory in allocation 0x1303d80000 of size 16 bytes
29 =========     Not written any memory.
30 =========     100.00% of allocation were unused.
31 =========     Saved host backtrace up to driver entry point
32 =========     Host Frame:/lib64/libcuda.so.1 (cuMemAlloc_v2 + 0x1b7) [0x26ec97]
33 =========     Host Frame:./uninit-read [0x2bbd3]
34 =========     Host Frame:./uninit-read [0x71ab]
35 =========     Host Frame:./uninit-read [0x3c84f]
36 =========     Host Frame:./uninit-read [0x3111]
37 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
38 =========     Host Frame:./uninit-read [0x31e2]
39 =========
40 ========= Host API memory access error at host access to 0x1303fd1400 of size 25600 bytes
41 =========     Uninitialized access at 0x1303fd4600 on access by cudaMemcopy source.
42 =========     Saved host backtrace up to driver entry point at error
43 =========     Host Frame:/usr/lib/x86_64-linux-gnu/libcuda.so.1 (cuMemcpyDtoH_v2 + 0x1ec) [0x29200c]
44 =========     Host Frame:/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.10.1 [0x38aaa]
45 =========     Host Frame:/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.10.1 [0x18946]
46 =========     Host Frame:/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.10.1 (cudaMemcpy + 0x1a2) [0x3b8c2]
47 =========     Host Frame:/something/somewhere [0xcafe]
48 =========
49 ========= ERROR SUMMARY: 2 errors
50 ")
51
52
53 # synccheck
54 file(APPEND "${LOG_FILE}"
55 "========= CUDA-MEMCHECK
56 ========= Barrier error detected. Divergent thread(s) in warp
57 =========     at 0x00000058 in test(int*, int*)
58 =========     by thread (1,0,0) in block (0,0,0)
59 =========     Device Frame:test(int*, int*) (test(int*, int*) : 0x60)
60 =========     Saved host backtrace up to driver entry point at kernel launch time
61 =========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
62 =========     Host Frame:./sync [0x101d9]
63 =========     Host Frame:./sync [0x10267]
64 =========     Host Frame:./sync [0x465b5]
65 =========     Host Frame:./sync [0x3342]
66 =========     Host Frame:./sync [0x314a]
67 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
68 =========     Host Frame:./sync [0x31e2]
69 =========
70 ========= Barrier error detected. Divergent thread(s) in warp
71 =========     at 0x00000058 in test(int*, int*)
72 =========     by thread (0,0,0) in block (0,0,0)
73 =========     Device Frame:test(int*, int*) (test(int*, int*) : 0x60)
74 =========     Saved host backtrace up to driver entry point at kernel launch time
75 =========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
76 =========     Host Frame:./sync [0x101d9]
77 =========     Host Frame:./sync [0x10267]
78 =========     Host Frame:./sync [0x465b5]
79 =========     Host Frame:./sync [0x3342]
80 =========     Host Frame:./sync [0x314a]
81 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
82 =========     Host Frame:./sync [0x31e2]
83 =========
84 ========= ERROR SUMMARY: 2 errors
85 ")
86
87 # memcheck
88 file(APPEND "${LOG_FILE}"
89 "========= CUDA-MEMCHECK
90 ========= Invalid __global__ read of size 4
91 =========     at 0x00000020 in test(int*, int*)
92 =========     by thread (0,0,0) in block (0,0,0)
93 =========     Address 0x00000000 is out of bounds
94 =========     Saved host backtrace up to driver entry point at kernel launch time
95 =========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
96 =========     Host Frame:./invalid-read [0x101d9]
97 =========     Host Frame:./invalid-read [0x10267]
98 =========     Host Frame:./invalid-read [0x465b5]
99 =========     Host Frame:./invalid-read [0x3342]
100 =========     Host Frame:./invalid-read [0x3142]
101 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
102 =========     Host Frame:./invalid-read [0x31e2]
103 =========
104 ========= Program hit cudaErrorLaunchFailure (error 719) due to \"unspecified launch failure\" on CUDA API call to cudaDeviceSynchronize.
105 =========     Saved host backtrace up to driver entry point at error
106 =========     Host Frame:/lib64/libcuda.so.1 [0x3ac5a3]
107 =========     Host Frame:./invalid-read [0x2e576]
108 =========     Host Frame:./invalid-read [0x3147]
109 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
110 =========     Host Frame:./invalid-read [0x31e2]
111 =========
112 ========= Program hit cudaErrorLaunchFailure (error 719) due to \"unspecified launch failure\" on CUDA API call to cudaFree.
113 =========     Saved host backtrace up to driver entry point at error
114 =========     Host Frame:/lib64/libcuda.so.1 [0x3ac5a3]
115 =========     Host Frame:./invalid-read [0x3c106]
116 =========     Host Frame:./invalid-read [0x3150]
117 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
118 =========     Host Frame:./invalid-read [0x31e2]
119 =========
120 ========= Fatal UVM GPU fault of type invalid pde due to invalid address
121 =========     during atomic access to address 0x20be00000
122 =========
123 ========= Fatal UVM CPU fault due to invalid operation
124 =========     during read access to address 0x1357c92000
125 =========
126 ========= LEAK SUMMARY: 0 bytes leaked in 0 allocations
127 ========= ERROR SUMMARY: 3 errors
128 ")
129
130 # memcheck with leak-check full
131 file(APPEND "${LOG_FILE}"
132 "========= CUDA-MEMCHECK
133 ========= Leaked 10 bytes at 0x1303d80000
134 =========     Saved host backtrace up to driver entry point at cudaMalloc time
135 =========     Host Frame:/lib64/libcuda.so.1 (cuMemAlloc_v2 + 0x1b7) [0x26ec97]
136 =========     Host Frame:./leak [0x2bab3]
137 =========     Host Frame:./leak [0x708b]
138 =========     Host Frame:./leak [0x3c72f]
139 =========     Host Frame:./leak [0x3113]
140 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
141 =========     Host Frame:./leak [0x3174]
142 =========
143 ========= LEAK SUMMARY: 10 bytes leaked in 1 allocations
144 ========= ERROR SUMMARY: 1 error
145 ")
146
147 # racecheck with racecheck-report all
148 file(APPEND "${LOG_FILE}"
149 "========= CUDA-MEMCHECK
150 ========= WARN:(Warp Level Programming) Potential WAR hazard detected at __shared__ 0x3 in block (0, 0, 0) :
151 =========     Read Thread (31, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
152 =========     Write Thread (0, 0, 0) at 0x000001a8 in ./race.cu:4:test(int*, int*)
153 =========     Current Value : 0, Incoming Value : 0
154 =========     Saved host backtrace up to driver entry point at kernel launch time
155 =========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
156 =========     Host Frame:./race [0x101d9]
157 =========     Host Frame:./race [0x10267]
158 =========     Host Frame:./race [0x465b5]
159 =========     Host Frame:./race [0x3342]
160 =========     Host Frame:./race [0x314a]
161 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
162 =========     Host Frame:./race [0x31e2]
163 =========
164 ========= WARN:(Warp Level Programming) Potential WAR hazard detected at __shared__ 0x2 in block (0, 0, 0) :
165 =========     Read Thread (31, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
166 =========     Write Thread (0, 0, 0) at 0x000001a8 in ./race.cu:4:test(int*, int*)
167 =========     Current Value : 0, Incoming Value : 0
168 =========     Saved host backtrace up to driver entry point at kernel launch time
169 =========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
170 =========     Host Frame:./race [0x101d9]
171 =========     Host Frame:./race [0x10267]
172 =========     Host Frame:./race [0x465b5]
173 =========     Host Frame:./race [0x3342]
174 =========     Host Frame:./race [0x314a]
175 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
176 =========     Host Frame:./race [0x31e2]
177 =========
178 ========= WARN:(Warp Level Programming) Potential WAR hazard detected at __shared__ 0x1 in block (0, 0, 0) :
179 =========     Read Thread (31, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
180 =========     Write Thread (0, 0, 0) at 0x000001a8 in ./race.cu:4:test(int*, int*)
181 =========     Current Value : 0, Incoming Value : 0
182 =========     Saved host backtrace up to driver entry point at kernel launch time
183 =========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
184 =========     Host Frame:./race [0x101d9]
185 =========     Host Frame:./race [0x10267]
186 =========     Host Frame:./race [0x465b5]
187 =========     Host Frame:./race [0x3342]
188 =========     Host Frame:./race [0x314a]
189 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
190 =========     Host Frame:./race [0x31e2]
191 =========
192 ========= WARN:(Warp Level Programming) Potential WAR hazard detected at __shared__ 0x0 in block (0, 0, 0) :
193 =========     Read Thread (31, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
194 =========     Write Thread (0, 0, 0) at 0x000001a8 in ./race.cu:4:test(int*, int*)
195 =========     Current Value : 0, Incoming Value : 1
196 =========     Saved host backtrace up to driver entry point at kernel launch time
197 =========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
198 =========     Host Frame:./race [0x101d9]
199 =========     Host Frame:./race [0x10267]
200 =========     Host Frame:./race [0x465b5]
201 =========     Host Frame:./race [0x3342]
202 =========     Host Frame:./race [0x314a]
203 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
204 =========     Host Frame:./race [0x31e2]
205 =========
206 ========= WARN:(Warp Level Programming) Potential RAW hazard detected at __shared__ 0x3 in block (0, 0, 0) :
207 =========     Write Thread (31, 0, 0) at 0x00000148 in ./race.cu:3:test(int*, int*)
208 =========     Read Thread (0, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
209 =========     Current Value : 0
210 =========     Saved host backtrace up to driver entry point at kernel launch time
211 =========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
212 =========     Host Frame:./race [0x101d9]
213 =========     Host Frame:./race [0x10267]
214 =========     Host Frame:./race [0x465b5]
215 =========     Host Frame:./race [0x3342]
216 =========     Host Frame:./race [0x314a]
217 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
218 =========     Host Frame:./race [0x31e2]
219 =========
220 ========= WARN:(Warp Level Programming) Potential RAW hazard detected at __shared__ 0x2 in block (0, 0, 0) :
221 =========     Write Thread (31, 0, 0) at 0x00000148 in ./race.cu:3:test(int*, int*)
222 =========     Read Thread (0, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
223 =========     Current Value : 0
224 =========     Saved host backtrace up to driver entry point at kernel launch time
225 =========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
226 =========     Host Frame:./race [0x101d9]
227 =========     Host Frame:./race [0x10267]
228 =========     Host Frame:./race [0x465b5]
229 =========     Host Frame:./race [0x3342]
230 =========     Host Frame:./race [0x314a]
231 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
232 =========     Host Frame:./race [0x31e2]
233 =========
234 ========= WARN:(Warp Level Programming) Potential RAW hazard detected at __shared__ 0x1 in block (0, 0, 0) :
235 =========     Write Thread (31, 0, 0) at 0x00000148 in ./race.cu:3:test(int*, int*)
236 =========     Read Thread (0, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
237 =========     Current Value : 0
238 =========     Saved host backtrace up to driver entry point at kernel launch time
239 =========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
240 =========     Host Frame:./race [0x101d9]
241 =========     Host Frame:./race [0x10267]
242 =========     Host Frame:./race [0x465b5]
243 =========     Host Frame:./race [0x3342]
244 =========     Host Frame:./race [0x314a]
245 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
246 =========     Host Frame:./race [0x31e2]
247 =========
248 ========= WARN:(Warp Level Programming) Potential RAW hazard detected at __shared__ 0x0 in block (0, 0, 0) :
249 =========     Write Thread (31, 0, 0) at 0x00000148 in ./race.cu:3:test(int*, int*)
250 =========     Read Thread (0, 0, 0) at 0x00000170 in ./race.cu:4:test(int*, int*)
251 =========     Current Value : 0
252 =========     Saved host backtrace up to driver entry point at kernel launch time
253 =========     Host Frame:/lib64/libcuda.so.1 (cuLaunchKernel + 0x346) [0x297db6]
254 =========     Host Frame:./race [0x101d9]
255 =========     Host Frame:./race [0x10267]
256 =========     Host Frame:./race [0x465b5]
257 =========     Host Frame:./race [0x3342]
258 =========     Host Frame:./race [0x314a]
259 =========     Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
260 =========     Host Frame:./race [0x31e2]
261 =========
262 ========= WARN: Race reported between Read access at 0x00000170 in ./race.cu:4:test(int*, int*)
263 =========     and Write access at 0x00000148 in ./race.cu:3:test(int*, int*) [4 hazards]
264 =========     and Write access at 0x000001a8 in ./race.cu:4:test(int*, int*) [4 hazards]
265 =========
266 ========= WARN: Race reported between Write access at 0x00000148 in ./race.cu:3:test(int*, int*)
267 =========     and Write access at 0x00000148 in ./race.cu:3:test(int*, int*) [124 hazards]
268 =========     and Read access at 0x00000170 in ./race.cu:4:test(int*, int*) [4 hazards]
269 =========
270 ========= WARN: Race reported between Write access at 0x000001a8 in ./race.cu:4:test(int*, int*)
271 =========     and Write access at 0x000001a8 in ./race.cu:4:test(int*, int*) [124 hazards]
272 =========     and Read access at 0x00000170 in ./race.cu:4:test(int*, int*) [4 hazards]
273 =========
274 ========= WARN: Race reported between Write access at 0x00000148 in ./race.cu:3:test(int*, int*)
275 =========     and Write access at 0x00000148 in ./race.cu:3:test(int*, int*) [124 hazards]
276 =========     and Read access at 0x00000170 in ./race.cu:4:test(int*, int*) [4 hazards]
277 =========
278 ========= RACECHECK SUMMARY: 12 hazards displayed (0 errors, 12 warnings)
279 ")