Compiler code optimisation

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”?

I use:
Visual studio 2005
8600GT

Thanks lanzelot

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.

Thanx Mister Anderson

I googled a bit and i think Ifound the command you talked about:

Link: NVIDIA

In Visual Studio in the Solution Explorer → right click on my file → Properties → Costum build step → general → Command Line

There I added the Command like this:

Now my Problem is I cannot find a file with the assebly code. Also in the “output” while compiling there is nothing.

Did I add the Command to the right line and the right way?

Where can I find the file? (I think in the project folder)

EDIT:

If i add -ptx or -keep I always get an error:

fatal error LNK1181: cannot open input file ‘.\Release\bwTest.obj’ bandwidthTestForum

My command line looks like this:

"$(CUDA_BIN_PATH)\nvcc.exe" -ptx --opencc-options -LIST:source=on -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)\bwTest.obj bwTest.cu

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.

Thanx Mr Anderson
This was the solution External Image I only changed the “-ptx” to “-keep”. Now it compiles without any errors.

The file is in the same folder like the object file.

have a nice day
lanzelot