Is O3 always good option in nvcc ? compiling with nvcc, when there is no error at least...

Hi,

I use nvcc to compile my .cu codes and I’m wondering if O3 is always the best option. I know the default optimization level is 3 but when I actually put -O3 while compiling, I get better times.

From what I understand I need to put -O3 always there. Am I right?

Thanks for advice

The default optimization level for GPU code is 3 which is set by [font=“Courier New”]-Xopencc=-O3[/font].
[font=“Courier New”]-O3[/font] sets the optimization level for CPU code.

Note that -Xopencc -O3 only controls the optimization level for the Open64 portion of the compiler. -Xptxas -O3 is the corresponding control for the PTXAS portion of the compiler. I would recommend against using such component-level controls in anything resembling production builds. In general CUDA programmers will be best served by using the compiler defaults.