2

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.

Community
  • 1
  • 1
ztdep
  • 343
  • 1
  • 4
  • 17
  • 2
    possible duplicate of [Unable to open cpp1.ii file while compiling CUDA project](http://stackoverflow.com/questions/3615750/unable-to-open-cpp1-ii-file-while-compiling-cuda-project) – Cody Gray - on strike Feb 29 '12 at 17:49

1 Answers1

2

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).

Tom
  • 20,852
  • 4
  • 42
  • 54
  • I agree - the compiler is only failing because it can't open (usually that means that the directory doesn't exist, it can't find the directory, or the file has been flagged as read only). In your case I'm guessing it is the reason mentioned above. – Marm0t Feb 04 '11 at 17:34