nvcc crashes during compilation

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?

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.

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.

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