OpenASIP  2.0
Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Evaluate Class Reference
Inheritance diagram for Evaluate:
Inheritance graph
Collaboration diagram for Evaluate:
Collaboration graph

Private Member Functions

 PLUGIN_DESCRIPTION ("Evaluates and/or estimates a configuration.")
 
 Evaluate ()
 
virtual bool requiresStartingPointArchitecture () const
 
virtual bool producesArchitecture () const
 
virtual bool requiresHDB () const
 
virtual bool requiresSimulationData () const
 
virtual std::vector< RowIDexplore (const RowID &configurationID, const unsigned int &)
 
void readParameters ()
 
bool createConfig (const std::string &adf, const std::string &idf, DSDBManager &dsdb, DSDBManager::MachineConfiguration &conf)
 
void printEstimates (const CostEstimates &estimates, const DSDBManager::MachineConfiguration &configuration)
 

Private Attributes

std::string adf_
 name of the adf file to evaluate More...
 
std::string idf_
 name of the idf file to evaluate More...
 
bool print_
 print evaluation results More...
 

Static Private Attributes

static const std::string adfPN_
 
static const std::string idfPN_
 
static const std::string printPN_
 

Additional Inherited Members

- Public Types inherited from DesignSpaceExplorerPlugin
typedef std::pair< std::string, ExplorerPluginParameterParameter
 
typedef std::map< std::string, ExplorerPluginParameterParameterMap
 
typedef std::map< std::string, ExplorerPluginParameter >::iterator PMIt
 
typedef std::map< std::string, ExplorerPluginParameter >::const_iterator PMCIt
 
- Public Member Functions inherited from DesignSpaceExplorerPlugin
virtual bool requiresApplication () const
 
virtual std::string description () const
 
void addParameter (TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")
 
template<typename T >
void readCompulsoryParameter (const std::string paramName, T &param) const
 
template<typename T >
void readOptionalParameter (const std::string paramName, T &param) const
 
template<typename RT >
RT parameterValue (const std::string &paramName) const
 
virtual ~DesignSpaceExplorerPlugin ()
 
virtual void giveParameter (const std::string &name, const std::string &value)
 
virtual std::string name () const
 
virtual void setPluginName (const std::string &pluginName)
 
virtual bool hasParameter (const std::string &paramName) const
 
ParameterMap parameters () const
 
virtual bool booleanValue (const std::string &parameter) const
 
- Public Member Functions inherited from DesignSpaceExplorer
 DesignSpaceExplorer ()
 
virtual ~DesignSpaceExplorer ()
 
virtual void setDSDB (DSDBManager &dsdb)
 
virtual bool evaluate (const DSDBManager::MachineConfiguration &configuration, CostEstimates &results=dummyEstimate_, bool estimate=false)
 
virtual DSDBManagerdb ()
 
std::vector< DesignSpaceExplorerPlugin * > getPlugins ()
 
RowID createImplementationAndStore (const DSDBManager::MachineConfiguration &conf, const double &frequency=0.0, const double &maxArea=0.0, const bool &createEstimates=true, const std::string &icDec="DefaultICDecoder", const std::string &icDecHDB="asic_130nm_1.5V.hdb")
 
bool createImplementation (const DSDBManager::MachineConfiguration &conf, DSDBManager::MachineConfiguration &newConf, const double &frequency=0.0, const double &maxArea=0.0, const bool &createEstimates=true, const std::string &icDec="DefaultICDecoder", const std::string &icDecHDB="asic_130nm_1.5V.hdb")
 
IDF::MachineImplementationselectComponents (const TTAMachine::Machine &mach, const double &frequency=0.0, const double &maxArea=0.0, const std::string &icDec="DefaultICDecoder", const std::string &icDecHDB="asic_130nm_1.5V.hdb") const
 
void createEstimateData (const TTAMachine::Machine &mach, const IDF::MachineImplementation &idf, CostEstimator::AreaInGates &area, CostEstimator::DelayInNanoSeconds &longestPathDelay)
 
RowID addConfToDSDB (const DSDBManager::MachineConfiguration &conf)
 
- Static Public Member Functions inherited from DesignSpaceExplorer
static DesignSpaceExplorerPluginloadExplorerPlugin (const std::string &pluginName, DSDBManager *dsdb=NULL)
 
- Protected Member Functions inherited from DesignSpaceExplorerPlugin
 DesignSpaceExplorerPlugin ()
 
void checkParameters () const
 
- Protected Member Functions inherited from DesignSpaceExplorer
TTAProgram::Programschedule (const std::string applicationFile, TTAMachine::Machine &machine, TCEString paramOptions="-O3")
 
const ExecutionTracesimulate (const TTAProgram::Program &program, const TTAMachine::Machine &machine, const TestApplication &testApplication, const ClockCycleCount &maxCycles, ClockCycleCount &runnedCycles, const bool tracing, const bool useCompiledSimulation=false, std::vector< ClockCycleCount > *executionCounts=NULL)
 
- Protected Attributes inherited from DesignSpaceExplorerPlugin
std::string pluginName_
 the name of the explorer plugin More...
 
ParameterMap parameters_
 Parameters for the plugin. More...
 

Detailed Description

Explorer plugin that evaluates a configuration and estimates it if the configuration has an implementation.

Definition at line 59 of file Evaluate.cc.

Constructor & Destructor Documentation

◆ Evaluate()

Evaluate::Evaluate ( )
inlineprivate

Definition at line 62 of file Evaluate.cc.

63  adf_(""),
64  idf_(""),
65  print_(true) {
66 
67  // compulsory parameters
68  // no compulsory parameters
69 
70  // parameters that have a default value
71  addParameter(adfPN_, STRING, false, adf_);
72  addParameter(idfPN_, STRING, false, idf_);
74  }

References BOOL, STRING, and Conversion::toString().

Here is the call graph for this function:

Member Function Documentation

◆ createConfig()

bool Evaluate::createConfig ( const std::string &  adf,
const std::string &  idf,
DSDBManager dsdb,
DSDBManager::MachineConfiguration conf 
)
inlineprivate

Load adf and idf from files and store to given dsdb and config.

Parameters
adfPath of architecture definition file.
idfPath of implementation definition file.
dsdbDatabase where to store adf and idf.
confConfiguration for adf/idf ids.
Returns
True if creating config succeeded, else false.

Definition at line 174 of file Evaluate.cc.

178  {
179 
180  assert(adf != "");
181 
182  IDF::MachineImplementation* idfo = NULL;
183  TTAMachine::Machine* mach = NULL;
184  try {
185  if (adf != "") {
187  conf.architectureID = dsdb.addArchitecture(*mach);
188  } else {
189  return false;
190  }
191  if (idf != "") {
193  conf.implementationID =
194  dsdb.addImplementation(*idfo, 0,0);
195  conf.hasImplementation = true;
196  } else {
197  conf.hasImplementation = false;
198  }
199  } catch (const Exception& e) {
200  std::ostringstream msg(std::ostringstream::out);
201  msg << "Error loading the adf/idf." << std::endl;
202  verboseLog(msg.str());
203  delete mach;
204  return false;
205  }
206  delete mach;
207  return true;
208  }

References DSDBManager::addArchitecture(), DSDBManager::addImplementation(), DSDBManager::MachineConfiguration::architectureID, assert, DSDBManager::MachineConfiguration::hasImplementation, DSDBManager::MachineConfiguration::implementationID, TTAMachine::Machine::loadFromADF(), IDF::MachineImplementation::loadFromIDF(), and verboseLog.

Here is the call graph for this function:

◆ explore()

virtual std::vector<RowID> Evaluate::explore ( const RowID startPointConfigurationID,
const unsigned int &  maxIter 
)
inlineprivatevirtual

Explores the design space from the starting point machine and returns best exploring results as configuration IDs.

Exploring creates new machine configurations (architecture, implementation) that are ordered so that the best results are first in the result vector.

Parameters
startPointStarting point machine configuration for the plugin.
maxIterMaximum number of design space points the plugin is allowed to explore. Default value for maxIter is zero when the iteration number is not taken into account. In that case the exploration runs indefinetly or stops at a point defined by the algorithm.
Returns
Ordered vector of IDs of the best machine configurations where the target programs can be successfully run. The IDs of the best machine configurations are first in the result vector. Returns an empty vector if does not find any possible machine configurations.

Reimplemented from DesignSpaceExplorerPlugin.

Definition at line 82 of file Evaluate.cc.

82  {
84  std::vector<RowID> result;
85 
86  // make params for adf and idf, so no configuration needed
87  if (configurationID == 0 && adf_ == "") {
88  std::ostringstream msg(std::ostringstream::out);
89  msg << "No configuration nor adf defined. Use -s <confID> to "
90  << "define the configuration to be optimized or give adf "
91  << "as plugin parameter." << endl;
92  verboseLog(msg.str());
93  return result;
94  }
95 
96  DSDBManager& dsdb = db();
98 
99  // load adf/idf from file if no configuration was given
100  if (configurationID == 0) {
101  if (!createConfig(adf_, idf_, dsdb, conf)) {
102  return result;
103  }
104  } else {
105  // if starting configuration given load it
106  conf = dsdb.configuration(configurationID);
107  }
108 
109  CostEstimates estimates;
110  bool estimate = (conf.hasImplementation ? true : false);
111  try {
112  if (!evaluate(conf, estimates, estimate)) {
113  verboseLog(std::string("Evaluate failed."))
114  return result;
115  }
116  } catch (const Exception& e) {
117  debugLog(std::string("Error in Evaluate plugin: ")
118  + e.errorMessage() + std::string(" ")
119  + e.errorMessageStack());
120  return result;
121  }
122 
123  verboseLogC(std::string("Evalution OK, ")
124  + (estimate ? "with" : "without") + " estimation.",1)
125 
126  if (print_ && estimate) {
127  printEstimates(estimates, conf);
128  }
129 
130  // add new configuration to the database
131  if (configurationID == 0) {
132  RowID newConfID = addConfToDSDB(conf);
133  if (newConfID != 0) {
134  result.push_back(newConfID);
135  }
136  }
137  return result;
138  }

References DSDBManager::configuration(), debugLog, Exception::errorMessage(), Exception::errorMessageStack(), DSDBManager::MachineConfiguration::hasImplementation, verboseLog, and verboseLogC.

Here is the call graph for this function:

◆ PLUGIN_DESCRIPTION()

Evaluate::PLUGIN_DESCRIPTION ( "Evaluates and/or estimates a configuration."  )
private

◆ printEstimates()

void Evaluate::printEstimates ( const CostEstimates estimates,
const DSDBManager::MachineConfiguration configuration 
)
inlineprivate

Print estimates

Parameters
estimatesThe cost estimates to be printed.

Definition at line 216 of file Evaluate.cc.

218  {
219  std::ostream& log = std::cout;
220  log.flags(std::ios::left);
221  int fw = 27;
222 
223  log << setw(fw) << "Area: " << estimates.area() << endl;
224  log << setw(fw) << "Longest path delay: " <<
225  estimates.longestPathDelay() << endl;
226  for (int i = 0; i < estimates.energies(); ++i) {
227  log << "application " << i << setw(14) << " energy: " <<
228  estimates.energy(i) << endl;
229  }
230 
231  std::vector<ClockCycleCount> cycleCounts =
232  db().cycleCounts(configuration);
233 
234  for (int i = 0; i < (int)cycleCounts.size(); ++i) {
235  log << "application " << i << " cycle count: " <<
236  cycleCounts.at(i) << endl;
237  }
238  }

References CostEstimates::area(), CostEstimates::energies(), CostEstimates::energy(), and CostEstimates::longestPathDelay().

Here is the call graph for this function:

◆ producesArchitecture()

virtual bool Evaluate::producesArchitecture ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 77 of file Evaluate.cc.

77 { return false; }

◆ readParameters()

void Evaluate::readParameters ( )
inlineprivate

Reads the parameters given to the plugin.

Definition at line 157 of file Evaluate.cc.

157  {
158  // optional parameters
162  }

◆ requiresHDB()

virtual bool Evaluate::requiresHDB ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 78 of file Evaluate.cc.

78 { return false; }

◆ requiresSimulationData()

virtual bool Evaluate::requiresSimulationData ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 79 of file Evaluate.cc.

79 { return true; }

◆ requiresStartingPointArchitecture()

virtual bool Evaluate::requiresStartingPointArchitecture ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 76 of file Evaluate.cc.

76 { return false; }

Member Data Documentation

◆ adf_

std::string Evaluate::adf_
private

name of the adf file to evaluate

Definition at line 148 of file Evaluate.cc.

◆ adfPN_

const std::string Evaluate::adfPN_
staticprivate

Definition at line 142 of file Evaluate.cc.

◆ idf_

std::string Evaluate::idf_
private

name of the idf file to evaluate

Definition at line 150 of file Evaluate.cc.

◆ idfPN_

const std::string Evaluate::idfPN_
staticprivate

Definition at line 143 of file Evaluate.cc.

◆ print_

bool Evaluate::print_
private

print evaluation results

Definition at line 152 of file Evaluate.cc.

◆ printPN_

const std::string Evaluate::printPN_
staticprivate

Definition at line 144 of file Evaluate.cc.


The documentation for this class was generated from the following file:
DesignSpaceExplorer::evaluate
virtual bool evaluate(const DSDBManager::MachineConfiguration &configuration, CostEstimates &results=dummyEstimate_, bool estimate=false)
Definition: DesignSpaceExplorer.cc:133
DesignSpaceExplorer::db
virtual DSDBManager & db()
Definition: DesignSpaceExplorer.cc:300
CostEstimates
Definition: CostEstimates.hh:57
DSDBManager::MachineConfiguration::hasImplementation
bool hasImplementation
Definition: DSDBManager.hh:80
DesignSpaceExplorer::addConfToDSDB
RowID addConfToDSDB(const DSDBManager::MachineConfiguration &conf)
Definition: DesignSpaceExplorer.cc:755
Evaluate::createConfig
bool createConfig(const std::string &adf, const std::string &idf, DSDBManager &dsdb, DSDBManager::MachineConfiguration &conf)
Definition: Evaluate.cc:174
RowID
int RowID
Type definition of row ID in relational databases.
Definition: DBTypes.hh:37
DesignSpaceExplorerPlugin::DesignSpaceExplorerPlugin
DesignSpaceExplorerPlugin()
Definition: DesignSpaceExplorerPlugin.cc:48
CostEstimates::energy
double energy(int index) const
Definition: CostEstimates.cc:138
CostEstimates::energies
int energies() const
Definition: CostEstimates.cc:124
Evaluate::idf_
std::string idf_
name of the idf file to evaluate
Definition: Evaluate.cc:150
Conversion::toString
static std::string toString(const T &source)
verboseLog
#define verboseLog(text)
Definition: Application.hh:115
BOOL
@ BOOL
Definition: ExplorerPluginParameter.hh:40
Evaluate::readParameters
void readParameters()
Definition: Evaluate.cc:157
assert
#define assert(condition)
Definition: Application.hh:86
DSDBManager::MachineConfiguration::implementationID
RowID implementationID
Definition: DSDBManager.hh:81
Evaluate::printPN_
static const std::string printPN_
Definition: Evaluate.cc:144
DesignSpaceExplorerPlugin::readOptionalParameter
void readOptionalParameter(const std::string paramName, T &param) const
CostEstimates::longestPathDelay
double longestPathDelay() const
Definition: CostEstimates.cc:112
DSDBManager::MachineConfiguration
Definition: DSDBManager.hh:78
Evaluate::print_
bool print_
print evaluation results
Definition: Evaluate.cc:152
Evaluate::idfPN_
static const std::string idfPN_
Definition: Evaluate.cc:143
STRING
@ STRING
Definition: ExplorerPluginParameter.hh:40
verboseLogC
#define verboseLogC(text, neededVerbosity)
Definition: Application.hh:110
Evaluate::printEstimates
void printEstimates(const CostEstimates &estimates, const DSDBManager::MachineConfiguration &configuration)
Definition: Evaluate.cc:216
CostEstimates::area
double area() const
Definition: CostEstimates.cc:101
Evaluate::adf_
std::string adf_
name of the adf file to evaluate
Definition: Evaluate.cc:148
Exception
Definition: Exception.hh:54
DSDBManager
Definition: DSDBManager.hh:76
DSDBManager::addArchitecture
RowID addArchitecture(const TTAMachine::Machine &mom)
Definition: DSDBManager.cc:191
DSDBManager::configuration
MachineConfiguration configuration(RowID id) const
Definition: DSDBManager.cc:361
Evaluate::adfPN_
static const std::string adfPN_
Definition: Evaluate.cc:142
debugLog
#define debugLog(text)
Definition: Application.hh:95
DSDBManager::MachineConfiguration::architectureID
RowID architectureID
Definition: DSDBManager.hh:79
DesignSpaceExplorerPlugin::addParameter
void addParameter(TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")
DSDBManager::addImplementation
RowID addImplementation(const IDF::MachineImplementation &impl, double longestPathDelay, CostEstimator::AreaInGates area)
Definition: DSDBManager.cc:252
IDF::MachineImplementation
Definition: MachineImplementation.hh:54
IDF::MachineImplementation::loadFromIDF
static MachineImplementation * loadFromIDF(const std::string &idfFileName)
Definition: MachineImplementation.cc:1524
DSDBManager::cycleCounts
std::vector< ClockCycleCount > cycleCounts(const MachineConfiguration &conf) const
Definition: DSDBManager.cc:738
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::Machine::loadFromADF
static Machine * loadFromADF(const std::string &adfFileName)
Definition: Machine.cc:905