【发布时间】:2012-02-11 01:25:20
【问题描述】:
为了估计程序在一次内核启动中可以处理多少数据,我尝试使用cudaMemGetInfo() 获取一些内存信息。但是,编译器告诉我:
错误:标识符“cudaMemGetInfo”未定义
cudaGetDeviceProperties(); 等其他功能可以正常工作。我必须安装某个 CUDA 版本吗? library description 不包含版本等信息。
编辑:尽可能小的代码。 cudaSetDevice() 不会生成编译器错误,而 cudaMemGetInfo() 会生成
#include <cuda.h>
#include <cuda_runtime_api.h>
int main(){
unsigned int f, t;
cudaSetDevice(0);
cudaMemGetInfo(&f, &t);
return 0;
}
编辑 2:
我在 Linux 上使用“Cuda 编译工具,版本 2.0,V0.2.1221”(nvcc)。
当我尝试使用cudaDriverGetVersion() 安装cuda 驱动程序版本时,发生了同样的错误(当我使用驱动程序函数cuDriverGetVersion() 时也是如此)。
好像系统不会让我知道任何关于它自己的细节...
【问题讨论】:
-
你是否包含了 cuda_runtime_api.h ?
-
@Pavan:到目前为止,我只包括 cuda.h。如果我也包含 cuda_runtime_api.h 错误仍然存在。
-
你能发布一个可以由其他人编译的 concede repro 案例来证明这个问题吗?该函数在 CUDA 1.0 之前就已经在 API 中了,所以肯定有其他问题。
-
请粘贴确切的编译器警告。
-
@Callahan:我在这里最初的评论有点错误 -
cuMemGetInfo一直在驱动程序 API 中,但运行时 API 等效项仅在 CUDA 3.0 中添加。因为您使用的是真正古老的 CUDA 版本,所以您无权访问该 API 调用。您最初对版本的怀疑被证明是正确的。
标签: cuda