NVCC command line to just build PTX .. without needing cl.exe?

Is it possible to use NVCC to build only a .PTX file without the need for the visual studio cl.exe?

From what I can gather the cl.exe is only needed for host code compiling as the gpu PTX stuff should all be handled by nvcc.

My current command line is:

[codebox]“%CUDA_BIN_PATH%\nvcc.exe” -arch sm_13 -m 32 -use_fast_math -DNVCC -Xcompiler “/EHsc /W3 /nologo /Ox /Zi” -I"…/" -I"%OPTIX_INCLUDE%" -maxrregcount=32 -ptx -o “in.cu” “out.ptx”[/codebox]

I tried removing ‘-Xcompiler “/EHsc /W3 /nologo /Ox /Zi”’ with no luck and can’t see how cl.exe be needed when it should be for host code but I may eb wrong?

I would set the path to the cl.exe but I don’t want to hard code this as the directory could change between computer systems and version etc. I could just say that an environemtn variable must be created manually for this though… but thats not nice.

Alternatively is it okay to put the cl.exe in the applciation directory to overcome this. It would probably need a lot of files along with it though.

I don’t believe that can work. nvcc is only a compiler driver, not a standalone compiler. It requires the host C preprocessor even when compiling device code. There is an explanation of compilation trajectories in the nvcc documentation that comes with the toolkit, if you are interested in how it works.

Thats a annoying. I guess I will have to cope with the issue. Kind of limits the ability for a user to easily edit a snippet of code and have the application compile it easily.

Thanks for the help.