52 #include "config_HAVE_TECHNOLOGY_BUILT.hpp" 53 #include "config_RELEASE.hpp" 60 #define INPUT_OPT_ACCURACY 256 61 #define INPUT_OPT_BENCHMARK_BOUNDS (1 + INPUT_OPT_ACCURACY) 62 #define INPUT_OPT_COMPONENTS (1 + INPUT_OPT_BENCHMARK_BOUNDS) 63 #define INPUT_OPT_CROSS_VALIDATION (1 + INPUT_OPT_COMPONENTS) 64 #define INPUT_OPT_MINIMUM_SIGNIFICANCE (1 + INPUT_OPT_CROSS_VALIDATION) 65 #define INPUT_OPT_NORMALIZATION_SEQUENCES (1 + INPUT_OPT_MINIMUM_SIGNIFICANCE) 66 #define INPUT_OPT_NORMALIZATION_WEIGHT_FILE (1 + INPUT_OPT_NORMALIZATION_SEQUENCES) 67 #define INPUT_OPT_PREDICTION_INTERVAL_VALUE (1 + INPUT_OPT_NORMALIZATION_WEIGHT_FILE) 68 #define INPUT_OPT_SEQUENCE_LENGTH (1 + INPUT_OPT_PREDICTION_INTERVAL_VALUE) 69 #define INPUT_OPT_SURVIVING_BENCHMARKS (1 + INPUT_OPT_SEQUENCE_LENGTH) 70 #define TOOL_OPT_BASE (1 + INPUT_OPT_SURVIVING_BENCHMARKS) 74 os <<
"Usage: " << getOption<std::string>(OPT_program_name) <<
" [options] input_file [input_files] output_file" 81 <<
" Input options:\n" 82 <<
" --sequence_length Specify the length of the sequences\n" 83 <<
" --sequence-length Specify the length of the sequences\n" 84 <<
" --surviving-benchmarks=<number> Remove all but <number> benchmarks from the input (default=300)\n" 85 <<
" --analysis-level=<value> Set the analysis level for instructions sequences analysis (default=0): " 87 <<
" 0: no analysis is performed;\n" 88 <<
" 1: analysis is performed at application level. Only aggregate " 89 "information of all benchmarks \n" 90 <<
" will be saved on XML file;\n" 91 <<
" 2: analysis is performed at application level. Aggregate information " 92 "of all benchmarks and\n" 93 <<
" data of each single benchmark will be saved on XML file;\n" 94 <<
" 3: analysis is performed at function level. XML file will be " 95 "completely generated(file contents:\n" 96 <<
" aggregate information of all benchmarks, data of each single " 97 "benchmark and data of each \n" 98 <<
" function analyzed); \n" 102 <<
" Input options:\n" 103 <<
" --input-format, -I <extension> Format of the input file\n" 104 <<
" --normalize, -n <input_file> Input file storing the normalizing information\n" 105 <<
" --processing-element, -p <pe> Specify of which processing element model weights are\n" 106 <<
" --accuracy=<level> Accuracy level while evaluating similar benchmarks (default=0)\n" 107 <<
" --benchmark-bounds=<number,number>\n" 108 <<
" Set the bound of average execution cycles of benchmarks used for " 111 <<
" Output options:\n" 112 <<
" --output-format, -O <extension> Format of the output file\n" 114 <<
" Possible formats are:\n" 115 <<
" csv comma separated values\n" 116 <<
" rtl.csv comma separated values of rtl sequences\n" 117 <<
" tex latex table\n" 118 <<
" tree.csv comma separated values of tree sequences\n" 119 <<
" xml xml files\n" 121 <<
" Other options:\n" 122 <<
" --normalization-sequences Sequences of transformations to be applied before building performance " 123 "model; sequences can be composed of:\n" 124 <<
" 'L' - remove pseudo-linear dependent benchmarks\n" 125 <<
" 'M' - remove smallest and largest benchmarks\n" 126 <<
" 'R' - remove smallest benchmarks\n" 127 <<
" 'S' - normalize benchmarks\n";
128 #if HAVE_TECHNOLOGY_BUILT 129 os <<
" --components=<value> The components to be inserted in the list of functional units to be " 130 "characterized (default=all).\n";
137 os <<
"********************************************************************************" << std::endl;
138 os <<
" ____ _ _" << std::endl;
139 os <<
" / ___| _ __ (_) __| | ___ _ __" << std::endl;
140 os << R
"( \___ \| '_ \| |/ _` |/ _ \ '__|)" << std::endl; 141 os << " ___) | |_) | | (_| | __/ |" << std::endl;
142 os <<
" |____/| .__/|_|\\__,_|\\___|_|" << std::endl;
143 os <<
" |_|" << std::endl;
145 os <<
"********************************************************************************" << std::endl;
163 const struct option long_options[] = {
167 #if HAVE_TECHNOLOGY_BUILT 170 {
"input-format", required_argument,
nullptr,
'I'},
173 {
"output-format", required_argument,
nullptr,
'O'},
175 {
"processing-element", required_argument,
nullptr,
'p'},
178 {
nullptr, 0,
nullptr, 0}
187 int next_option = getopt_long(
argc,
argv, short_options, long_options, &option_index);
190 if(next_option == -1)
209 setOption(OPT_processing_element_type, optarg);
219 std::string to_be_splitted(optarg);
220 std::vector<std::string> splitted =
SplitString(to_be_splitted,
",");
221 if(splitted.size() != 2)
223 THROW_ERROR(
"Error in argument of --benchmark-bounds: " + std::string(optarg));
241 setOption(OPT_normalization_sequences, optarg);
246 setOption(OPT_normalization_file, optarg);
256 setOption(OPT_surviving_benchmarks, optarg);
261 bool exit_success =
false;
269 std::cerr << optarg << std::endl;
277 while(optind + 1 <
argc)
279 std::string input_file;
297 #if HAVE_TECHNOLOGY_BUILT 309 setOption(OPT_normalization_sequences,
"S");
318 setOption(OPT_processing_element_type,
"ARM");
329 const auto input_files = getOption<CustomSet<std::string>>(OPT_input_file);
330 for(
auto input_file : input_files)
332 input_file =
GetPath(input_file);
337 setOption(OPT_latex_format_file, input_file);
342 #if HAVE_TECHNOLOGY_BUILT 343 case(Parameters_FileFormat::FF_XML_TARGET):
345 if(input_format != Parameters_FileFormat::FF_XML_TEC)
354 setOption(OPT_experimental_setup_file, input_file);
357 #if HAVE_FROM_AADL_ASN_BUILT 358 case(Parameters_FileFormat::FF_AADL):
359 case(Parameters_FileFormat::FF_ASN):
361 #if HAVE_FROM_C_BUILT 362 case(Parameters_FileFormat::FF_C):
363 case(Parameters_FileFormat::FF_OBJECTIVEC):
364 case(Parameters_FileFormat::FF_OBJECTIVECPP):
365 case(Parameters_FileFormat::FF_CPP):
366 case(Parameters_FileFormat::FF_FORTRAN):
367 case(Parameters_FileFormat::FF_LLVM):
368 case(Parameters_FileFormat::FF_LLVM_CPP):
371 #if HAVE_FROM_C_BUILT 372 case(Parameters_FileFormat::FF_RAW):
378 case(Parameters_FileFormat::FF_XML_BAMBU_RESULTS):
380 case(Parameters_FileFormat::FF_XML_CON):
383 #if HAVE_TECHNOLOGY_BUILT 384 case(Parameters_FileFormat::FF_XML_TEC):
395 setOption(OPT_input_format, static_cast<int>(input_format));
400 setOption(OPT_input_format, static_cast<int>(input_format));
405 setOption(OPT_output_format, static_cast<int>(output_format));
410 setOption(OPT_output_format, static_cast<int>(output_format));
412 #if HAVE_TECHNOLOGY_BUILT 415 if(
GetFileFormat(input_file,
true) == Parameters_FileFormat::FF_XML_TEC)
422 else if(
GetFileFormat(input_file,
true) == Parameters_FileFormat::FF_XML_TARGET)
424 if(
isOption(OPT_target_device_file) &&
425 getOption<Parameters_FileFormat>(OPT_input_format) == Parameters_FileFormat::FF_XML_TEC)
427 THROW_ERROR(
"Multiple target device file: " + input_file +
" " +
428 getOption<std::string>(OPT_target_device_file));
437 if(getOption<Parameters_FileFormat>(OPT_input_format) == Parameters_FileFormat::FF_XML_TEC)
439 if(!
isOption(OPT_target_device_file))
#define INPUT_OPT_NORMALIZATION_WEIGHT_FILE
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
int exit_code
NOTE: this file must be included only by source code of the executable (i.e., the file with the main)...
void setOption(const std::string &name, const G value)
Sets the value of an option.
SpiderParameter(const std::string &program_name, int argc, char **const argv)
Constructor.
File containing functions and utilities to support the printing of debug messagges.
#define OUTPUT_LEVEL_NONE
no output print is performed.
#define STR_CST_string_separator
The character used to separate concatenated string.
char **const argv
The input parameters;.
const std::vector< std::string > SplitString(const std::string &input, const std::string &separators)
Function which splits a string into tokens.
#define COMMON_SHORT_OPTIONS_STRING
define the default tool short option string
(Input) XML benchhmarks to be execluded from training set
void PrintProgramName(std::ostream &os) const override
Print the name of the program to be included in the header.
(Output) XML weights of single operations computed
#define INPUT_OPT_CROSS_VALIDATION
int Exec() override
Execute parameter parsing.
#define OUTPUT_LEVEL_MINIMUM
minimum debugging print is performed.
#define INPUT_OPT_NORMALIZATION_SEQUENCES
void PrintUsage(std::ostream &os) const
Print the usage of this tool = PrintHeader() + PrintHelp()
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
#define INPUT_OPT_COMPONENTS
Parameters_FileFormat GetFileFormat(const std::filesystem::path &file, bool check_cml_root_node=false) const
Return the file format given the file name or the extension.
#define INPUT_OPT_ACCURACY
PARAMETERS STUFF ***********************///.
#define INPUT_OPT_SURVIVING_BENCHMARKS
#define PARAMETER_PARSED
An integer value to return if parameters have been right parsed.
virtual void CheckParameters()=0
Checks the compatibility among the different parameters and determines the implications.
utility function used to read files.
(Input) XML storing symbolic symulation results
This file collects some utility functions and macros.
#define DEBUG_LEVEL_NONE
no debugging print is performed.
(Input) comma separated value
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
(Input) task graph for free
#define INFINITE_LONG_DOUBLE
long double representing infinite
#define COMMON_LONG_OPTIONS
define default TOOL long options
#define NUM_CST_surviving_benchmarks
The number of surviving benchmarks.
int debug_level
debug level
void CheckParameters() override
Check the compatibility among the different parameters and compute implicated parameters.
void PrintHelp(std::ostream &os) const override
Print the usage of this tool.
std::string GetPath(std::filesystem::path path)
#define INPUT_OPT_BENCHMARK_BOUNDS
Parameters_FileFormat
File formats.
(Input/Output) XML symbolic weights
(Input) XML storing experimental setup
(Input) XML storing format of latex table to be produced
void SetDefaults() override
Sets the default values for the spider tool.
void getOption(const std::string &name, G &variable) const
Returns the value of an option.
#define INPUT_OPT_SEQUENCE_LENGTH
Dump information read already read from profiling file to other files.
void PrintGeneralOptionsUsage(std::ostream &os) const
Print the usage of the general common options.
bool isOption(const std::string &name) const
Tests if an option has been stored.
#define INPUT_OPT_PREDICTION_INTERVAL_VALUE
void PrintOutputOptionsUsage(std::ostream &os) const
Print the usage of the output common options.
int argc
The number of input paramters.
bool ManageDefaultOptions(int next_option, char *optarg_param, bool &exit_success)
Manage default options (common to all tools)
#define DEBUG_LEVEL_MINIMUM
minimum debugging print is performed.
#define PARAMETER_NOTPARSED
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...