【发布时间】:2014-02-15 05:58:14
【问题描述】:
我想知道为什么我在 Internet 上找到的简单 Cuda 代码示例都不适合我,我发现即使是最简单的代码也会导致错误:
#include <stdio.h>
int main(int argc, char ** argv) {
size_t available, total;
cudaError_t err = cudaMemGetInfo(&available, &total);
if (err == cudaErrorMemoryAllocation) {
printf("cudaErrorMemoryAllocation");
} else {
printf("OK or not memory allocation error");
}
return 0;
}
上面的代码总是打印出“cudaErrorMemoryAllocation”。
这是该程序的 cuda-memcheck 测试的输出:
cudaErrorMemoryAllocation
========= CUDA-MEMCHECK
========= Program hit error 2 on CUDA API call to cudaMemGetInfo
========= Saved host backtrace up to driver entry point at error
========= Host Frame:C:\Windows\SYSTEM32\nvcuda.dll (cuD3D11CtxCreate + 0x118a92) [0x137572]
========= Host Frame:D:\Cuda\a.exe [0x1223]
========= Host Frame:D:\Cuda\a.exe [0x101c]
========= Host Frame:D:\Cuda\a.exe [0x901f]
========= Host Frame:C:\Windows\system32\KERNEL32.DLL (BaseThreadInitThunk + 0x1a) [0x1832]
========= Host Frame:C:\Windows\SYSTEM32\ntdll.dll (RtlUserThreadStart + 0x21) [0x5d609]
=========
========= ERROR SUMMARY: 1 error
平台 Windows 8 64 位
编译器 Visual Studio 2008
计算能力 1.1 (GeForce 8800 GT)
CUDA 版本 5.5
【问题讨论】:
-
您能否正确运行 CUDA SDK 示例,尤其是 deviceQuery 示例?
-
是的,我可以运行 deviceQuery,它会正确打印出我的 8800 GT 的配置。但是,我尝试启动的其他一些示例因“CUDA error code=2 (cudaErrorMemoryAllocation)”而失败
-
我希望我没有把你引向错误的方向,但我会调查可能的驱动程序问题。您是否为您的卡使用正确的驱动程序?重装驱动怎么样?
-
我的卡有一个可用的更新,所以我已经安装了它。不幸的是,它并没有解决问题。
标签: cuda out-of-memory runtime-error