Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check global device memory using cuda-gdb

Tags:

cuda

I am trying to use cuda-gdb to check global device memory. It seems the values are all zero, even after cudaMemcpy. However, in the kernel, the values in the shared memory are good. Any idea? Does cuda-gdb even checks for global device memory at all. It seems host memory and device shared memory are fine. Thanks.

like image 925
small_potato Avatar asked Jul 13 '11 18:07

small_potato


2 Answers

Suppose d_array is a pointer to device memory,

(cuda-gdb) print d_array
$1 = (double *) 0x13082c3000

To access its value, first convert it to a global memory pointer:

(cuda-gdb) print ((@global double *)d_array)[0]
$2 = 0.5

To access the array:

(cuda-gdb) print ((@global double *)d_array)[0]@3
$3 = {0.5, 0.4, 0.3}
like image 188
Xing Shi Avatar answered Sep 20 '22 13:09

Xing Shi


Currently cuda-gdb can read the data you copied into global memory only after the CUDA kernel has launched. That might improve in future releases.

like image 45
Mayank Avatar answered Sep 19 '22 13:09

Mayank