-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathset_options.cpp
158 lines (147 loc) · 6.65 KB
/
set_options.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**
* set_options.cpp -
* @author: Jonathan Beard
* @version: Thu May 16 09:13:02 2013
*/
#include <cassert>
#include <array>
#include "set_options.hpp"
#include "data.hpp"
#include "command_arguments.h"
#include "options_vars.hpp"
#include "common.hpp"
#include "command_option_single.tcc"
#include "command_option_multiple.tcc"
void
Set_Options::SetOptions( CmdArgs &cmd, Raft::Data &data )
{
Options_Vars &options( data.get_options_vars() );
cmd.addOption( new Option< bool >( options.help,
"-h",
"Print this message",
[](const char *x, bool &v){
v = true;
return( true );
},
nullptr,
false,
true ) );
cmd.addOption( new Option< bool >( options.verbose,
"-v",
"Verbose execution mode" ) );
cmd.addOption( new Option< bool >( options.dry_run,
"-dry_run",
"Dry run, automatically triggers verbose" ) );
cmd.addOption( new Option< bool >( options.output_topology_image,
"-img_topo",
"Output image of Raft app topology via GraphViz") );
cmd.addOption( new Option< bool >( options.clean,
"-clean",
"Clean all generated code, sort of like 'make clean'") );
cmd.addOption( new Option< bool >( options.generate_ap_v2_compat,
"-gen_v2",
std::string("Generate AutoPipe version 2.0 compatible x files ") +
std::string("and executable code, automatically means generate ") +
std::string("a run package") ) );
cmd.addOption( new Option< std::string >(
options.send_code_to_directory,
"-dir_for_code",
"Send code to this directory instead of PWD" ) );
cmd.addOption( new Option< int64_t >( options.optimization_level,
"-O",
"Optimization level, valid options are 0,1,2,3" ) );
cmd.addOption( new Option< bool >(options.use_genetic_algorithm,
"-genetic_algorithm",
"Use genetic algorithm to optimize application" ));
cmd.addOption( new Option< bool >(options.use_simulated_annealing,
"-simulated_annealing",
"Use simulated annealing to optimize application" ));
cmd.addOption( new Option< bool >(options.enter_graph_modeler_mode,
"-use_graph_modeler",
std::string("Enter interactive GraphModeler mode( must have ") +
std::string("GraphModeler exe compiled and in your path )") ));
cmd.addOption( new Option< std::string >(
options.unmapped_image_suffix,
"-img_unmapped_suffix",
"Suffix selection for unmapped topology images" ) );
cmd.addOption( new Option< std::string >(
options.mapped_image_suffix,
"-img_mapped_suffix",
"Suffix selection for mapped topology images" ) );
cmd.addOption( new Option< std::string >(
options.dir_for_images,
"-img_dir",
"Directory for topology images" ) );
cmd.addOption( new Option< bool >(
options.hardware_map_image,
"-img_hardware_topo",
"Output image for Raft hardware mapped topology" ));
cmd.addOption( new Option< std::string >(
options.map_objective,
"-mapping_objective",
"Objective for optimizations" ) );
cmd.addOption( new Option< std::string >(
options.hardware_defs_file,
"-hardware_definitions",
std::string("Specifications and known information about ") +
std::string("the hardware you want to map the application to") ));
cmd.addOption( new Option< std::string >(
options.comm_hardware_defs_file,
"-comm_definitions",
std::string("Specifications and known information about ") +
std::string("the communications hardware you want to map the") +
std::string(" application to")) );
cmd.addOption( new Option< std::string >(
options.hardware_configuration_rules,
"-hardware_config_rules",
std::string("Rules to map the hardware resources together ") +
std::string("in a sane way") ) );
cmd.addOption( new Option< int64_t >(
options.max_buffer_size,
"-max_buffer_size",
std::string("Set global maximum allowable buffer size ") +
std::string("(in bytes)") ) );
cmd.addOption( new Option< bool >(
options.generate_run_package,
"-generate_run_pkg",
std::string("Generate a run package suitable for deployment ") +
std::string("on multiple targets")) );
cmd.addOption( new Option< bool >(
options.dump_cpp_output,
"-dump_cpp_output",
"Dump output from cpp" ) );
cmd.addOption( new Option< bool >(
options.dump_include_file_list,
"-dump_include_file_list",
"Dump include file list to cpp" ) );
cmd.addOption( new Option< bool >(
options.dump_parse_stream,
"-dump_parse_stream",
"Dump parse stream" ) );
cmd.addOption( new OptionMultiple<std::string,3>(
{{ &options.input_full_path,
&options.input_filename,
&options.input_dir_path}},
"-f",
"Specify Autopipe input filename",
{{[&](const char *x, bool &v) /* full pathname */
{
v = true;
return( std::string( x ) );
},
[&](const char *x, bool &v) /* filename */
{
std::string out(
Raft::Common::GetFileNameFromPath( x, v ) );
return( out );
},
[&](const char *x, bool &v) /* dir path */
{
std::string out(
Raft::Common::ExtractPathNoFileName( x, v ) );
return( out );
} }},
nullptr,
true /* mandatory */
) );
}