A question about command options of -ptx,-cubin How to use command options correctly ?

I want to use opitions -ptx and -cubin command to generate .ptx and cubin,but the progaram can’t run correctly.

The program environment is : windows xp,vs 2005.

Original comand line:

(CUDA_BIN_PATH)\nvcc.exe" -ccbin "(VCInstallDir)bin” -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MTd -I"$(CUDA_INC_PATH)" -I./ -I…/…/common/inc -o

$(ConfigurationName)\histogram64.obj histogram64.cu

I changed the above command to be:

$(CUDA_BIN_PATH)\nvcc.exe -ptx histogram64.cu histogram64_kernel.cu

After changed the command line,I compiled the solution,and then an error occured:

LINK : fatal error LNK1181: can not open input file“.\Debug\histogram64.obj”.

Why does’t nvcc have more than one options,like this “nvcc.exe -ptx -cubin inputfile.cu”?

who can tell me why?I will be grateful!

Best regards.

This is not an issue with nvcc. Rather, your having issues with your Visual Studio project setup - your command line doesn’t generate an object file, which is expected by Visual Studio for subsequent steps (if you use the project compile). I bet if you right-click on the .cu file and then choose “compile” from the context menu you’ll get what you want.

Paulius

Thank your reply!

Let me try!

When I set the command line like:

$(CUDA_BIN_PATH)\nvcc.exe -ptx histogram64.cu histogram64_kernel.cu

and the right-click the .cu file and choosed “complile” ,I can get the .ptx file and the file can be compiled correctly.

But,if I want to run program,I must modify the command line like:

(CUDA_BIN_PATH)\nvcc.exe" -ccbin "(VCInstallDir)bin” -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MTd -I"(CUDA_INC_PATH)" -I./ -I../../common/inc -o (ConfigurationName)\histogram64.obj histogram64.cu

So, I want to know:

is there a way that I could get the .ptx(or .cubin) file correctly without changing the command line ?

-keep flag. Please read the nvcc reference manual that comes with CUDA installation for a list of the flags.