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.