newbie's question

Hi everyone,

I’m new to both mac and CUDA :blink: , so I have a beginner’s question: If I have written a .cu file, which I copied from some beginner’s sample online, how could I compile it to an executable file with nvcc and gcc?

Please show me the detail instructions, Thx :rolleyes:

Easiest thing to do is copy one of the simple example directories, replace the main .cu and kernel.cu file and edit the Makefile.

/Chris

That’s what I do all the time. I seem to be incapable of building Xcode project structures reliably from scratch!

I did that by the toolkit reference successfully, but I am still curious about how could we compile .cu file without using makefile, do anyone know how to do that?

And thx for the reply from cnicotra and MacFan

You can use nvcc from the command line the same way you use gcc:

nvcc file.cu

I did that but can’t get an executable file

I found that by default, nvcc doesn’t put the binary in the current directory. I’m not sure where it goes, but if I include the -o option when I call nvcc, I get my binary, as expected. So for me, in bash, my command might be, “nvcc testprog.cu -o mybin”, then to run, just “./mybin”.

Paul

Thx, I got it External Media