From: Michal Sojka Date: Thu, 11 Oct 2018 22:23:18 +0000 (+0200) Subject: Add NVTX markers to the code X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hercules2020/kcf.git/commitdiff_plain/30d8c76bf336be98952d5ff16afb3356920f1640?hp=7c16a96d82c181a319c35a438f22342c1f5bbbe2 Add NVTX markers to the code This makes it easier to understand nvprof timelines. --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ae11abf..80a8387 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -91,6 +91,7 @@ IF(use_cuda) CUDA_SELECT_NVCC_ARCH_FLAGS(ARCH_FLAGS ${CUDA_ARCH_LIST}) list( APPEND CUDA_NVCC_FLAGS -O3 -std=c++11 ${ARCH_FLAGS} --default-stream per-thread) # --gpu-architecture sm_62 ) find_cuda_helper_libs(cufftw) + find_cuda_helper_libs(nvToolsExt) ENDIF() add_subdirectory(piotr_fhog) @@ -124,7 +125,7 @@ IF(FFT STREQUAL "cuFFTW") ENDIF() #cuFFTW IF(FFT STREQUAL "cuFFT") - target_link_libraries(kcf ${CUDA_cufft_LIBRARY} ${CUDA_cublas_LIBRARY} ${CUDA_LIBRARIES}) + target_link_libraries(kcf ${CUDA_cufft_LIBRARY} ${CUDA_cublas_LIBRARY} ${CUDA_LIBRARIES} ${CUDA_nvToolsExt_LIBRARY}) ENDIF() IF(PROFILING) diff --git a/src/debug.h b/src/debug.h index 6ad1d18..07c6ee7 100644 --- a/src/debug.h +++ b/src/debug.h @@ -11,6 +11,7 @@ #ifdef CUFFT #include +#include "nvToolsExt.h" #endif @@ -52,6 +53,9 @@ class DbgTracer { public: FTrace(DbgTracer &dt, const char *fn, const char *format, ...) : t(dt), funcName(fn) { +#ifdef CUFFT + nvtxRangePushA(fn); +#endif if (!t.debug) return; char *arg; va_list vl; @@ -65,6 +69,9 @@ class DbgTracer { } ~FTrace() { +#ifdef CUFFT + nvtxRangePop(); +#endif if (!t.debug) return; t.indentLvl--; std::cerr << t.indent() << "}" << std::endl;