CUDA编译错误

发布于 2024-10-15 13:18:58 字数 2146 浏览 0 评论 0原文

我编写第一个 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:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夕嗳→ 2024-10-22 13:18:58

您的目录名称中似乎有一些非拉丁字符,这可能会导致问题。您可以尝试将工具包和您的项目放入没有此类字符的目录中吗?您可能还需要将 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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文