gpt4 book ai didi

compiler-construction - 尝试让 CUDA 工作,示例找不到 helper_cuda.h

转载 作者:行者123 更新时间:2023-12-03 00:12:37 30 4
gpt4 key购买 nike

我刚刚安装了 CUDA 并一直关注 http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-mac-os-x/index.html

一切正常,直到我尝试将示例代码(例如 deviceQuery)复制到 ~/Desktop 并编译。

我在编译时遇到以下错误:

/Developer/NVIDIA/CUDA-5.5/bin/nvcc -ccbin g++ -I../../common/inc  -m64 -Xcompiler -arch -Xcompiler x86_64   -gencode arch=compute_10,code=sm_10 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=\"sm_35,compute_35\" -o deviceQuery.o -c deviceQuery.cpp
deviceQuery.cpp:23:25: error: helper_cuda.h: No such file or directory
deviceQuery.cpp: In function ‘int main(int, char**)’:
deviceQuery.cpp:111: error: ‘SPRINTF’ was not declared in this scope
deviceQuery.cpp:116: error: ‘_ConvertSMVer2Cores’ was not declared in this scope
deviceQuery.cpp:206: error: ‘checkCudaErrors’ was not declared in this scope
deviceQuery.cpp:230: error: ‘checkCudaErrors’ was not declared in this scope
deviceQuery.cpp:241: error: ‘checkCudaErrors’ was not declared in this scope
make: *** [deviceQuery.o] Error 1

代码会编译并在CUDA目录中运行,很明显编译器找不到helper_cuda.h,我也找不到它,有人有解决方案吗?

最佳答案

根据编译选项-I../../common/inc所示,helper_cuda.h位于$CUDA_HOME/samples/common/inc/.

如果您想将示例复制到自定义位置,则必须复制整个 samples 目录,或修改一些代码/编译选项以将工作人员包含在 common/ 中> 目录。

关于compiler-construction - 尝试让 CUDA 工作,示例找不到 helper_cuda.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19352941/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com