From 6b8ae1e27c54abd61f68dd8d98f903386fb9b391 Mon Sep 17 00:00:00 2001 From: Francesco Gatti Date: Sun, 16 May 2021 22:16:21 +0200 Subject: [PATCH 1/2] remove wrong cuda arch that cause big performance gap fix #226 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3a89f5..0383add 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ add_definitions(-DTKDNN_PATH="${CMAKE_CURRENT_SOURCE_DIR}") find_package(CUDA 9.0 REQUIRED) SET(CUDA_SEPARABLE_COMPILATION ON) #set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -arch=sm_30 --compiler-options '-fPIC'") -set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --maxrregcount=32 -arch=sm_61 ) +set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --maxrregcount=32) find_package(CUDNN REQUIRED) include_directories(${CUDNN_INCLUDE_DIR}) From ba8199a03088b7c8e36066a1636a1237ab316cec Mon Sep 17 00:00:00 2001 From: Francesco Gatti Date: Sun, 16 May 2021 22:33:45 +0200 Subject: [PATCH 2/2] fix compile error on old tensorrt and remove useless prints --- include/tkDNN/pluginsRT/YoloRT.h | 24 ++++++++++++------------ src/NetworkRT.cpp | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/tkDNN/pluginsRT/YoloRT.h b/include/tkDNN/pluginsRT/YoloRT.h index 2911869..5ffe39c 100644 --- a/include/tkDNN/pluginsRT/YoloRT.h +++ b/include/tkDNN/pluginsRT/YoloRT.h @@ -93,23 +93,23 @@ public: virtual void serialize(void* buffer) override { char *buf = reinterpret_cast(buffer),*a=buf; - tk::dnn::writeBUF(buf, classes); std::cout << "Classes :" << classes << std::endl; - tk::dnn::writeBUF(buf, num); std::cout << "Num : " << num << std::endl; - tk::dnn::writeBUF(buf, n_masks); std::cout << "N_Masks" << n_masks << std::endl; - tk::dnn::writeBUF(buf, scaleXY); std::cout << "ScaleXY :" << scaleXY << std::endl; - tk::dnn::writeBUF(buf, nms_thresh); std::cout << "nms_thresh :" << nms_thresh << std::endl; - tk::dnn::writeBUF(buf, nms_kind); std::cout << "nms_kind : " << nms_kind << std::endl; - tk::dnn::writeBUF(buf, new_coords); std::cout << "new_coords : " << new_coords << std::endl; - tk::dnn::writeBUF(buf, c); std::cout << "C : " << c << std::endl; - tk::dnn::writeBUF(buf, h); std::cout << "H : " << h << std::endl; - tk::dnn::writeBUF(buf, w); std::cout << "C : " << c << std::endl; + tk::dnn::writeBUF(buf, classes); //std::cout << "Classes :" << classes << std::endl; + tk::dnn::writeBUF(buf, num); //std::cout << "Num : " << num << std::endl; + tk::dnn::writeBUF(buf, n_masks); //std::cout << "N_Masks" << n_masks << std::endl; + tk::dnn::writeBUF(buf, scaleXY); //std::cout << "ScaleXY :" << scaleXY << std::endl; + tk::dnn::writeBUF(buf, nms_thresh); //std::cout << "nms_thresh :" << nms_thresh << std::endl; + tk::dnn::writeBUF(buf, nms_kind); //std::cout << "nms_kind : " << nms_kind << std::endl; + tk::dnn::writeBUF(buf, new_coords); //std::cout << "new_coords : " << new_coords << std::endl; + tk::dnn::writeBUF(buf, c); //std::cout << "C : " << c << std::endl; + tk::dnn::writeBUF(buf, h); //std::cout << "H : " << h << std::endl; + tk::dnn::writeBUF(buf, w); //std::cout << "C : " << c << std::endl; for (int i = 0; i < n_masks; i++) { - tk::dnn::writeBUF(buf, mask[i]); std::cout << "mask[i] : " << mask[i] << std::endl; + tk::dnn::writeBUF(buf, mask[i]); //std::cout << "mask[i] : " << mask[i] << std::endl; } for (int i = 0; i < n_masks * 2 * num; i++) { - tk::dnn::writeBUF(buf, bias[i]); std::cout << "bias[i] : " << bias[i] << std::endl; + tk::dnn::writeBUF(buf, bias[i]); //std::cout << "bias[i] : " << bias[i] << std::endl; } // save classes names diff --git a/src/NetworkRT.cpp b/src/NetworkRT.cpp index 320c3ea..a95423d 100644 --- a/src/NetworkRT.cpp +++ b/src/NetworkRT.cpp @@ -139,8 +139,8 @@ NetworkRT::NetworkRT(Network *net, const char *name) { #if NV_TENSORRT_MAJOR >= 6 engineRT = builderRT->buildEngineWithConfig(*networkRT, *configRT); #else - //engineRT = builderRT->buildCudaEngine(*networkRT); - engineRT = std::shared_ptr(builderRT->buildCudaEngine(*networkRT)); + engineRT = builderRT->buildCudaEngine(*networkRT); + //engineRT = std::shared_ptr(builderRT->buildCudaEngine(*networkRT)); #endif if(engineRT == nullptr) FatalError("cloud not build cuda engine")