我有一个使用 Cuda 和 C 的应用程序“A”。使用 Shell 脚本,该应用程序连续运行 2 天。当定期看到产出时,就表明取得了进展。但现在,它突然停止输出任何值。当检查 cudaGetLastError() 时,它返回“未知错误”。
为了检查问题是否出在我的应用程序上,或者是长时间连续使用 Cuda 时出现的未知错误,我尝试执行下面的简单程序
#include <stdio.h>
// time nvcc testing.cu -O3 --ptxas-options=-v
__global__ void testing_()
{
unsigned int tid = blockIdx.x * blockDim.x + threadIdx.x;
printf("%d \n", tid);
}
int main()
{
testing_<<<1,10>>>();
cudaDeviceSynchronize();
cudaError_t err = cudaGetLastError();
printf("CUDA Error: %s\n", cudaGetErrorString(err));
return 0;
}
即使这样也回来了
CUDA Error: unknown error
。--ptxas-options=-v
显示此
ptxas info : 0 bytes gmem ptxas info : Compiling entry function '_Z7testingPoS_S_S_Pm' for 'sm_52' ptxas info : Function properties for _Z7testingPoS_S_S_Pm
0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads ptxas info : Used 94 registers, 30720 bytes smem, 360 bytes cmem[0], 108 bytes cmem[2]
在互联网上搜索了一段时间,看到可能性后,我可以说 block_size 没有问题,没有线程,因为它之前运行没有问题
不存在“A”出界的问题,因为之前运行良好。
另外,这个答案对我不起作用,因为我对 cudaMemcpy() 指向两个设备指针没有问题。(一个是主机,一个是设备,因为它应该是)。
我猜这与共享内存有关。谁能帮我解决这个问题吗?看来问题出在哪里
我使用的是 Ubuntu 22.04,mu GPU 是 NVIDIA Corporation GA107M [GeForce RTX 3050 Mobile] / NVIDIA GeForce RTX 3050 Laptop GPU/PCIe/SSE2
提问者是同一个人
我重新启动了笔记本电脑,现在似乎可以正常运行。
但现在,我仍然想知道最初的问题是什么,因为我计划不间断地运行应用程序“A”几天。我能做什么?并且请不要说使用 shell 脚本每 2 天重新启动一次笔记本电脑