99 std::set<framework::DatasetMode> allowed_modes
101 framework::DatasetMode::DISABLED,
102 framework::DatasetMode::PRECOMMIT,
103 framework::DatasetMode::NIGHTLY,
104 framework::DatasetMode::ALL
110 dataset_mode->
set_help(
"For managed datasets select which group to use");
112 filter->
set_help(
"Regular expression to select test cases");
114 filter_id->
set_help(
"List of test ids. ... can be used to define a range.");
116 stop_on_error->
set_help(
"Abort execution after the first failed test (useful for debugging)");
118 seed->set_help(
"Global seed for random number generation");
120 list_tests->
set_help(
"List all test names");
122 test_instruments->
set_help(
"Test if the instruments work on the platform");
124 error_on_missing_assets->
set_help(
"Mark a test as failed instead of skipping it when assets are missing");
126 assets->
set_help(
"Path to the assets directory");
127 #ifdef ARM_COMPUTE_CL 129 enable_tuner->
set_help(
"Enable OpenCL dynamic tuner");
131 const std::set<CLTunerMode> supported_tuner_modes
133 CLTunerMode::EXHAUSTIVE,
138 tuner_mode->
set_help(
"Configures the time taken by the tuner to tune. Slow tuner produces the most performant LWS configuration");
141 tuner_file->
set_help(
"File to load/save CLTuner values");
144 threads->
set_help(
"Number of threads to use");
150 if(options.help->is_set() && options.help->value())
152 parser.print_help(argv[0]);
156 std::vector<std::unique_ptr<framework::Printer>> printers = options.create_printers();
159 Scheduler::get().set_num_threads(threads->value());
162 auto cpu_ctx = support::cpp14::make_unique<RuntimeContext>();
163 cpu_ctx->set_scheduler(&Scheduler::get());
166 auto cpu_ctx_track = support::cpp14::make_unique<ContextSchedulerUser>(cpu_ctx.get());
169 parameters = support::cpp14::make_unique<ParametersLibrary>();
172 #ifdef ARM_COMPUTE_GC 175 auto gles_ctx = support::cpp14::make_unique<GCRuntimeContext>();
180 GCScheduler::get().default_init();
186 #ifdef ARM_COMPUTE_CL 192 CLScheduler::get().default_init_with_context(std::get<1>(ctx_dev_err), std::get<0>(ctx_dev_err), &cl_tuner);
195 if(enable_tuner->is_set())
197 cl_tuner.set_tune_new_kernels(enable_tuner->value());
200 cl_tuner.set_tuner_mode(tuner_mode->value());
203 if(file_exists(tuner_file->value()))
205 cl_tuner.load_from_file(tuner_file->value());
208 else if(!tuner_file->value().empty())
211 cl_tuner.load_from_file(tuner_file->value());
214 if(options.log_level->value() > framework::LogLevel::NONE)
216 for(
auto &p : printers)
218 p->print_global_header();
222 if(options.log_level->value() >= framework::LogLevel::CONFIG)
224 for(
auto &p : printers)
227 p->print_entry(
"CommandLine", command_line(argc, argv));
229 #ifdef ARM_COMPUTE_CL 232 p->print_entry(
"CL_DEVICE_VERSION", CLKernelLibrary::get().get_device_version());
236 p->print_entry(
"CL_DEVICE_VERSION",
"Unavailable");
240 const unsigned int num_cpus = cpu_info.
get_cpu_num();
244 for(
unsigned int j = 0; j < num_cpus; ++j)
253 p->print_entry(
"Dataset mode",
to_string(dataset_mode->value()));
264 framework.
init(options.instruments->value(),
265 options.iterations->value(),
266 dataset_mode->value(),
269 options.log_level->value());
271 for(
auto &p : printers)
281 if(list_tests->value())
283 for(
auto &p : printers)
286 p->print_global_footer();
292 if(test_instruments->value())
297 for(
auto &p : printers)
305 library = support::cpp14::make_unique<AssetsLibrary>(assets->value(), seed->value());
312 success = framework.
run();
314 if(options.log_level->value() > framework::LogLevel::NONE)
316 for(
auto &p : printers)
318 p->print_global_footer();
322 #ifdef ARM_COMPUTE_CL 325 CLScheduler::get().sync();
326 if(enable_tuner->is_set() && enable_tuner->value() && tuner_file->is_set())
328 cl_tuner.save_to_file(tuner_file->value());
333 return (success ? 0 : 1);
335 catch(
const std::exception &error)
337 std::cerr << error.what() <<
"\n";
339 if(options.throw_errors->value())
Basic implementation of the OpenCL tuner interface.
std::string to_string(DatasetMode mode)
Profiler class to collect benchmark numbers.
bool has_fp16() const
Checks if the cpu model supports fp16.
void set_throw_errors(bool throw_errors)
Set whether errors are caught or thrown by the framework.
Implementation of an option that can be either true or false.
void set_instruments_info(InstrumentsInfo instr_info)
Sets instruments info.
std::unique_ptr< InstrumentsInfo > instruments_info
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
CPUModel
CPU models - we only need to detect CPUs we have microarchitecture-specific code for.
std::tuple< cl::Context, cl::Device, cl_int > create_opencl_context_and_device()
This function creates an OpenCL context and a device.
void set_error_on_missing_assets(bool error_on_missing_assets)
Set whether a test should be considered as failed if its assets cannot be found.
Class to parse command line arguments.
CPUModel get_cpu_model(unsigned int cpuid) const
Gets the cpu model for a given cpuid.
std::string cpu_model_to_string(CPUModel val)
Convert a cpumodel value to a string.
void init(const std::vector< framework::InstrumentsDescription > &instruments, int num_iterations, DatasetMode mode, const std::string &name_filter, const std::string &id_filter, LogLevel log_level)
Init the framework.
bool run()
Run all enabled test cases.
std::vector< TestInfo > test_infos() const
List of TestInfo's.
std::unique_ptr< AssetsLibrary > library
std::unique_ptr< ParametersLibrary > parameters
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
bool has_dotprod() const
Checks if the cpu model supports dot product.
Profiler get_profiler() const
Factory method to obtain a configured profiler.
const MeasurementsMap & measurements() const
Return measurements for all instruments.
unsigned int get_cpu_num() const
Return the maximum number of CPUs present.
Implementation of a simple option that accepts a value from a fixed set.
void start()
Call start() on all the added instruments.
std::string build_information()
Returns the arm_compute library build information.
void add_printer(Printer *printer)
Set the printer used for the output of test results.
void stop()
Call stop() on all the added instruments.
Common command line options used to configure the framework.
void set_stop_on_error(bool stop_on_error)
Set whether to abort execution after the first failed test.
void set_help(std::string help)
Set the help message for the option.
bool opencl_is_available()
Check if OpenCL is available.