95    const std::string& param, std::string& paramName, std::string& paramValue) {
 
   96    string::size_type separatorPos = param.find(
"=", 0);
 
   97    if (separatorPos == string::npos) {
 
   99            "Explorer plugin parameters must be in form " 
  100            "'parametername=parametervalue'.";
 
  104    paramName = param.substr(0, separatorPos);
 
  105    paramValue = param.substr(separatorPos+1, param.length());
 
 
  121    const vector<DSDBManager::ConfigurationCosts>& confs, 
 
  122    int& configurationID,
 
  123    int& applicationPath, 
 
  126    int& longestPathDelay, 
 
  129    for (
unsigned int i = 0; i < confs.size(); i++) {
 
  131        if (size > configurationID) {
 
  132            configurationID = size;
 
  134        size = confs[i].application.size();
 
  135        if (size > applicationPath) {
 
  136            applicationPath = size;
 
  139        if (size > cycleCount) {
 
  143        if (size > energyEstimate) {
 
  144            energyEstimate = size;
 
  147        if (size > longestPathDelay) {          
 
  148            longestPathDelay = size;
 
 
  165    while (numberOfSpaces != 0) {
 
 
  180    } 
else if (order == 
"P") {
 
  182    } 
else if (order == 
"C") {
 
  184    } 
else if (order == 
"E") {
 
 
  203    for (
int i = 0; i < 
options.explorerPluginParameterCount(); i++) {
 
  204        string param = 
options.explorerPluginParameter(i);
 
 
  234        std::cerr << 
"No explorer plugin file named '" << plugin
 
  235                  << 
".so' found."  << std::endl;
 
  239        std::string msg = 
"Error while trying to load the explorer plugin " 
  240            "named '" + plugin + 
".so'.";
 
 
  257    vector<string> found_plugins;
 
  258    vector<string> stripped_plugins;
 
  260    for (vector<string>::const_iterator iter = searchPaths.begin();
 
  261            iter != searchPaths.end(); iter++) {
 
  264            verboseLogC(
"Fetching plugins from directory: " + *iter, 1)
 
  268    cout << 
"| Plugin name                 | Description " << endl
 
  269         << 
"--------------------------------------------" << endl;
 
  270    cout.flags(std::ios::left);
 
  272    for (
unsigned int i = 0; i < found_plugins.size(); ++i) {
 
  273        std::string finalPluginName = found_plugins[i];        
 
  277        while (pluginName != finalPluginName) {
 
  278            finalPluginName = pluginName;
 
  281        if(find(stripped_plugins.begin(), stripped_plugins.end(), pluginName)
 
  282            == stripped_plugins.end()) {
 
  283            stripped_plugins.push_back(pluginName);
 
  286    for (
unsigned int i = 0; i < stripped_plugins.size(); ++i) {
 
  287        std::string pluginName = stripped_plugins[i];        
 
  292        cout << std::setw(30) << pluginName << plugin->
description() << endl;
 
 
  307    cout.flags(std::ios::left);
 
  308    cout << setw(30) << 
"parameter name " << setw(15) << 
"type" << 
"default value" << endl;
 
  309    cout << 
"-----------------------------------------------------------------------------" << endl;
 
  310    while (it != pm.end()) {
 
  311        cout << setw(30) << it->first << setw(15);
 
  312        switch (it->second.type()) {
 
  314                cout << 
"unsigned int"; 
 
  326                cout << 
"unknown type"; 
 
  328        if (!it->second.isCompulsory()) {
 
  329            if (it->second.type() == 
BOOL) {
 
  331                    (it->second.value() == 
"1" || it->second.value() == 
"true" 
  334                cout << it->second.value();
 
  338        if (it->second.description().size() > 0) {
 
  340            cout << it->second.description();
 
 
  354    if (criteriaSet != 
"C")
 
  360    const int CONF_COL_W = 6;
 
  361    const int CONNECTIVITY_COL_W = 6;
 
  362    const int CYCLES_COL_W = 8;
 
  364    std::cout << std::setw(CONF_COL_W) << std::right << 
"conf #"  
  367    std::cout << std::setw(CONNECTIVITY_COL_W) << std::right << 
"conn"  
  370    std::cout << std::setw(CYCLES_COL_W) << std::right << 
"cycles"  
  373    for (
int i = 0; i < CONF_COL_W + CONNECTIVITY_COL_W + CYCLES_COL_W + 10; 
 
  377    std::cout << std::endl;
 
  379    for (DSDBManager::ParetoSetConnectivityAndCycles::const_iterator i = 
 
  380             paretoSet.begin(); i != paretoSet.end(); ++i) {
 
  382        std::cout << std::setw(CONF_COL_W) << std::right << point.get<0>()
 
  385        std::cout << std::setw(CONNECTIVITY_COL_W) << std::right << point.get<1>()
 
  388        std::cout << std::setw(CYCLES_COL_W) << std::right << point.get<2>()
 
 
  402int main(
int argc, 
char* argv[]) {
 
  407    bool doneUseful = 
false;
 
  422    if (verboseLevel < 0) {
 
  433    if (
options->pluginInfo().length() != 0) {
 
  434        std::string plugin = 
options->pluginInfo();
 
  447        std::cerr << 
"Illegal number of arguments." << std::endl << std::endl;
 
  452    std::string dsdbFile = 
"";
 
  483                << 
"Added configuration " << confID << 
" into the DSDB."  
  489            std::cout << 
"Error occured reading ADF or IDF. "  
  497    int testDirectories = 
options->testApplicationDirectoryCount();
 
  498    for (
int i = 0; i < testDirectories; i++) {
 
  499        std::string testDir = 
options->testApplicationDirectory(i);
 
  505                    << 
"Application directory '" << testDir 
 
  506                    << 
"' is invalid. Ensure that at least program.bc with " 
  507                    << 
"the input program exists. Also either "  
  508                    << 
"'correct_simulation_output' or 'verify.sh' is needed " 
  509                    << 
"for verifying the program output." 
  515                    << 
"application directory '" << testDir 
 
  516                    << 
"' has already been added" << std::endl;
 
  519            std::cerr << 
"Application directory '" << testDir
 
  520                      << 
"' does not exist." << std::endl;
 
  526    if (paretoSet != 
"") {
 
  528        if (paretoSet != 
"C") {
 
  529            std::cerr << 
"Unsupported pareto set value type." << std::endl;
 
  539        cout << 
"Configurations in DSDB: " << endl;
 
  542        int cycleLength = 11;
 
  543        int energyLength = 15;
 
  546        cout << 
"| Conf ID | Application path | cycle count | energy estimate | longest path delay | area " 
  548        cout << 
"------------------------------------------------------------------------------------------" 
  550        vector<DSDBManager::ConfigurationCosts> confCosts =
 
  555            confCosts, idLength, pathLength, cycleLength, 
 
  556            energyLength, lpdLength, areaLength);
 
  557        for (
unsigned int i = 0; i < confCosts.size(); i++) {
 
  559            cout << confCosts[i].configurationID;
 
  562                    confCosts[i].configurationID).size());
 
  564            cout << confCosts[i].application;
 
  566                pathLength - confCosts[i].application.size());
 
  568            cout << confCosts[i].cycleCount;
 
  571                    confCosts[i].cycleCount).size());
 
  573            cout << confCosts[i].energyEstimate;
 
  576                    confCosts[i].energyEstimate).size());
 
  578            cout << confCosts[i].longestPathDelay;
 
  581                        confCosts[i].longestPathDelay).size());
 
  583            cout << confCosts[i].area;
 
  586                        confCosts[i].area).size());   
 
  587            cout << 
" |" << endl;
 
  589        cout <<  
"-----------------------------------------------------------------------------------------" 
  594    if (
options->printSummary() || 
options->numberOfConfigurations()) {
 
  596             << 
" configurations " 
  597             << 
"in the database." << endl;
 
  603    if (
options->writeOutConfiguration()) {
 
  604        for (
int i = 0; i < 
options->numberOfConfigurationsToWrite(); i++) {
 
  608                std::string adfFileName = 
 
  614                    std::cout << 
"Written ADF file of configuration " 
  615                              << 
options->configurationToWrite(i)
 
  618                    std::cerr << 
"Error occured while writing the ADF."  
  625                    std::string idfFileName = 
 
  631                        std::cout << 
"Written IDF file of configuration " 
  632                                  << 
options->configurationToWrite(i)
 
  635                        std::cerr << 
"Error occured while writing the IDF." 
  643                std::cerr << 
"No configuration found with id: "  
  644                          << 
options->configurationToWrite(i) << 
"."  
  655    if (
options->applicationIDToRemoveCount() > 0) {
 
  656        for (
int i = 0; i < 
options->applicationIDToRemoveCount(); i++) {
 
  661                std::cerr << 
"No application with ID: " << 
id << 
" in DSDB." 
  670    if (
options->printApplications()) {
 
  671        std::cout << 
"Applications in the DSDB:" << std::endl;
 
  672        std::cout << 
" ID | Application" << std::endl;
 
  673        std::cout << 
"---------------------------------" << std::endl;
 
  675        std::set<RowID>::const_iterator appIter = appIDs.begin();
 
  676        for (; appIter != appIDs.end(); appIter++) {
 
  677            std::cout << 
" " << (*appIter) << 
" | "  
  681        std::cout << 
"---------------------------------" << std::endl;
 
  683                  << 
" applications in DSDB." << std::endl;
 
  689    std::string pluginToUse = 
"";
 
  690    pluginToUse = 
options->explorerPlugin();
 
  691    if (pluginToUse == 
"") {
 
  693            std::cerr << 
"No explorer plugin given." << std::endl;
 
  709    if (testDirectories < 1 && !dsdb->applicationCount() &&
 
  713        std::cerr << 
"No test application paths given or found in dsdb." 
  720        vector<string> hdbPaths;
 
  725        hdbPaths.insert(hdbPaths.end(), srchPaths.begin(), srchPaths.end());
 
  727        for (
int i = 0; i < 
options->hdbFileNameCount(); i++) {
 
  728            string pathToHdb = 
options->hdbFileName(i);
 
  729            string hdbFile = 
options->hdbFileName(i);
 
  730            for (
unsigned int p = 0; p < hdbPaths.size(); p++) {
 
  734                    pathToHdb = tempPath;
 
  741                std::cerr << 
"Could not find HDB file "  
  742                          << 
options->hdbFileName(i) << std::endl;
 
  749        for (
unsigned int i = 0; i < hdbPaths.size(); i++) {
 
  754                pathToHdb = tempPath;
 
  761            std::cerr << 
"Could not find HDB file "  
  762                      << pathToHdb << std::endl;
 
  767        RowID startPointConfigurationID = 
options->startConfiguration();        
 
  768        if (startPointConfigurationID == 0 &&
 
  771                << 
"No starting point configuration defined. " << std::endl
 
  772                << 
"Use -s <confID> to define the configuration to " 
  773                << 
"start the exploration from." << std::endl;
 
  777        vector<RowID> result =
 
  778            explorer->
explore(startPointConfigurationID);
 
  779        if (result.empty()) {
 
  781                << 
"No fitting processor configurations were created." << endl;
 
  783            std::cout << 
"Best result configurations:" << std::endl;
 
  784            for (
unsigned int i = 0; i < result.size(); i++) {
 
  785                cout << 
" " << result[i] << endl;
 
  791                  << 
" " << e.
lineNum() << std::endl;
 
 
#define verboseLogC(text, neededVerbosity)
 
int RowID
Type definition of row ID in relational databases.
 
int main(int argc, char *argv[])
 
DesignSpaceExplorerPlugin * loadExplorerPlugin(const std::string &plugin, DSDBManager *dsdb)
 
void parseParameter(const std::string ¶m, std::string ¶mName, std::string ¶mValue)
 
void determineLongest(const vector< DSDBManager::ConfigurationCosts > &confs, int &configurationID, int &applicationPath, int &cycleCount, int &energyEstimate, int &longestPathDelay, int &area)
 
void printPluginParamInfo(DesignSpaceExplorerPlugin &plugin)
 
bool loadPluginParameters(DesignSpaceExplorerPlugin *plugin, const ExplorerCmdLineOptions &options)
 
DSDBManager::Order orderingOfData(const string &order)
 
DSDBManager * loadDSDB(const std::string &dsdbFile)
 
void printParetoSet(const DSDBManager &dsdb, TCEString criteriaSet)
 
const string EXPLORER_DEFAULT_HDB
 
void printSpaces(unsigned int numberOfSpaces)
 
static MachInfoCmdLineOptions options
 
static void setCmdLineOptions(CmdLineOptions *options_)
 
static void setVerboseLevel(const int level=VERBOSE_LEVEL_DEFAULT)
 
static int verboseLevel()
 
void parse(char *argv[], int argc)
 
virtual std::string argument(int index) const
 
virtual int numberOfArguments() const
 
static std::string toString(const T &source)
 
RowID addArchitecture(const TTAMachine::Machine &mom)
 
bool hasApplication(RowID id) const
 
static DSDBManager * createNew(const std::string &file)
 
std::set< RowID > configurationIDs() const
 
std::set< ParetoPointConnectivityAndCycles > ParetoSetConnectivityAndCycles
 
std::set< RowID > applicationIDs() const
 
MachineConfiguration configuration(RowID id) const
 
std::string applicationPath(RowID id) const
 
void writeArchitectureToFile(RowID id, const std::string &path) const
 
boost::tuple< RowID, int, ClockCycleCount > ParetoPointConnectivityAndCycles
 
std::vector< ConfigurationCosts > applicationCostEstimatesByConf(Order ordering=ORDER_BY_CONFIGURATION) const
 
bool hasConfiguration(RowID id) const
 
int applicationCount() const
 
RowID addImplementation(const IDF::MachineImplementation &impl, double longestPathDelay, CostEstimator::AreaInGates area)
 
Order
Identifiers for ordering results.
 
@ ORDER_BY_ENERGY_ESTIMATE
 
void removeApplication(RowID id)
 
void writeImplementationToFile(RowID id, const std::string &path) const
 
RowID addConfiguration(const MachineConfiguration &conf)
 
ParetoSetConnectivityAndCycles paretoSetConnectivityAndCycles(RowID application=ILLEGAL_ROW_ID) const
 
RowID addApplication(const std::string &path)
 
virtual std::string description() const
 
virtual bool requiresStartingPointArchitecture() const =0
 
std::map< std::string, ExplorerPluginParameter > ParameterMap
 
ParameterMap parameters() const
 
std::map< std::string, ExplorerPluginParameter >::const_iterator PMCIt
 
virtual std::vector< RowID > explore(const RowID &startPointConfigurationID, const unsigned int &maxIter=0)
 
virtual bool requiresApplication() const
 
virtual void giveParameter(const std::string &name, const std::string &value)
 
static DesignSpaceExplorerPlugin * loadExplorerPlugin(const std::string &pluginName, DSDBManager *dsdb=NULL)
 
static std::vector< std::string > hdbPaths(bool libraryPathsOnly=false)
 
static std::vector< std::string > explorerPluginPaths()
 
std::string fileName() const
 
std::string errorMessage() const
 
static const std::string DIRECTORY_SEPARATOR
 
static bool findFromDirectory(const std::string ®ex, const std::string &directory, STLCONT &found)
 
static std::string fileNameBody(const std::string &fileName)
 
static std::string currentWorkingDir()
 
static bool fileIsDirectory(const std::string fileName)
 
static bool fileExists(const std::string fileName)
 
static HDBRegistry & instance()
 
CachedHDBManager & hdb(const std::string fileName)
 
static MachineImplementation * loadFromIDF(const std::string &idfFileName)
 
virtual void printHelp() const
 
static Machine * loadFromADF(const std::string &adfFileName)