nvcc crashes during compilation
I have the following configuration:
[list]
[*]GeForce GTS 250
[*]Windows 7
[*]CUDA Toolkit 4.0
[*]GPU Computing SDK 4.0
[*]MS Visual C++ Express 2010
[/list]

I write a simple program and save it in cuda.cu:
[code]
#include <stdio.h>

__global__ void kernel()
{
}

int main()
{
kernel <<<1,1>>>();
printf("Hello, world!!!");
return 0;
}
[/code]

Then I launch the compiler:
nvcc -ccbin C:\dev\MSVS\VC\bin cuda.cu

After a few seconds of working nvcc crashes. Notice that "nvcc -V" and "nvcc --help" works well. Sample programs from GPU Computing SDK also compile from Visual Studio without any problem.

What do I do wrong?
I have the following configuration:


  • GeForce GTS 250
  • Windows 7
  • CUDA Toolkit 4.0
  • GPU Computing SDK 4.0
  • MS Visual C++ Express 2010




I write a simple program and save it in cuda.cu:



#include <stdio.h>



__global__ void kernel()

{

}



int main()

{

kernel <<<1,1>>>();

printf("Hello, world!!!");

return 0;

}




Then I launch the compiler:

nvcc -ccbin C:\dev\MSVS\VC\bin cuda.cu



After a few seconds of working nvcc crashes. Notice that "nvcc -V" and "nvcc --help" works well. Sample programs from GPU Computing SDK also compile from Visual Studio without any problem.



What do I do wrong?

#1
Posted 09/07/2011 12:08 PM   
Can you show the exact output produced by the compiler when compiling this code with nvcc? As a side note, device-side printf() requires a GPU with compute capability 2.x, which I don't think the GTS 250 has? By default, nvcc targets compute capability 1.0, you can use the compiler switches -arch or -gencode to target other compute capabilities.
Can you show the exact output produced by the compiler when compiling this code with nvcc? As a side note, device-side printf() requires a GPU with compute capability 2.x, which I don't think the GTS 250 has? By default, nvcc targets compute capability 1.0, you can use the compiler switches -arch or -gencode to target other compute capabilities.

#2
Posted 09/07/2011 05:25 PM   
Why did you decide that printf() is device-side? I supposed it to be host-side.

I found the reason of the problem. It is very strange and mysterious. The call [b]nvcc --verbose -ccbin C:\dev\MSVS\VC\bin cuda.cu[/b] gives the following output:
[code]
#$ _SPACE_=
#$ _CUDART_=cudart
#$ _HERE_=(null)
[/code]
and the compiler crashes.
But if use not [b]nvcc[/b] but [b]nvcc.exe[/b] everything goes ok. Thus [b]nvcc.exe --verbose -ccbin C:\dev\MSVS\VC\bin cuda.cu[/b] outputs
[code]
#$ _SPACE_=
#$ _CUDART_=cudart
#$ _HERE_=<CUDA Toolkit install dir>
....
[/code]
and compiles successfully.

It is very strange to me that adding .exe to the file's name on Windows changes its behavior.
Why did you decide that printf() is device-side? I supposed it to be host-side.



I found the reason of the problem. It is very strange and mysterious. The call nvcc --verbose -ccbin C:\dev\MSVS\VC\bin cuda.cu gives the following output:



#$ _SPACE_=

#$ _CUDART_=cudart

#$ _HERE_=(null)


and the compiler crashes.

But if use not nvcc but nvcc.exe everything goes ok. Thus nvcc.exe --verbose -ccbin C:\dev\MSVS\VC\bin cuda.cu outputs



#$ _SPACE_=

#$ _CUDART_=cudart

#$ _HERE_=<CUDA Toolkit install dir>

....


and compiles successfully.



It is very strange to me that adding .exe to the file's name on Windows changes its behavior.

#3
Posted 09/08/2011 06:49 AM   
[quote name='Shishkov Ilya' date='08 September 2011 - 07:49 AM' timestamp='1315464555' post='1290107']
Why did you decide that printf() is device-side? I supposed it to be host-side. [...]
[/quote]

Sorry, I was reading too fast. Glad to hear you were able to resolve the issue.
[quote name='Shishkov Ilya' date='08 September 2011 - 07:49 AM' timestamp='1315464555' post='1290107']

Why did you decide that printf() is device-side? I supposed it to be host-side. [...]





Sorry, I was reading too fast. Glad to hear you were able to resolve the issue.

#4
Posted 09/08/2011 04:42 PM   
Scroll To Top