35 #include <boost/timer.hpp>
86 oStream_ =
new std::ostringstream;
153 createEstimateData(*adf, *idf, totalArea, longestPathDelay);
158 dsdb_->setLongestPathDelayEstimate(
164 set<RowID> applicationIDs = dsdb_->applicationIDs();
165 for (set<RowID>::const_iterator i = applicationIDs.begin();
166 i != applicationIDs.end(); i++) {
179 string applicationPath = dsdb_->applicationPath(*i);
185 if (applicationFile.length() < 1) {
193 "No program found from application dir '%s'")
194 % applicationPath).str());
198 #if (!defined(HAVE_CXX11) && !defined(HAVE_CXX0X))
199 std::auto_ptr<TTAProgram::Program> scheduledProgram(
200 schedule(applicationFile, *adf));
202 std::unique_ptr<TTAProgram::Program> scheduledProgram(
203 schedule(applicationFile, *adf));
206 if (scheduledProgram.get() == NULL) {
220 *scheduledProgram, *adf, testApplication, 0, runnedCycles,
224 *scheduledProgram, *adf, testApplication, 0, runnedCycles,
232 string resultString = oStream_->str();
233 if (resultString != correctResult) {
234 std::cerr <<
"Simulation FAILED, possible bug in scheduler!"
236 std::cerr <<
"Architecture id in DSDB:" << std::endl;
238 std::cerr <<
"use sqlite3 to find out which configuration "
239 <<
"has that id to get the machine written to "
240 <<
"ADF." << std::endl;
243 std::cerr <<
"********** result found:" << std::endl;
244 std::cerr << resultString << std::endl;
245 std::cerr <<
"********** expected result:" << std::endl;
246 std::cerr << correctResult << std::endl;
247 std::cerr <<
"**********" << std::endl;
262 dsdb_->addCycleCount(
269 estimator_.totalEnergy(
270 *adf, *idf, *scheduledProgram, *traceDB);
271 dsdb_->addEnergyEstimate(
273 result.
setEnergy(*scheduledProgram, programEnergy);
316 const std::string bytecodeFile,
325 if (
options->compilerOptions()) {
326 compilerOptions =
options->compilerOptionsString();
329 compilerOptions = paramOptions;
333 if (compilerOptions.find(
"-O") == std::string::npos) {
334 compilerOptions +=
" -O3";
342 std::string adf = tmpDir +
DS +
"mach.adf";
343 std::string tpef = tmpDir +
DS +
"program.tpef";
354 std::vector<std::string> tceccOutputLines;
356 std::string tceccCommand = tceccPath +
" "
357 + compilerOptions +
" --no-link -a " + adf +
" -o "
358 + tpef +
" " + bytecodeFile +
" --no-plugin-cache 2>&1";
364 if (debug && tceccOutputLines.size() > 0) {
365 for (
unsigned int i = 0; i < tceccOutputLines.size(); ++i) {
366 std::cout << tceccOutputLines.at(i) << std::endl;
373 std::cout <<
"failed command: " << tceccCommand << std::endl
374 <<
"temporary directory left for inspection at: "
375 << tmpDir << std::endl;
420 const bool useCompiledSimulation,
421 std::vector<ClockCycleCount>* executionCounts) {
424 useCompiledSimulation ?
434 const string traceFile =
":memory:";
436 if (!useCompiledSimulation)
447 std::string command =
"";
459 if (interpreter.
result().size() > 0) {
460 *oStream_ << interpreter.
result() << std::endl;
469 if (interpreter.
result().size() > 0) {
470 *oStream_ << interpreter.
result() << std::endl;
482 if (interpreter.
result().size() > 0) {
483 *oStream_ << interpreter.
result() << std::endl;
489 int instructionCount =
program.instructionVector().size();
490 if (executionCounts) {
491 executionCounts->resize(instructionCount, 0);
492 for (
int i=0; i<instructionCount; ++i) {
509 #pragma GCC diagnostic ignored "-Wstrict-aliasing"
528 const std::string& pluginName,
DSDBManager* dsdb) {
529 string pluginFileName = pluginName +
".so";
531 for (vector<string>::const_iterator iter = searchPaths.begin();
532 iter != searchPaths.end(); iter++) {
535 pluginTool_.addSearchPath(*iter);
538 pluginTool_.registerModule(pluginFileName);
540 pluginTool_.importSymbol(
541 "create_explorer_plugin_" + pluginName, pluginCreator,
551 #pragma GCC diagnostic warning "-Wstrict-aliasing"
559 std::vector<DesignSpaceExplorerPlugin*> plugins;
560 vector<string> found_plugins;
562 for (vector<string>::const_iterator iter = searchPaths.begin();
563 iter != searchPaths.end(); iter++) {
569 for (
unsigned int i = 0; i < found_plugins.size(); ++i) {
576 plugins.push_back(plugin);
599 const double& frequency,
600 const double& maxArea,
601 const bool& createEstimates,
602 const std::string& icDec,
603 const std::string& icDecHDB) {
608 idf = selectComponents(*mach, frequency, maxArea, icDec, icDecHDB);
615 if (createEstimates) {
616 createEstimateData(*mach, *idf, area, longestPathDelay);
626 dsdb_->addImplementation(*idf, longestPathDelay, area);
633 return addConfToDSDB(newConf);
653 const double& frequency,
654 const double& maxArea,
655 const bool& createEstimates,
656 const std::string& icDec,
657 const std::string& icDecHDB) {
662 idf = selectComponents(*mach, frequency, maxArea, icDec, icDecHDB);
669 if (createEstimates) {
670 createEstimateData(*mach, *idf, area, longestPathDelay);
677 newConf.
implementationID = dsdb_->addImplementation(*idf, longestPathDelay, area);
700 const double& frequency,
701 const double& maxArea,
702 const std::string& icDec,
703 const std::string& icDecHDB)
const {
713 icDecHDB, frequency, maxArea);
741 area = estimator_.totalArea(mach, idf);
742 longestPathDelay = estimator_.longestPath(mach, idf);
759 return dsdb_->addConfiguration(conf);