From c8ed6d782a143e25972fc6797e044188e2d308c9 Mon Sep 17 00:00:00 2001 From: Francesco Gatti Date: Mon, 1 Jun 2020 16:15:29 +0200 Subject: [PATCH] all test ok --- include/tkDNN/DarknetParser.h | 12 ++++++------ include/tkDNN/DetectionNN.h | 12 ++++++------ include/tkDNN/test.h | 8 ++++---- include/tkDNN/utils.h | 6 +++--- tests/backbones/dla34/dla34.cpp | 8 ++++---- tests/backbones/resnet101/resnet101.cpp | 8 ++++---- tests/centernet/dla34_cnet/dla34_cnet.cpp | 8 ++++---- tests/centernet/resnet101_cnet/resnet101_cnet.cpp | 8 ++++---- tests/imuodom/imuodom.cpp | 4 ++-- tests/mnist/test_mnist.cpp | 8 ++++---- tests/mnist/test_mnistRT.cpp | 8 ++++---- .../bdd-mobilenetv2ssd/bdd-mobilenetv2ssd.cpp | 8 ++++---- tests/mobilenet/mobilenetv2ssd/mobilenetv2ssd.cpp | 8 ++++---- .../mobilenetv2ssd512/mobilenetv2ssd512.cpp | 8 ++++---- tests/simple/test_simple.cpp | 8 ++++---- tests/test_rtinference/rtinference.cpp | 4 ++-- 16 files changed, 63 insertions(+), 63 deletions(-) diff --git a/include/tkDNN/DarknetParser.h b/include/tkDNN/DarknetParser.h index a918a5b..cbeed48 100644 --- a/include/tkDNN/DarknetParser.h +++ b/include/tkDNN/DarknetParser.h @@ -124,7 +124,7 @@ namespace tk { namespace dnn { } tk::dnn::Network *darknetAddNet(darknetFields_t &fields) { - std::cout<<"Add Net: "<= netLayers.size()) FatalError("impossible to shortcut\n"); - std::cout<<"shortcut to "<getLayerName()<<"\n"; + //std::cout<<"shortcut to "<getLayerName()<<"\n"; netLayers.push_back(new tk::dnn::Shortcut(net, netLayers[layerIdx])); } else if(f.type == "upsample") { @@ -177,7 +177,7 @@ namespace tk { namespace dnn { if(layerIdx < 0) layerIdx = netLayers.size() + layerIdx; if(layerIdx < 0 || layerIdx >= netLayers.size()) FatalError("impossible to route\n"); - std::cout<<"Route to "<getLayerName()<<"\n"; + //std::cout<<"Route to "<getLayerName()<<"\n"; layers.push_back(netLayers[layerIdx]); } netLayers.push_back(new tk::dnn::Route(net, layers.data(), layers.size())); @@ -190,7 +190,7 @@ namespace tk { namespace dnn { } else if(f.type == "yolo") { std::string wgs = wgs_path + "/g" + std::to_string(netLayers.size()) + ".bin"; - printf("%d %d %s %d %f\n", f.classes, f.num/f.n_mask, wgs.c_str(), f.n_mask, f.scale_xy); + //printf("%d %d %s %d %f\n", f.classes, f.num/f.n_mask, wgs.c_str(), f.n_mask, f.scale_xy); tk::dnn::Yolo *l = new tk::dnn::Yolo(net, f.classes, f.num/f.n_mask, wgs, f.n_mask, f.scale_xy); if(names.size() != f.classes) FatalError("Mismatch between number of classes and names"); diff --git a/include/tkDNN/DetectionNN.h b/include/tkDNN/DetectionNN.h index 144ded5..030cf8f 100644 --- a/include/tkDNN/DetectionNN.h +++ b/include/tkDNN/DetectionNN.h @@ -106,14 +106,14 @@ class DetectionNN { originalSize.clear(); if(TKDNN_VERBOSE) printCenteredTitle(" TENSORRT detection ", '=', 30); { - TIMER_START + TKDNN_TSTART for(int bi=0; biinfer(dim, input_d); - TIMER_STOP + TKDNN_TSTOP if(TKDNN_VERBOSE) dim.print(); stats.push_back(t_ns); if(save_times) *times< input_bins, std::vector tk::dnn::dataDim_t dim1 = net->input_dim; //input dim printCenteredTitle(" CUDNN inference ", '=', 30); { dim1.print(); - TIMER_START + TKDNN_TSTART net->infer(dim1, data); - TIMER_STOP + TKDNN_TSTOP dim1.print(); } for(int i=0; idstData; @@ -45,9 +45,9 @@ int testInference(std::vector input_bins, std::vector tk::dnn::dataDim_t dim2 = net->input_dim; printCenteredTitle(" TENSORRT inference ", '=', 30); { dim2.print(); - TIMER_START + TKDNN_TSTART netRT->infer(dim2, data); - TIMER_STOP + TKDNN_TSTOP dim2.print(); } for(int i=0; ibuffersRT[i+1]; diff --git a/include/tkDNN/utils.h b/include/tkDNN/utils.h index cc9a4cd..f9f6ae7 100644 --- a/include/tkDNN/utils.h +++ b/include/tkDNN/utils.h @@ -39,15 +39,15 @@ #define TKDNN_VERBOSE 0 // Simple Timer -#define TIMER_START timespec start, end; \ +#define TKDNN_TSTART timespec start, end; \ clock_gettime(CLOCK_MONOTONIC, &start); -#define TIMER_STOP_C(col, show) clock_gettime(CLOCK_MONOTONIC, &end); \ +#define TKDNN_TSTOP_C(col, show) clock_gettime(CLOCK_MONOTONIC, &end); \ double t_ns = ((double)(end.tv_sec - start.tv_sec) * 1.0e9 + \ (double)(end.tv_nsec - start.tv_nsec))/1.0e6; \ if(show) std::cout<enqueue(1, buffers, stream, nullptr); - TIMER_STOP + TKDNN_TSTOP checkCuda(cudaMemcpyAsync(output, buffers[outputIndex],10*sizeof(float), cudaMemcpyDeviceToHost, stream)); cudaStreamSynchronize(stream); } diff --git a/tests/mobilenet/bdd-mobilenetv2ssd/bdd-mobilenetv2ssd.cpp b/tests/mobilenet/bdd-mobilenetv2ssd/bdd-mobilenetv2ssd.cpp index 1549983..c3c6472 100644 --- a/tests/mobilenet/bdd-mobilenetv2ssd/bdd-mobilenetv2ssd.cpp +++ b/tests/mobilenet/bdd-mobilenetv2ssd/bdd-mobilenetv2ssd.cpp @@ -477,9 +477,9 @@ int main() printCenteredTitle(" CUDNN inference ", '=', 30); { dim1.print(); - TIMER_START + TKDNN_TSTART net.infer(dim1, data); - TIMER_STOP + TKDNN_TSTOP dim1.print(); } @@ -492,9 +492,9 @@ int main() printCenteredTitle(" TENSORRT inference ", '=', 30); { dim2.print(); - TIMER_START + TKDNN_TSTART netRT.infer(dim2, data); - TIMER_STOP + TKDNN_TSTOP dim2.print(); } diff --git a/tests/mobilenet/mobilenetv2ssd/mobilenetv2ssd.cpp b/tests/mobilenet/mobilenetv2ssd/mobilenetv2ssd.cpp index 787341f..58463a4 100644 --- a/tests/mobilenet/mobilenetv2ssd/mobilenetv2ssd.cpp +++ b/tests/mobilenet/mobilenetv2ssd/mobilenetv2ssd.cpp @@ -477,9 +477,9 @@ int main() printCenteredTitle(" CUDNN inference ", '=', 30); { dim1.print(); - TIMER_START + TKDNN_TSTART net.infer(dim1, data); - TIMER_STOP + TKDNN_TSTOP dim1.print(); } @@ -492,9 +492,9 @@ int main() printCenteredTitle(" TENSORRT inference ", '=', 30); { dim2.print(); - TIMER_START + TKDNN_TSTART netRT.infer(dim2, data); - TIMER_STOP + TKDNN_TSTOP dim2.print(); } diff --git a/tests/mobilenet/mobilenetv2ssd512/mobilenetv2ssd512.cpp b/tests/mobilenet/mobilenetv2ssd512/mobilenetv2ssd512.cpp index 8886232..54b00c1 100644 --- a/tests/mobilenet/mobilenetv2ssd512/mobilenetv2ssd512.cpp +++ b/tests/mobilenet/mobilenetv2ssd512/mobilenetv2ssd512.cpp @@ -476,9 +476,9 @@ int main() printCenteredTitle(" CUDNN inference ", '=', 30); { dim1.print(); - TIMER_START + TKDNN_TSTART net.infer(dim1, data); - TIMER_STOP + TKDNN_TSTOP dim1.print(); } @@ -491,9 +491,9 @@ int main() printCenteredTitle(" TENSORRT inference ", '=', 30); { dim2.print(); - TIMER_START + TKDNN_TSTART netRT.infer(dim2, data); - TIMER_STOP + TKDNN_TSTOP dim2.print(); } diff --git a/tests/simple/test_simple.cpp b/tests/simple/test_simple.cpp index b2b0441..10b0d2f 100644 --- a/tests/simple/test_simple.cpp +++ b/tests/simple/test_simple.cpp @@ -38,18 +38,18 @@ int main() { tk::dnn::dataDim_t dim1 = dim; //input dim printCenteredTitle(" CUDNN inference ", '=', 30); { dim1.print(); - TIMER_START + TKDNN_TSTART out_data = net.infer(dim1, data); - TIMER_STOP + TKDNN_TSTOP dim1.print(); } tk::dnn::dataDim_t dim2 = dim; printCenteredTitle(" TENSORRT inference ", '=', 30); { dim2.print(); - TIMER_START + TKDNN_TSTART out_data2 = netRT.infer(dim2, data); - TIMER_STOP + TKDNN_TSTOP dim2.print(); } diff --git a/tests/test_rtinference/rtinference.cpp b/tests/test_rtinference/rtinference.cpp index 4b6b21f..a629168 100644 --- a/tests/test_rtinference/rtinference.cpp +++ b/tests/test_rtinference/rtinference.cpp @@ -42,9 +42,9 @@ int main(int argc, char *argv[]) { checkCuda(cudaMemcpy(input_d, input, idim.tot()*sizeof(dnnType), cudaMemcpyHostToDevice)); tk::dnn::dataDim_t dim = idim; - TIMER_START + TKDNN_TSTART netRT.infer(dim, input_d); - TIMER_STOP + TKDNN_TSTOP total_time+= t_ns; // control output