blob: e862c7627e2083500bf14e8b91ad8f6d4481ae28 [file] [log] [blame]
Moritz Pflanzeree493ae2017-07-05 10:52:21 +01001/*
Gunes Bayir6b4571a2023-02-13 16:55:00 +00002 * Copyright (c) 2017-2023 Arm Limited.
Moritz Pflanzeree493ae2017-07-05 10:52:21 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
Matthew Bentham314d3e22023-06-23 10:53:52 +000024#include "arm_compute/core/Version.h"
Matthew Bentham92046462020-03-07 22:15:55 +000025#include "support/StringSupport.h"
Moritz Pflanzerfb5aabb2017-07-18 14:39:55 +010026#include "tests/AssetsLibrary.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010027#include "tests/framework/DatasetModes.h"
28#include "tests/framework/Exceptions.h"
29#include "tests/framework/Framework.h"
30#include "tests/framework/Macros.h"
Pablo Tellodb8485a2019-09-24 11:03:47 +010031#include "tests/framework/ParametersLibrary.h"
Anthony Barbiere1f8f9b2017-10-03 14:01:05 +010032#include "tests/framework/Profiler.h"
Anthony Barbier6db0ff52018-01-05 10:59:12 +000033#include "tests/framework/command_line/CommonOptions.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010034#include "tests/framework/instruments/Instruments.h"
35#include "tests/framework/printers/Printers.h"
Georgios Pinitas12833d02019-07-25 13:31:10 +010036#include "tests/instruments/Helpers.h"
Georgios Pinitas12be7ab2018-07-03 12:06:23 +010037#include "utils/command_line/CommandLineOptions.h"
38#include "utils/command_line/CommandLineParser.h"
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010039
Anthony Barbier15d5ac82017-07-17 15:22:17 +010040#ifdef ARM_COMPUTE_CL
Pablo Tellob7c308a2019-01-22 12:59:26 +000041#include "arm_compute/core/CL/OpenCL.h"
SiCong Lidb4a6c12021-02-05 09:30:57 +000042#include "arm_compute/runtime/CL/CLGEMMHeuristicsHandle.h"
Pablo Tellob7c308a2019-01-22 12:59:26 +000043#include "arm_compute/runtime/CL/CLHelpers.h"
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010044#include "arm_compute/runtime/CL/CLScheduler.h"
Anthony Barbier943a40b2018-07-12 18:03:54 +010045#include "arm_compute/runtime/CL/CLTuner.h"
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +010046#include "utils/TypePrinter.h"
Anthony Barbier15d5ac82017-07-17 15:22:17 +010047#endif /* ARM_COMPUTE_CL */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010048#include "arm_compute/runtime/Scheduler.h"
Georgios Pinitas08302c12021-06-09 10:08:27 +010049#include "src/common/cpuinfo/CpuModel.h"
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010050
51#include <fstream>
52#include <initializer_list>
53#include <iostream>
54#include <memory>
55#include <random>
56#include <utility>
57
58using namespace arm_compute;
59using namespace arm_compute::test;
60
Anthony Barbier1fa17c22018-08-23 15:44:20 +010061namespace
62{
63std::string command_line(int argc, char **argv)
64{
65 std::stringstream ss;
66 for(int i = 0; i < argc; i++)
67 {
68 ss << argv[i] << " ";
69 }
70 return ss.str();
71}
72} // namespace
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010073namespace arm_compute
74{
75namespace test
76{
Sang-Hoon Park06cf9332020-03-31 15:59:41 +010077std::unique_ptr<AssetsLibrary> library;
78
79static constexpr uint32_t fixed_seed = 1;
80std::unique_ptr<AssetsLibrary> fixed_library;
81
Pablo Tellodb8485a2019-09-24 11:03:47 +010082extern std::unique_ptr<ParametersLibrary> parameters;
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010083} // namespace test
84} // namespace arm_compute
85
Anthony Barbier7b607dc2018-07-13 15:55:24 +010086namespace
87{
88#ifdef ARM_COMPUTE_CL
89bool file_exists(const std::string &filename)
90{
91 std::ifstream file(filename);
92 return file.good();
93}
94#endif /* ARM_COMPUTE_CL */
95} //namespace
96
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010097int main(int argc, char **argv)
98{
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010099 framework::Framework &framework = framework::Framework::get();
100
Georgios Pinitas12be7ab2018-07-03 12:06:23 +0100101 utils::CommandLineParser parser;
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100102
Moritz Pflanzerd03b00a2017-07-17 13:50:12 +0100103 std::set<framework::DatasetMode> allowed_modes
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100104 {
Georgios Pinitas557d4ae2019-04-18 18:10:34 +0100105 framework::DatasetMode::DISABLED,
Moritz Pflanzerd03b00a2017-07-17 13:50:12 +0100106 framework::DatasetMode::PRECOMMIT,
107 framework::DatasetMode::NIGHTLY,
108 framework::DatasetMode::ALL
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100109 };
110
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000111 framework::CommonOptions options(parser);
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100112
Georgios Pinitas12be7ab2018-07-03 12:06:23 +0100113 auto dataset_mode = parser.add_option<utils::EnumOption<framework::DatasetMode>>("mode", allowed_modes, framework::DatasetMode::PRECOMMIT);
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100114 dataset_mode->set_help("For managed datasets select which group to use");
Georgios Pinitas12be7ab2018-07-03 12:06:23 +0100115 auto filter = parser.add_option<utils::SimpleOption<std::string>>("filter", ".*");
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100116 filter->set_help("Regular expression to select test cases");
Georgios Pinitas12be7ab2018-07-03 12:06:23 +0100117 auto filter_id = parser.add_option<utils::SimpleOption<std::string>>("filter-id");
Moritz Pflanzerec2de0f2017-07-27 14:43:46 +0100118 filter_id->set_help("List of test ids. ... can be used to define a range.");
Georgios Pinitas12be7ab2018-07-03 12:06:23 +0100119 auto stop_on_error = parser.add_option<utils::ToggleOption>("stop-on-error");
ramelg01b2eba7f2021-12-23 08:32:08 +0000120 stop_on_error->set_help("Stop execution after the first failed test (useful for debugging)");
Georgios Pinitas12be7ab2018-07-03 12:06:23 +0100121 auto seed = parser.add_option<utils::SimpleOption<std::random_device::result_type>>("seed", std::random_device()());
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100122 seed->set_help("Global seed for random number generation");
Georgios Pinitas12be7ab2018-07-03 12:06:23 +0100123 auto list_tests = parser.add_option<utils::ToggleOption>("list-tests", false);
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100124 list_tests->set_help("List all test names");
Georgios Pinitas12be7ab2018-07-03 12:06:23 +0100125 auto test_instruments = parser.add_option<utils::ToggleOption>("test-instruments", false);
Anthony Barbiere1f8f9b2017-10-03 14:01:05 +0100126 test_instruments->set_help("Test if the instruments work on the platform");
Georgios Pinitas12be7ab2018-07-03 12:06:23 +0100127 auto error_on_missing_assets = parser.add_option<utils::ToggleOption>("error-on-missing-assets", false);
Anthony Barbierf6705ec2017-09-28 12:01:10 +0100128 error_on_missing_assets->set_help("Mark a test as failed instead of skipping it when assets are missing");
Georgios Pinitas12be7ab2018-07-03 12:06:23 +0100129 auto assets = parser.add_positional_option<utils::SimpleOption<std::string>>("assets");
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100130 assets->set_help("Path to the assets directory");
Ramy Elgammal1355ec42023-05-15 13:50:46 +0100131 auto print_rerun_command = parser.add_option<utils::ToggleOption>("rerun-cmd");
132 print_rerun_command->set_help("Print out the command to rerun the exact failed testcase");
Anthony Barbier943a40b2018-07-12 18:03:54 +0100133#ifdef ARM_COMPUTE_CL
134 auto enable_tuner = parser.add_option<utils::ToggleOption>("enable-tuner");
135 enable_tuner->set_help("Enable OpenCL dynamic tuner");
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +0100136
137 const std::set<CLTunerMode> supported_tuner_modes
138 {
139 CLTunerMode::EXHAUSTIVE,
140 CLTunerMode::NORMAL,
141 CLTunerMode::RAPID
142 };
Michalis Spyrou083a0692019-05-13 15:35:50 +0100143 auto tuner_mode = parser.add_option<utils::EnumOption<CLTunerMode>>("tuner-mode", supported_tuner_modes, CLTunerMode::NORMAL);
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +0100144 tuner_mode->set_help("Configures the time taken by the tuner to tune. Slow tuner produces the most performant LWS configuration");
145
Anthony Barbier7b607dc2018-07-13 15:55:24 +0100146 auto tuner_file = parser.add_option<utils::SimpleOption<std::string>>("tuner-file", "");
147 tuner_file->set_help("File to load/save CLTuner values");
SiCong Lidb4a6c12021-02-05 09:30:57 +0000148
149 auto mlgo_file = parser.add_option<utils::SimpleOption<std::string>>("mlgo-file", "");
150 mlgo_file->set_help("File to load MLGO heuristics");
Anthony Barbier943a40b2018-07-12 18:03:54 +0100151#endif /* ARM_COMPUTE_CL */
Anthony Barbier94522332018-07-13 09:26:51 +0100152 auto threads = parser.add_option<utils::SimpleOption<int>>("threads", 1);
153 threads->set_help("Number of threads to use");
Georgios Pinitas7f152512019-12-16 19:59:52 +0000154 auto cooldown_sec = parser.add_option<utils::SimpleOption<float>>("delay", -1.f);
155 cooldown_sec->set_help("Delay to add between test executions in seconds");
Giorgio Arena68e29da2021-02-08 16:31:10 +0000156 auto configure_only = parser.add_option<utils::ToggleOption>("configure-only", false);
157 configure_only->set_help("Only configures kernels, without allocating, running or validating. Needed in order to validate OpenCL kernel run-time compilation, without necessarily running or validating the kernels' execution");
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100158
159 try
160 {
161 parser.parse(argc, argv);
162
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000163 if(options.help->is_set() && options.help->value())
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100164 {
165 parser.print_help(argv[0]);
166 return 0;
167 }
168
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000169 std::vector<std::unique_ptr<framework::Printer>> printers = options.create_printers();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100170
Georgios Pinitas12833d02019-07-25 13:31:10 +0100171 // Setup CPU Scheduler
Anthony Barbier94522332018-07-13 09:26:51 +0100172 Scheduler::get().set_num_threads(threads->value());
Georgios Pinitas12833d02019-07-25 13:31:10 +0100173
174 // Create CPU context
Georgios Pinitas40f51a62020-11-21 03:04:18 +0000175 auto cpu_ctx = std::make_unique<RuntimeContext>();
Georgios Pinitas12833d02019-07-25 13:31:10 +0100176 cpu_ctx->set_scheduler(&Scheduler::get());
177
178 // Track CPU context
Georgios Pinitas40f51a62020-11-21 03:04:18 +0000179 auto cpu_ctx_track = std::make_unique<ContextSchedulerUser>(cpu_ctx.get());
Georgios Pinitas12833d02019-07-25 13:31:10 +0100180
181 // Create parameters
Georgios Pinitas40f51a62020-11-21 03:04:18 +0000182 parameters = std::make_unique<ParametersLibrary>();
Georgios Pinitas12833d02019-07-25 13:31:10 +0100183 parameters->set_cpu_ctx(std::move(cpu_ctx));
184
Anthony Barbier943a40b2018-07-12 18:03:54 +0100185#ifdef ARM_COMPUTE_CL
SiCong Lidb4a6c12021-02-05 09:30:57 +0000186 CLTuner cl_tuner(false);
187 CLGEMMHeuristicsHandle gemm_heuristics;
Georgios Pinitasc9f163b2019-11-18 14:25:45 +0000188 if(opencl_is_available())
Pablo Tellodb8485a2019-09-24 11:03:47 +0100189 {
Michalis Spyrou402740d2021-04-20 11:26:21 +0100190 auto ctx_dev_err = create_opencl_context_and_device(CLBackendType::Native);
Georgios Pinitasc9f163b2019-11-18 14:25:45 +0000191 ARM_COMPUTE_ERROR_ON_MSG(std::get<2>(ctx_dev_err) != CL_SUCCESS, "Failed to create OpenCL context");
SiCong Lidb4a6c12021-02-05 09:30:57 +0000192 gemm_heuristics.reload_from_file(mlgo_file->value());
193 CLScheduler::get().default_init_with_context(std::get<1>(ctx_dev_err), std::get<0>(ctx_dev_err), &cl_tuner, &gemm_heuristics);
Pablo Tellodb8485a2019-09-24 11:03:47 +0100194 }
Pablo Tellodb8485a2019-09-24 11:03:47 +0100195
Anthony Barbier943a40b2018-07-12 18:03:54 +0100196 if(enable_tuner->is_set())
197 {
Pablo Tello5f98d742019-07-22 16:41:10 +0100198 cl_tuner.set_tune_new_kernels(enable_tuner->value());
199
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +0100200 //set tuner mode
201 cl_tuner.set_tuner_mode(tuner_mode->value());
202
Anthony Barbier7b607dc2018-07-13 15:55:24 +0100203 // If that's the first run then the file won't exist yet
204 if(file_exists(tuner_file->value()))
205 {
206 cl_tuner.load_from_file(tuner_file->value());
207 }
208 }
209 else if(!tuner_file->value().empty())
210 {
211 //If we're not tuning and the file doesn't exist then we should raise an error:
212 cl_tuner.load_from_file(tuner_file->value());
Anthony Barbier943a40b2018-07-12 18:03:54 +0100213 }
214#endif /* ARM_COMPUTE_CL */
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000215 if(options.log_level->value() > framework::LogLevel::NONE)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100216 {
Giorgio Arenac5d54392017-10-31 15:18:49 +0000217 for(auto &p : printers)
218 {
219 p->print_global_header();
220 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100221 }
222
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000223 if(options.log_level->value() >= framework::LogLevel::CONFIG)
Moritz Pflanzer2ac50402017-07-24 15:52:54 +0100224 {
Giorgio Arenac5d54392017-10-31 15:18:49 +0000225 for(auto &p : printers)
Moritz Pflanzer2ac50402017-07-24 15:52:54 +0100226 {
Anthony Barbier4b9c58a2018-01-10 14:34:00 +0000227 p->print_entry("Version", build_information());
Anthony Barbier1fa17c22018-08-23 15:44:20 +0100228 p->print_entry("CommandLine", command_line(argc, argv));
Giorgio Arenac5d54392017-10-31 15:18:49 +0000229 p->print_entry("Seed", support::cpp11::to_string(seed->value()));
Anthony Barbier847864d2018-03-07 11:35:53 +0000230#ifdef ARM_COMPUTE_CL
231 if(opencl_is_available())
232 {
Georgios Pinitasc9f163b2019-11-18 14:25:45 +0000233 p->print_entry("CL_DEVICE_VERSION", CLKernelLibrary::get().get_device_version());
Anthony Barbier847864d2018-03-07 11:35:53 +0000234 }
235 else
236 {
237 p->print_entry("CL_DEVICE_VERSION", "Unavailable");
238 }
239#endif /* ARM_COMPUTE_CL */
Gian Marco Iodice555c3d62018-10-16 16:00:50 +0100240 const arm_compute::CPUInfo &cpu_info = Scheduler::get().cpu_info();
241 const unsigned int num_cpus = cpu_info.get_cpu_num();
Gunes Bayir6b4571a2023-02-13 16:55:00 +0000242
Georgios Pinitas08302c12021-06-09 10:08:27 +0100243 p->print_entry("cpu_has_sve", support::cpp11::to_string(cpu_info.has_sve()));
Gunes Bayir6b4571a2023-02-13 16:55:00 +0000244 p->print_entry("cpu_has_sve2", support::cpp11::to_string(cpu_info.has_sve2()));
245 p->print_entry("cpu_has_svef32mm", support::cpp11::to_string(cpu_info.has_svef32mm()));
246 p->print_entry("cpu_has_svei8mm", support::cpp11::to_string(cpu_info.has_svei8mm()));
247 p->print_entry("cpu_has_svebf16", support::cpp11::to_string(cpu_info.has_svebf16()));
Viet-Hoa Do03b29712022-06-01 11:47:14 +0100248 p->print_entry("cpu_has_sme", support::cpp11::to_string(cpu_info.has_sme()));
249 p->print_entry("cpu_has_sme2", support::cpp11::to_string(cpu_info.has_sme2()));
Gian Marco Iodice555c3d62018-10-16 16:00:50 +0100250 p->print_entry("cpu_has_fp16", support::cpp11::to_string(cpu_info.has_fp16()));
Georgios Pinitas08302c12021-06-09 10:08:27 +0100251 p->print_entry("cpu_has_bf16", support::cpp11::to_string(cpu_info.has_bf16()));
Gian Marco Iodice555c3d62018-10-16 16:00:50 +0100252 p->print_entry("cpu_has_dotprod", support::cpp11::to_string(cpu_info.has_dotprod()));
Gunes Bayir6b4571a2023-02-13 16:55:00 +0000253 p->print_entry("cpu_has_i8mm", support::cpp11::to_string(cpu_info.has_i8mm()));
Gian Marco Iodice555c3d62018-10-16 16:00:50 +0100254
255 for(unsigned int j = 0; j < num_cpus; ++j)
256 {
257 const CPUModel model = cpu_info.get_cpu_model(j);
Georgios Pinitas08302c12021-06-09 10:08:27 +0100258 p->print_entry("CPU" + support::cpp11::to_string(j), cpuinfo::cpu_model_to_string(model));
Gian Marco Iodice555c3d62018-10-16 16:00:50 +0100259 }
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000260 p->print_entry("Iterations", support::cpp11::to_string(options.iterations->value()));
Anthony Barbier94522332018-07-13 09:26:51 +0100261 p->print_entry("Threads", support::cpp11::to_string(threads->value()));
Giorgio Arenac5d54392017-10-31 15:18:49 +0000262 {
263 using support::cpp11::to_string;
264 p->print_entry("Dataset mode", to_string(dataset_mode->value()));
265 }
Moritz Pflanzer2ac50402017-07-24 15:52:54 +0100266 }
267 }
268
Georgios Pinitas12833d02019-07-25 13:31:10 +0100269 // Setup instruments meta-data
270 framework::InstrumentsInfo instruments_info;
271 instruments_info._scheduler_users.push_back(cpu_ctx_track.get());
272 framework.set_instruments_info(instruments_info);
273
274 // Initialize framework
Georgios Pinitas7f152512019-12-16 19:59:52 +0000275 framework::FrameworkConfig fconfig;
Ramy Elgammal1355ec42023-05-15 13:50:46 +0100276 fconfig.instruments = options.instruments->value();
277 fconfig.name_filter = filter->value();
278 fconfig.id_filter = filter_id->value();
279 fconfig.num_iterations = options.iterations->value();
280 fconfig.mode = dataset_mode->value();
281 fconfig.log_level = options.log_level->value();
282 fconfig.cooldown_sec = cooldown_sec->value();
283 fconfig.configure_only = configure_only->value();
284 fconfig.print_rerun_cmd = print_rerun_command->value();
285 fconfig.seed = seed->value();
Georgios Pinitas7f152512019-12-16 19:59:52 +0000286 framework.init(fconfig);
Georgios Pinitas12833d02019-07-25 13:31:10 +0100287
Giorgio Arenac5d54392017-10-31 15:18:49 +0000288 for(auto &p : printers)
289 {
290 framework.add_printer(p.get());
291 }
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000292 framework.set_throw_errors(options.throw_errors->value());
Moritz Pflanzerfa811652017-07-26 17:00:37 +0100293 framework.set_stop_on_error(stop_on_error->value());
Anthony Barbierf6705ec2017-09-28 12:01:10 +0100294 framework.set_error_on_missing_assets(error_on_missing_assets->value());
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100295
296 bool success = true;
297
298 if(list_tests->value())
299 {
Anthony Barbierdbfb31c2017-11-24 11:24:45 +0000300 for(auto &p : printers)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100301 {
Anthony Barbierdbfb31c2017-11-24 11:24:45 +0000302 p->print_list_tests(framework.test_infos());
303 p->print_global_footer();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100304 }
Moritz Pflanzeraab43542017-07-18 13:15:39 +0100305
306 return 0;
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100307 }
Moritz Pflanzeraab43542017-07-18 13:15:39 +0100308
Anthony Barbiere1f8f9b2017-10-03 14:01:05 +0100309 if(test_instruments->value())
310 {
311 framework::Profiler profiler = framework.get_profiler();
312 profiler.start();
313 profiler.stop();
Giorgio Arenac5d54392017-10-31 15:18:49 +0000314 for(auto &p : printers)
Anthony Barbiere1f8f9b2017-10-03 14:01:05 +0100315 {
Giorgio Arenac5d54392017-10-31 15:18:49 +0000316 p->print_measurements(profiler.measurements());
Anthony Barbiere1f8f9b2017-10-03 14:01:05 +0100317 }
Giorgio Arenac5d54392017-10-31 15:18:49 +0000318
Anthony Barbiere1f8f9b2017-10-03 14:01:05 +0100319 return 0;
320 }
321
Georgios Pinitas40f51a62020-11-21 03:04:18 +0000322 library = std::make_unique<AssetsLibrary>(assets->value(), seed->value());
323 fixed_library = std::make_unique<AssetsLibrary>(assets->value(), fixed_seed);
Moritz Pflanzeraab43542017-07-18 13:15:39 +0100324
325 if(!parser.validate())
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100326 {
Moritz Pflanzeraab43542017-07-18 13:15:39 +0100327 return 1;
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100328 }
329
Moritz Pflanzeraab43542017-07-18 13:15:39 +0100330 success = framework.run();
331
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000332 if(options.log_level->value() > framework::LogLevel::NONE)
Moritz Pflanzer2ac50402017-07-24 15:52:54 +0100333 {
Giorgio Arenac5d54392017-10-31 15:18:49 +0000334 for(auto &p : printers)
335 {
336 p->print_global_footer();
337 }
Moritz Pflanzer2ac50402017-07-24 15:52:54 +0100338 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100339
Michalis Spyrou84f3ae82018-01-15 11:15:26 +0000340#ifdef ARM_COMPUTE_CL
Anthony Barbier2113b9d2018-08-23 09:48:40 +0100341 if(opencl_is_available())
Anthony Barbier7b607dc2018-07-13 15:55:24 +0100342 {
Anthony Barbier2113b9d2018-08-23 09:48:40 +0100343 CLScheduler::get().sync();
344 if(enable_tuner->is_set() && enable_tuner->value() && tuner_file->is_set())
345 {
346 cl_tuner.save_to_file(tuner_file->value());
347 }
Anthony Barbier7b607dc2018-07-13 15:55:24 +0100348 }
Michalis Spyrou84f3ae82018-01-15 11:15:26 +0000349#endif /* ARM_COMPUTE_CL */
350
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100351 return (success ? 0 : 1);
352 }
353 catch(const std::exception &error)
354 {
355 std::cerr << error.what() << "\n";
356
Anthony Barbier6db0ff52018-01-05 10:59:12 +0000357 if(options.throw_errors->value())
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100358 {
359 throw;
360 }
361
362 return 1;
363 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100364 return 0;
365}