CUDA编译错误
我编写第一个 CUDA 代码如下:
#include<iostream>
__global__ void kernel ()
{
}
int main()
{
kernel<<<1, 1>>> ();
std::cout<<"hello world"<<std:endl;
system("pause");
return 0;
}
我按照这两页上的说明设置了 Visual Studio 2008:
但是在编译它之后,它会产生错误。我不知道问题出在哪里,也不知道我哪里出了问题。以下是在 32 位 Windows 7 系统上运行时构建输出窗口包含的内容:
1>------ Build started: Project: CUDA, Configuration: Debug Win32 ------
1>Compiling with CUDA Build Rule...
1>"C:\Program Files\NVIDIA GPU Computing Toolkit\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 "d:\Program Files\Microsoft Visual Studio 9.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\include" -maxrregcount=32 --compile -o "Debug/main.cu.obj" main.cu
1>main.cu
1>Catastrophic error: cannot open source file "C:/Users/露隆/AppData/Local/Temp/tmpxft_000011e4_00000000-8_main.compute_10.cpp1.ii"
1>1 catastrophic error detected in the compilation of "C:/Users/露隆/AppData/Local/Temp/tmpxft_000011e4_00000000-8_main.compute_10.cpp1.ii".
1>Compilation terminated.
1>Project : error PRJ0019: A tool returned an error code from "Compiling with CUDA Build Rule..."
1>Build log was saved at "file://c:\Users\丁\AppData\Local\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\src\CUDA\Debug\BuildLog.htm"
1>CUDA - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
您能帮我解决这个问题吗?我已经在 SDK src
目录中运行了一些示例,并且可以成功编译并运行示例 deveicQuery
,但是当我尝试编译 BandWithTest
时,我得到同样的错误。
I write my first CUDA code as follows:
#include<iostream>
__global__ void kernel ()
{
}
int main()
{
kernel<<<1, 1>>> ();
std::cout<<"hello world"<<std:endl;
system("pause");
return 0;
}
And I set up Visual Studio 2008 following the instructions on these two pages:
- Easiest Way to Run CUDA on Visual Studio 2008
- How do I start a new CUDA project in Visual Studio 2008?
But after I compile it, it produces an error. I do not know what the problem is, or where I have gone wrong. Here is what the build output window contains when running on a 32-bit Windows 7 system:
1>------ Build started: Project: CUDA, Configuration: Debug Win32 ------
1>Compiling with CUDA Build Rule...
1>"C:\Program Files\NVIDIA GPU Computing Toolkit\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 "d:\Program Files\Microsoft Visual Studio 9.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\\include" -maxrregcount=32 --compile -o "Debug/main.cu.obj" main.cu
1>main.cu
1>Catastrophic error: cannot open source file "C:/Users/露隆/AppData/Local/Temp/tmpxft_000011e4_00000000-8_main.compute_10.cpp1.ii"
1>1 catastrophic error detected in the compilation of "C:/Users/露隆/AppData/Local/Temp/tmpxft_000011e4_00000000-8_main.compute_10.cpp1.ii".
1>Compilation terminated.
1>Project : error PRJ0019: A tool returned an error code from "Compiling with CUDA Build Rule..."
1>Build log was saved at "file://c:\Users\丁\AppData\Local\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\src\CUDA\Debug\BuildLog.htm"
1>CUDA - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Could you please help me to resolve this problem? I have run some examples in the SDK src
directory, and I can compile and run the example deveicQuery
sucessfully, but when I try to compile BandWithTest
, I get the same error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的目录名称中似乎有一些非拉丁字符,这可能会导致问题。您可以尝试将工具包和您的项目放入没有此类字符的目录中吗?您可能还需要将 TMPDIR 和 TEMPDIR 环境变量(我想我记得正确)也指向仅限拉丁语的路径。
如果这是问题所在,请发回此处并考虑提交错误(如果您还没有成为注册开发人员,则需要成为注册开发人员)。
It looks like you have some non-latin characters in your directory names and that may be causing issues. Can you try putting the toolkit and your project into a directory without such characters? You'll probably also need to point the TMPDIR and TEMPDIR environment variables (I think I remembered those correctly) to latin-only paths too.
If that is the problem then please post back here and also consider filing a bug (you need to become a registered developer if you're not already).