Commit 55cc212b authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

New option to allow exporting with WorkerOrder

parent 4f782f6e
......@@ -43,6 +43,7 @@ static const int opt_thread = 16;
static const int opt_tags = 17;
static const int opt_submit = 18;
static const int opt_export_type = 19;
static const int opt_export_order = 20;
static struct option long_options[] = {
......@@ -67,6 +68,7 @@ static struct option long_options[] = {
{"use-tags", no_argument, 0, opt_tags},
{"submit-order", no_argument, 0, opt_submit},
{"export-type", no_argument, 0, opt_export_type},
{"export-order", no_argument, 0, opt_export_order},
{0, 0, 0, 0 }
};
......@@ -83,8 +85,11 @@ ProgramOptions::ProgramOptions() {
optRevDep = false;
outputBest = false;
nbThreads = 1;
useSubmitOrder = false;
appendTags = false;
useSubmitOrder = false;
appendTags = false;
outputTypeInExport = false;
workerOrderInExport = false;
platform_bw = 1;
}
void ProgramOptions::parse(int argc, char** argv) {
......@@ -188,6 +193,9 @@ void ProgramOptions::parse(int argc, char** argv) {
case opt_export_type:
outputTypeInExport = true;
break;
case opt_export_order:
workerOrderInExport = true;
break;
case '?':
case 'h':
usage();
......
......@@ -105,8 +105,16 @@ string ExportToString::getResult() {
/* ExportAlloc: exports in .rec format */
ExportAlloc::ExportAlloc(string filename, Instance* ins, bool submitOrder, bool outputType)
: output(filename), instance(ins), submitOrder(submitOrder), outputType(outputType) {
ExportAlloc::ExportAlloc(string filename, Instance* ins, bool submitOrder, bool outputType, bool workerOrder)
: output(filename), instance(ins), submitOrder(submitOrder), outputType(outputType), workerOrder(workerOrder) {
if (workerOrder) {
if (!outputType) {
workerTaskCount.resize(instance->totalWorkers, 0);
} else {
cerr << "Export: workerOrder is not compatible with outputType, ignoring." << endl;
workerOrder = false;
}
}
}
void ExportAlloc::onSchedule(int i, int w, double s, double f) {
......@@ -135,6 +143,10 @@ void ExportAlloc::onSchedule(int i, int w, double s, double f) {
output << endl;
} else {
output << "SpecificWorker: " << w << endl;
if (workerOrder) {
output << "Workerorder: " << workerTaskCount[w] << endl;
++workerTaskCount[w];
}
}
......
......@@ -45,7 +45,8 @@ class ProgramOptions {
int nbThreads;
bool appendTags;
bool useSubmitOrder;
bool outputTypeInExport;
bool outputTypeInExport;
bool workerOrderInExport;
std::set<std::string> optionKeys;
std::vector<fullAlg> algs;
......
......@@ -58,9 +58,11 @@ class ExportAlloc : public SchedAction {
std::ofstream output;
Instance* instance;
bool submitOrder;
bool outputType;
bool outputType;
bool workerOrder;
std::vector<int> workerTaskCount;
public:
ExportAlloc(std::string filename, Instance* ins, bool submitOrder = false, bool outputType = false);
ExportAlloc(std::string filename, Instance* ins, bool submitOrder = false, bool outputType = false, bool workerOrder = false);
void onSchedule(int i, int w, double s, double f);
~ExportAlloc();
};
......
......@@ -52,7 +52,8 @@ void computeAlg(ProgramOptions& progOpt, Instance* ins,
ExportAlloc* exportAlloc = NULL;
if(opts.isPresent("export")) {
exportAlloc = new ExportAlloc(opts.asString("export"), ins, progOpt.useSubmitOrder, progOpt.outputTypeInExport);
exportAlloc = new ExportAlloc(opts.asString("export"), ins,
progOpt.useSubmitOrder, progOpt.outputTypeInExport, progOpt.workerOrderInExport);
seq.add(exportAlloc);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment