Commit 57d2e1a8 authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

New option for export in .rec format: choose between specifying the worker or...

New option for export in .rec format: choose between specifying the worker or all workers of this type
parent 308dad3a
......@@ -41,6 +41,7 @@ static const int opt_best = 14;
static const int opt_thread = 15;
static const int opt_tags = 16;
static const int opt_submit = 17;
static const int opt_export_type = 18;
......@@ -63,7 +64,8 @@ static struct option long_options[] = {
{"best", optional_argument, 0, opt_best},
{"threads", optional_argument, 0, opt_thread},
{"use-tags", no_argument, 0, opt_tags},
{"submit-order", no_argument, 0, opt_submit},
{"submit-order", no_argument, 0, opt_submit},
{"export-type", no_argument, 0, opt_export_type},
{0, 0, 0, 0 }
};
......@@ -173,12 +175,15 @@ void ProgramOptions::parse(int argc, char** argv) {
else
nbThreads = -1;
break;
case opt_tags:
appendTags = true;
break;
case opt_submit:
useSubmitOrder = true;
break;
case opt_tags:
appendTags = true;
break;
case opt_submit:
useSubmitOrder = true;
break;
case opt_export_type:
outputTypeInExport = true;
break;
case '?':
case 'h':
usage();
......
......@@ -521,6 +521,10 @@ often:
* `submit-order`
Use the `SubmitOrder` field in `instance.rec` input files instead of `JobId`.
* `export-type`
When exporting in `.rec` format with the `export=` option of algorithms, specify
all workers of this type instead of the particular worker.
* `-r <repartFile>`
Output a summary of the repartition of task types on resource types
in the repartFile. If there are only two types of resources, the
......
......@@ -105,8 +105,8 @@ string ExportToString::getResult() {
/* ExportAlloc: exports in .rec format */
ExportAlloc::ExportAlloc(string filename, Instance* ins, bool submitOrder)
: output(filename), instance(ins), submitOrder(submitOrder) {
ExportAlloc::ExportAlloc(string filename, Instance* ins, bool submitOrder, bool outputType)
: output(filename), instance(ins), submitOrder(submitOrder), outputType(outputType) {
}
void ExportAlloc::onSchedule(int i, int w, double s, double f) {
......@@ -128,11 +128,16 @@ void ExportAlloc::onSchedule(int i, int w, double s, double f) {
int type = instance->getType(w);
output << "Workers:";
for(auto& i: instance->workerIDs[type])
output << " " << i;
output << endl;
if (outputType && instance->workerIDs[type].size() > 1) {
output << "Workers:";
for(auto& i: instance->workerIDs[type])
output << " " << i;
output << endl;
} else {
output << "SpecificWorker: " << w << endl;
}
if(instance->workerNames.size() > 0) {
output << "Architecture: " << instance->workerNames[type] << endl;
} else {
......
......@@ -42,8 +42,9 @@ class ProgramOptions {
bool outputBest;
std::string outputBestFile;
int nbThreads;
bool appendTags;
bool useSubmitOrder;
bool appendTags;
bool useSubmitOrder;
bool outputTypeInExport;
std::set<std::string> optionKeys;
std::vector<fullAlg> algs;
......
......@@ -58,8 +58,9 @@ class ExportAlloc : public SchedAction {
std::ofstream output;
Instance* instance;
bool submitOrder;
bool outputType;
public:
ExportAlloc(std::string filename, Instance* ins, bool submitOrder = false);
ExportAlloc(std::string filename, Instance* ins, bool submitOrder = false, bool outputType = false);
void onSchedule(int i, int w, double s, double f);
~ExportAlloc();
};
......
......@@ -52,7 +52,7 @@ void computeAlg(ProgramOptions& progOpt, Instance* ins,
ExportAlloc* exportAlloc = NULL;
if(opts.isPresent("export")) {
exportAlloc = new ExportAlloc(opts.asString("export"), ins, progOpt.useSubmitOrder);
exportAlloc = new ExportAlloc(opts.asString("export"), ins, progOpt.useSubmitOrder, progOpt.outputTypeInExport);
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