Hello
I get special results in my program. I suppose the compiler optimise some code away. The program is to test performance. Therefore i do “stupid” things just to use gpu power.
Is there a possibility to see which code the compiler optimise away?
Is it possible to say to the compiler: “Do not optimise code”?
The dead code optimizer will happily optimize away your entire kernel if you comment out the line that writes the results to global memory. I am not aware of any way to disable this optimizer.
Compile with the keep or ptx option to see the “assembly” code that the optimizer outputs. There is an additional option (something like list source on, sorry I don’t recall the exact syntax) that will add the C code as comments in the ptx.
When you add -ptx, the compiler will no longer produce the object file that Visual Studio is expecting, giving you the error. You can always use the -keep option which should generate the object file along with the ptx and a bunch of other temporary files that nvcc uses.
I would look for the ptx in the same directory where the object files are written.