From 9a8c672dd6eb21448fbfb4b636104323d128de88 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Wed, 21 Mar 2018 17:52:35 +0000 Subject: COMPMID-1011: Create struct for the graph config parameters Change-Id: I9c164a817c0cc5f264a5c71a59256dacc6314cb0 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/125456 Tested-by: Jenkins Reviewed-by: Anthony Barbier --- examples/graph_alexnet.cpp | 7 ++++--- examples/graph_googlenet.cpp | 13 +++++++------ examples/graph_inception_v3.cpp | 11 ++++++----- examples/graph_inception_v4.cpp | 11 ++++++----- examples/graph_lenet.cpp | 11 ++++++----- examples/graph_mobilenet.cpp | 7 ++++--- examples/graph_resnet50.cpp | 11 ++++++----- examples/graph_squeezenet.cpp | 11 ++++++----- examples/graph_squeezenet_v1_1.cpp | 11 ++++++----- examples/graph_vgg16.cpp | 11 ++++++----- examples/graph_vgg19.cpp | 13 +++++++------ 11 files changed, 64 insertions(+), 53 deletions(-) (limited to 'examples') diff --git a/examples/graph_alexnet.cpp b/examples/graph_alexnet.cpp index 6ba3ebc7ae..885db337e9 100644 --- a/examples/graph_alexnet.cpp +++ b/examples/graph_alexnet.cpp @@ -55,8 +55,6 @@ public: // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; Target target_hint = set_target_hint2(target); - bool enable_tuning = (target == 2); - bool enable_memory_management = true; // TODO (geopin01) : Get GPU target somehow and set gemm also for midgard ? const bool is_gemm_convolution5x5 = (target_hint == Target::NEON); @@ -163,7 +161,10 @@ public: << OutputLayer(get_output_accessor(label, 5)); // Finalize graph - graph.finalize(target_hint, enable_tuning, enable_memory_management); + GraphConfig config; + config.use_function_memory_manager = true; + config.use_tuner = (target == 2); + graph.finalize(target_hint, config); } void do_run() override { diff --git a/examples/graph_googlenet.cpp b/examples/graph_googlenet.cpp index e97f3acdfd..d6e76fdced 100644 --- a/examples/graph_googlenet.cpp +++ b/examples/graph_googlenet.cpp @@ -52,11 +52,9 @@ public: std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(mean_rgb); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint2(target); - ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM; - bool enable_tuning = (target == 2); - bool enable_memory_management = true; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint2(target); + ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM; // Parse arguments if(argc < 2) @@ -136,7 +134,10 @@ public: << OutputLayer(get_output_accessor(label, 5)); // Finalize graph - graph.finalize(target_hint, enable_tuning, enable_memory_management); + GraphConfig config; + config.use_function_memory_manager = true; + config.use_tuner = (target == 2); + graph.finalize(target_hint, config); } void do_run() override { diff --git a/examples/graph_inception_v3.cpp b/examples/graph_inception_v3.cpp index 73a4450a4f..5f049d0f4a 100644 --- a/examples/graph_inception_v3.cpp +++ b/examples/graph_inception_v3.cpp @@ -51,10 +51,8 @@ public: std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint2(target); - bool enable_tuning = (target == 2); - bool enable_memory_management = true; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint2(target); ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM; @@ -192,7 +190,10 @@ public: << OutputLayer(get_output_accessor(label, 5)); // Finalize graph - graph.finalize(target_hint, enable_tuning, enable_memory_management); + GraphConfig config; + config.use_function_memory_manager = true; + config.use_tuner = (target == 2); + graph.finalize(target_hint, config); } void do_run() override diff --git a/examples/graph_inception_v4.cpp b/examples/graph_inception_v4.cpp index 88073b7efb..847c5b8250 100644 --- a/examples/graph_inception_v4.cpp +++ b/examples/graph_inception_v4.cpp @@ -55,10 +55,8 @@ public: std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(); // Set target. 0 (NEON), 1 (OpenCL). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint2(target); - bool enable_tuning = (target == 2); - bool enable_memory_management = true; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint2(target); ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM; @@ -162,7 +160,10 @@ public: << OutputLayer(get_output_accessor(label, 5)); // Finalize graph - graph.finalize(target_hint, enable_tuning, enable_memory_management); + GraphConfig config; + config.use_function_memory_manager = true; + config.use_tuner = (target == 2); + graph.finalize(target_hint, config); #else /* __aarch64__ */ using namespace arm_compute; ARM_COMPUTE_UNUSED(argc); diff --git a/examples/graph_lenet.cpp b/examples/graph_lenet.cpp index e4b8effe5d..3803da9b83 100644 --- a/examples/graph_lenet.cpp +++ b/examples/graph_lenet.cpp @@ -47,10 +47,8 @@ public: unsigned int batches = 4; /** Number of batches */ // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint2(target); - bool enable_tuning = (target == 2); - bool enable_memory_management = true; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint2(target); // Parse arguments if(argc < 2) @@ -106,7 +104,10 @@ public: << OutputLayer(get_output_accessor("")); // Finalize graph - graph.finalize(target_hint, enable_tuning, enable_memory_management); + GraphConfig config; + config.use_function_memory_manager = true; + config.use_tuner = (target == 2); + graph.finalize(target_hint, config); } void do_run() override { diff --git a/examples/graph_mobilenet.cpp b/examples/graph_mobilenet.cpp index 4d01055c50..bd25b927fe 100644 --- a/examples/graph_mobilenet.cpp +++ b/examples/graph_mobilenet.cpp @@ -54,8 +54,6 @@ public: Target target_hint = set_target_hint2(target); ConvolutionMethod convolution_hint = ConvolutionMethod::GEMM; DepthwiseConvolutionMethod depthwise_convolution_hint = DepthwiseConvolutionMethod::OPTIMIZED_3x3; - bool enable_tuning = (target == 2); - bool enable_memory_management = true; // Set model to execute. 0 (MobileNetV1_1.0_224), 1 (MobileNetV1_0.75_160) int model_id = (argc > 2) ? std::strtol(argv[2], nullptr, 10) : 0; @@ -150,7 +148,10 @@ public: << OutputLayer(get_output_accessor(label, 5)); // Finalize graph - graph.finalize(target_hint, enable_tuning, enable_memory_management); + GraphConfig config; + config.use_function_memory_manager = true; + config.use_tuner = (target == 2); + graph.finalize(target_hint, config); } void do_run() override { diff --git a/examples/graph_resnet50.cpp b/examples/graph_resnet50.cpp index a7d7abc761..ec447de66f 100644 --- a/examples/graph_resnet50.cpp +++ b/examples/graph_resnet50.cpp @@ -52,10 +52,8 @@ public: false /* Do not convert to BGR */); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint2(target); - bool enable_tuning = (target == 2); - bool enable_memory_management = true; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint2(target); ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM; @@ -125,7 +123,10 @@ public: << OutputLayer(get_output_accessor(label, 5)); // Finalize graph - graph.finalize(target_hint, enable_tuning, enable_memory_management); + GraphConfig config; + config.use_function_memory_manager = true; + config.use_tuner = (target == 2); + graph.finalize(target_hint, config); } void do_run() override diff --git a/examples/graph_squeezenet.cpp b/examples/graph_squeezenet.cpp index 92e6a38fcd..ddbe6b43ce 100644 --- a/examples/graph_squeezenet.cpp +++ b/examples/graph_squeezenet.cpp @@ -53,10 +53,8 @@ public: std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(mean_rgb); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint2(target); - bool enable_tuning = (target == 2); - bool enable_memory_management = true; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint2(target); ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM; @@ -173,7 +171,10 @@ public: << OutputLayer(get_output_accessor(label, 5)); // Finalize graph - graph.finalize(target_hint, enable_tuning, enable_memory_management); + GraphConfig config; + config.use_function_memory_manager = true; + config.use_tuner = (target == 2); + graph.finalize(target_hint, config); } void do_run() override { diff --git a/examples/graph_squeezenet_v1_1.cpp b/examples/graph_squeezenet_v1_1.cpp index 540784e4cd..faab79fcf1 100644 --- a/examples/graph_squeezenet_v1_1.cpp +++ b/examples/graph_squeezenet_v1_1.cpp @@ -56,10 +56,8 @@ public: std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(mean_rgb); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint2(target); - bool enable_tuning = (target == 2); - bool enable_memory_management = true; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint2(target); ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM; @@ -177,7 +175,10 @@ public: << OutputLayer(get_output_accessor(label, 5)); // Finalize graph - graph.finalize(target_hint, enable_tuning, enable_memory_management); + GraphConfig config; + config.use_function_memory_manager = true; + config.use_tuner = (target == 2); + graph.finalize(target_hint, config); } void do_run() override { diff --git a/examples/graph_vgg16.cpp b/examples/graph_vgg16.cpp index 516b7b18f0..23742ed771 100644 --- a/examples/graph_vgg16.cpp +++ b/examples/graph_vgg16.cpp @@ -65,10 +65,8 @@ public: std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(mean_rgb); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint2(target); - bool enable_tuning = (target == 2); - bool enable_memory_management = true; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint2(target); // Check if we can use GEMM-based convolutions evaluating if the platform has at least 1.8 GB of available memory const size_t memory_required = 1932735283L; @@ -231,7 +229,10 @@ public: << OutputLayer(get_output_accessor(label, 5)); // Finalize graph - graph.finalize(target_hint, enable_tuning, enable_memory_management); + GraphConfig config; + config.use_function_memory_manager = true; + config.use_tuner = (target == 2); + graph.finalize(target_hint, config); } void do_run() override { diff --git a/examples/graph_vgg19.cpp b/examples/graph_vgg19.cpp index 55502e0e00..f282b90630 100644 --- a/examples/graph_vgg19.cpp +++ b/examples/graph_vgg19.cpp @@ -51,11 +51,9 @@ public: std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(mean_rgb); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON - const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; - Target target_hint = set_target_hint2(target); - ConvolutionMethod convolution_hint = ConvolutionMethod::DIRECT; - bool enable_tuning = (target == 2); - bool enable_memory_management = true; + const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; + Target target_hint = set_target_hint2(target); + ConvolutionMethod convolution_hint = ConvolutionMethod::DIRECT; // Parse arguments if(argc < 2) @@ -221,7 +219,10 @@ public: << OutputLayer(get_output_accessor(label, 5)); // Finalize graph - graph.finalize(target_hint, enable_tuning, enable_memory_management); + GraphConfig config; + config.use_function_memory_manager = true; + config.use_tuner = (target == 2); + graph.finalize(target_hint, config); } void do_run() override { -- cgit v1.2.1