Reputation: 41
we have C++ code that we want to profile with Nividia Nsight Eclipse (Linux version) before adding CUDA code to it. The idea is to profile C++ first, find hotspots, convert those to CUDA, profile again, and iterate through this process to successively speed up the code. However, when we profile C++ only it looks like the profiler requires some existing CUDA code before it generates a timeline and profile output. Has anyone else encountered this?
Upvotes: 4
Views: 874
Reputation: 771
Yes, Nsight Eclipse can profile C++ code. To rephrase your question, it can also profile Host (CPU) C++ code. By default, it only profiles GPU code. CPU profiling is a much more manual task; it will not profile functions automatically.
You need to use NVTX. Like so:
#include "nvToolsExt.h"
nvtxNameOsThread(0,"InputVideo");
nvtxRangePush(__FUNCTION__);
// .. do some CPU computing here
nvtxRangePop();
Build with -lnvToolsExt -L/usr/local/cuda/lib64
The path to libnvToolsExt.so will be different for everyone. NVTX comes with the CUDA Toolkit.
The CUDA blog has a post on this.
Upvotes: 1
Reputation: 21108
You can manually instrument your code using nvtx (NVIDIA Tools Extension) and have the timeline shown in Nsight, but for automatic profiling and detailed counters it can only profile GPU code.
Upvotes: 1
Reputation: 9474
Nsight Eclipse Edition can only profile CUDA code. You may want to install 3rd party profiling plug-ins to profile host code.
You may try installing OProfile integration from the Eclipse Foundation site (paste http://download.eclipse.org/releases/indigo/ into Help/Install New Software... dialog) - I just tried it but was unable to properly setup oprofile command-line.
Upvotes: 2