gpt4 book ai didi

c++ - (CUDA)nvcc 无法在我的项目中正确解析工具包路径,而在示例项目中它可以

转载 作者:行者123 更新时间:2023-11-30 03:08:15 24 4
gpt4 key购买 nike

我一直在尝试将一个 .cu 文件添加到我自己的(dll)win32 项目中并编译它,在 Windows7 上使用 VS2008。我能够在 cppIntegration 示例项目中编译 .cu,但在我的项目中我遇到了问题。

起初,我收到错误“不知道如何处理“工具包...”。似乎 nvcc 遇到了问题,因为工具包的路径中有空格。重命名 NVIDIA 工具包时文件夹没有空格,我得到了同样的错误,但现在它从"file"开始说同样的错误,它是“程序文件”文件夹的一部分,也有一个空格。

请注意,在 cppIntegration 中它工作正常,尽管它具有完全相同的路径。所以我 SymbLink 工具包路径,现在在我的项目中编译 .cu 文件时出现了不同的错误(但在 cppIntegration 中没有)。 “找不到指定的路径”。我假设这指的是我刚刚 SymbLinked 的相同路径。

我认为我需要更改项目属性中的某些内容。也许我正在构建一个 dll 的事实导致了这个问题。也许它必须用 64 位版本的 CUDA 做一些事情,而我在 32 位中做 win32(也许?)。

谢谢。

更新

这是我在VS2008中编译时的输出

Compiling with CUDA Build Rule...
1>"\MyCUDA\CUDA\v3.2\\bin\nvcc.exe"

-gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --machine 32 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -I"\MyCUDA\CUDA\v3.2\include" -maxrregcount=32 --compile -o ".\Intermediate\Release/Decoder.cu.obj" Decoder.cu

1>The system cannot find the path specified.

1>Project : error PRJ0019: A tool returned an error code from "Compiling with CUDA Build Rule..."

这是 cppIntegration 的编译:

"\MyCUDA\CUDA\v3.2\bin\nvcc.exe"
-gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --machine 32 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -I"\MyCUDA\CUDA\v3.2\include" -maxrregcount=32 --compile -o "Release/cppIntegration.cu.obj" cppIntegration.cu

最佳答案

我解决了我的问题。问题是,我的环境变量 CUDA_PATH 中有\MyCUDA。这适用于 cppIntegration,因为它在 C: 上,但不适用于我的项目,因为它在 E: 上。所以我不得不添加 C:\MyCUDA。它仍然没有解释为什么 nvcc 不喜欢路径中的空格。

希望有人会觉得这很有用。

关于c++ - (CUDA)nvcc 无法在我的项目中正确解析工具包路径,而在示例项目中它可以,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5213799/

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