简体   繁体   中英

Can Nsight Eclipse profile C++ code?

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?

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.

您可以使用nvtx(NVIDIA工具扩展)手动检测代码,并在Nsight中显示时间轴,但对于自动分析和详细计数器,它只能分析GPU代码。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM