Problem with nvcc compiler example

“nvcc -C:\users\gmoe\source\EX1.cu -o C:\users\gmoe\nv-out\EX1.o” command doesn’t indicate any errors, but doesn’t produce a “Hello” output file. What am I missing?

There are possibly several issues here. But the first issue is that “Hello” doesn’t appear anywhere in your nvcc command. nvcc doesn’t produce files named “Hello” automatically.

The file EX1,cu in the command is the text from Example one in your tutorial, which is C code to produce “Hello from kernal \n”. eg:

include <stdio.h>
global void kernel() {
printf(“Hello from kernel\n”);
}

void kernel_launcher() {
kernel<<<1, 1>>>();
cudaDeviceSynchronize();
}

int main() {
kernel_launcher();
return 0;
}

Why doesn’t that produce an output?

I would probably need to ask a few more questions.

When you typed the nvcc compile command, did you actually include a dash right here, the way you show in the original post in this thread:

did you actually type that dash before the capital C? Because that is not a correct compile command and probably should have shown a compile error.

No, I don’t think I did include that dash in my compile attempt. I ran it again without the dash, and now I get an error message that says “can’t find c1.exe in PATH”. I haven’t been able to find such an exe file in my directories, and when I search I get a bunch of warnings on the net that suggest c1.exe is not needed and may be malware. When I search for a download on Microsoft.com I get referred to MS Visual, which I have already downloaded and updated. Any advise about that?

It’s not complaining about c1.exe but actually cl.exe. cl.exe is the host compiler that is part of visual studio. If nvcc cannot find cl.exe, then your machine is not properly set up for the way you are trying to compile. The suggestion is already there - add the proper path to cl.exe to your PATH env var on windows. You can find various forum posts about this, I won’t be able to point to a tutorial here.

The other option would be to build as a VS project rather than trying to compile from the command line. Again, discussed in various forum posts.

OK, I finally got compiler to work on a simpler version of “hello” script. Dealing with Microsoft programs is always such a hassle! Thanks much for your help and your patience.

My current goal is to see how well my RTX5060 does on vector operations. Much learning ahead I am sure, but away I go.