]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/commitdiff
Add NVTX markers to the code
authorMichal Sojka <michal.sojka@cvut.cz>
Thu, 11 Oct 2018 22:23:18 +0000 (00:23 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Thu, 11 Oct 2018 22:23:18 +0000 (00:23 +0200)
This makes it easier to understand nvprof timelines.

src/CMakeLists.txt
src/debug.h

index ae11abfd5a0d55893fd014641d4e0325b7341bc3..80a8387ea71e86b52b3ee55adb67a4d628be4d21 100644 (file)
@@ -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)
index 6ad1d18c1d70ffd17a7f42d12619e0fb2e93c5df..07c6ee77a532ebc5bf2208e476441b26792c138b 100644 (file)
@@ -11,6 +11,7 @@
 
 #ifdef CUFFT
 #include <cufft.h>
+#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;