0

I'm new to Visual Studio 2010, as I was used to compile my CUDA codes with nvcc using Linux as operating system. Incidentally in some posts of this and the NVIDIA Developer Zone forums, I have read warnings on proper compilation in Visual Studio (Debug/Release modes, see link for the difference between the two) to correctly use of the NVIDIA Visual Profiler. In my (poor) understanding, Visual Studio automatically compiles under a "Debug" mode, but for a successful profile the "Release" mode is necessary.

My (simple) questions are:

1) How do I switch from the "Debug" mode to the "Release" mode? Is it enough to use Properties -> Configuration Properties and select "Release" instead of "Active(Debug)"? Also, I noticed that I have to repeat the selection each time I want to Rebuild the project.

2) Is this enough for a correct usage of the Visual Profiler?

Thank you very much in advance.

Community
  • 1
  • 1
Vitality
  • 20,705
  • 4
  • 108
  • 146

2 Answers2

2

1) You're switching from Debug to Release in the wrong place. The setting you're using is just for selecting which build settings to view or edit. You should use Build | Configuration Manager or (easier) the Solution Configurations dropdown box in the Standard toolbar. If you don't see the Standard toolbar, right click in the toolbar area by the menu, and select it there. You will find that you don't have to reselect the setting for each build now.

2) The CUDA compiler optimizes aggressively even in Debug mode. I don't know if it matters which configuration you use. Both should work. You can try and see if you get any different results.

Roger Dahl
  • 15,132
  • 8
  • 62
  • 82
  • Thank you for your answer. I then used to dropbox menu in the standard toolbar. Just a recommendation for other people. When doing this for the first time, do not forget to update the compute capability compilation option and the external libraries to be linked. – Vitality Jan 10 '13 at 10:56
1

See Roger Dahl's answer for how to set the configuration.

There are several forms of profiling.

Performance Profiling

This should definitely be done with optimizations enabled on the CUDA kernel. Disabling optimization and specifying debug information performs more operations than a CPU but it does do other modifications to the code (stack overflow checks) that will impact counters.

Source Level Profiling

This can be done on Debug or Release builds. Nsight 3.0 CUDA Profiler has source level experiments that will show statistics per C source, PTX, or SASS line. The CUDA 5.0 Visual Profiler supports code correlated experiments but will not show the results for every line (only problematic lines). Disabling optimizations will result in significantly more accurate line information for the SASS to PTX to C code mapping. For many analysis cases this is fine. However, if you want to understand the code generation per C line then you should enable full optimizations and heavily look at the SASS code and only use C source and PTX as a guide.

In order to get C source level correlation you need to use the default debug configuration which generates full debug information or use a custom configuration that enable -lineinfo. This option can be enabled using the following steps:

  1. Open Solution Explorer
  2. Right click on your .cu file or project file
  3. Execute the Properties command
  4. In the left pane select the tree node Configuration Properties | CUDA C/C++ | Device
  5. In the right pane change Generate Line Number Information to Yes

In CUDA 5.0 -lineinfo has several small impacts on code generation so it is not advisable to keep this enabled in your Release configuration.

Greg Smith
  • 11,007
  • 2
  • 36
  • 37