我在一个具有 1GB 全局内存的 GPU 上运行这个程序。它给出了以下错误:
Fatal error: cudaMemcpy1 error (unspecified launch failure at CheckDevice.cu:27)
*** FAILED - ABORTING
========= Out-of-range Shared or Local Address
========= at 0x000006a8 in grid::SetSubgridMarker(grid*, grid*)
========= by thread (0,0,0) in block (0,0,0)
========= Device Frame:SetAllFlags_dev(param_t*, grid*) (SetAllFlags_dev(param_t*, grid*) : 0x108)
========= Device Frame:SetAllFlags(param_t*, grid*) (SetAllFlags(param_t*, grid*) : 0x38)
========= Saved host backtrace up to driver entry point at kernel launch time
========= Host Frame:/usr/lib/libcuda.so (cuLaunchKernel + 0x3dc) [0xc9edc]
========= Host Frame:/usr/local/cuda/lib64/libcudart.so.5.0 [0xa18a]
========= Host Frame:/usr/local/cuda/lib64/libcudart.so.5.0 (cudaLaunch + 0x17f) [0x2f4cf]
========= Host Frame:Transport [0xd395]
========= Host Frame:Transport [0xd7bd]
========= Host Frame:/lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main + 0xed) [0x2176d]
========= Host Frame:Transport [0x17bd]
=========
========= Program hit error 4 on CUDA API call to cudaMemcpy
========= Saved host backtrace up to driver entry point at error
========= Host Frame:/usr/lib/libcuda.so [0x26a180]
========= Host Frame:/usr/local/cuda/lib64/libcudart.so.5.0 (cudaMemcpy + 0x271) [0x348e1]
========= Host Frame:Transport [0x2cea]
========= Host Frame:Transport [0x3769]
========= Host Frame:Transport [0xd7ee]
========= Host Frame:/lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main + 0xed) [0x2176d]
========= Host Frame:Transport [0x17bd]
=========
========= Program hit error 4 on CUDA API call to cudaGetLastError
========= Saved host backtrace up to driver entry point at error
========= Host Frame:/usr/lib/libcuda.so [0x26a180]
========= Host Frame:/usr/local/cuda/lib64/libcudart.so.5.0 (cudaGetLastError + 0x1e6) [0x2a046]
========= Host Frame:Transport [0x2cef]
========= Host Frame:Transport [0x3769]
========= Host Frame:Transport [0xd7ee]
========= Host Frame:/lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main + 0xed) [0x2176d]
========= Host Frame:Transport [0x17bd]
=========
========= ERROR SUMMARY: 3 errors
对于未指定的启动失败错误,相关代码行是一个 cudaMemcpy 操作:
cudaMemcpy(CurrentGrid, Grid_dev, sizeof(grid), cudaMemcpyDeviceToHost);
cudaCheckErrors("cudaMemcpy1 error");
然后如错误消息所示,它说Out-of-range Shared or Local Address at 0x000006a8 in grid::SetSubgridMarker(grid*, grid*)
。是因为设备上的全局内存用完了吗?有没有办法返回设备上的内存使用情况?
在源代码中, checkDevice.cu 在 grid::SetSubgridMarker 之后执行,并且 checkDevice 不会在设备上消耗太多内存空间,所以我猜测(但没有太多信心)它grid::SetSubgridMarker
耗尽了内存,因此没有空间启动 cudaMemcpy手术。有什么建议么?非常感谢!