No .ptx file is generated when I compile a project in Visual Studio 2010. I set the .cu file’s properties to -ptx. I am using CUDA 4.0 and Optix 2.1 RC2 on Windows 7 professional 64.
My program runs fine if I use the .ptx files that came with the tutorials in the SDK. The .obj files are generated, and it goes through the process of compiling.
I used Windows search to look any .ptx files on the system, and none came up that weren’t included in the SDK. I cannot find anything about this issue online.
Bump. The lack of clear documentation on how to do this is ridiculous. I just need to generate a .ptx file from a .cu file. Selecting -ptx in Visual studio does not do anything. There is no explicitly clear explanation of what exactly to put in the nvcc command line if you do it manually.
Really? Have you tried nvcc --help? Or the nvcc manual pdf? The ptx option is clearly documented:
--ptx (-ptx)
Compile all .cu/.gpu input files to device- only .ptx files. This step
discards the host code for each of these input file.
Executing “nvcc -ptx file.cu” produces file.ptx in the current working directory. You can use the option “-o /path/to/output.ptx” to change the output path.
ion\OptiX SDK 2.1.0\include" -I"C:\Program Files (x86)\Microsoft Visual Studio 1
0.0\VC\include" --machine 32
Is what I’ve been trying. I get the error “missing source file name”. I don’t know what that means. It originally gave me the error that it couldn’t find any of the windows include files, so I copied them into the OptiX folder. I have never used command line for compiling for. I’ve had no reason to. It is unreasonable to expect someone who’s never used it before to know what to do without explicit instruction. I was stuck for 2 days because I did not know you could not use spaces in names without quotes.
It does not specify these things anywhere.
It works if I use a blank .cu file. But I cannot compile anything in the SDK nor the example above.
Another thing. One of the SDK files stated it required “NOMINMAX” defined on Windows. I tried define NOMINMAX and it still did not work. It turned out that you have to define it before include Windows.h. I was literally stuck on this for a month. It was a huge waste of time. It might seem obvious to someone who’s used this before, but without explicit instruction, I don’t see any reason to assume these specifics.
I’ve got to say, 3 years later things don’t appear to have improved much. I can produce a .ptx output, but I also get the error message,
1>LINK : fatal error LNK1561: entry point must be defined
1>
1>Build FAILED.
Or is this supposed to happen when creating .ptx output because the final .exe gets discarded? Honestly, aren’t there instructions on doing this through the IDE anywhere?
Go to the Project Properties in Visual Studio 2010. In CUDA C/C++, in Common change the property Keep Preprocessed Files to Yes(–keep). Build the project. You can see the .ptx file in Debug folder.
regaards