使用cuda-gdb检查全局设备内存 [英] check global device memory using cuda-gdb

查看:263
本文介绍了使用cuda-gdb检查全局设备内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用cuda-gdb来检查全局设备内存。看来值都是零,即使在cudaMemcpy后。然而,在内核中,共享内存中的值是好的。任何想法? cuda-gdb甚至检查全局设备内存。它似乎主机内存和设备共享内存都很好。谢谢。

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.

推荐答案

假设d_array是指向设备内存的指针,

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

数组:

(cuda-gdb) print ((@global double *)d_array)[0]@3
$3 = {0.5, 0.4, 0.3}

这篇关于使用cuda-gdb检查全局设备内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆