Commit d4fa0525 authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

Correctly use the "Model" field in tasks.rec files instead of "Name"

Thanks to Vinícius Garcia Pinto for the report
parent 82b59474
......@@ -46,7 +46,7 @@ Records are separated by double newlines.
The format of the instance file is designed as to accept the `tasks.rec` files as provided by StarPU's export tools.
The instance file contains one record per task, with the following keys:
+ `Name` and `Footprint` specify the task type. All tasks with identical names and footprints belong to the same task type.
+ `Model` and `Footprint` specify the task type. All tasks with identical names and footprints belong to the same task type.
+ `JobId` is an integer identifier of the task
+ `DependsOn` contains a space-separated list of the `JobId`s of the predecessor of the current task.
+ `EstimatedTime` contains a space-separated list of the execution time of this task on each resource (if there are
......@@ -135,7 +135,7 @@ The second part starts with ```%rec: timing``` on a separate line, and
contains one record for each task type/resource type combination.
Records contain the following fields:
+ `Name` and `Footprint` represent the task type, similarly to the instance file.
+ `Model` and `Footprint` represent the task type, similarly to the instance file.
+ `Architecture` represent the resource type, as specified in the first part.
+ `Mean` contain the execution time (which is computed as an average by StarPU).
+ Files produced by StarPU also contain an `Stddev` field, which contains the standard deviation
......
......@@ -36,6 +36,23 @@ static string recordValue(const rec_record_t record, const char* field) {
}
}
static string recordValueAlternativeOpt(const rec_record_t record, const char* firstChoice, const char* secondChoice) {
string value = recordValueOpt(record, firstChoice);
if (value == "") {
value = recordValueOpt(record, secondChoice);
}
return value;
}
static string recordValueAlternative(const rec_record_t record, const char* firstChoice, const char* secondChoice) {
string value = recordValueAlternativeOpt(record, firstChoice, secondChoice);
if (value == "") {
cerr << "RecFileReader: one of both fields " << firstChoice << " or " << secondChoice << " missing at line " << rec_record_location_str(record) << endl;
throw(1);
}
return value;
}
template <class T, typename Func = identity>
static void getVector(const rec_record_t &record, const char* &field,
vector<T> &result, Func &&func = Func()) {
......@@ -50,6 +67,7 @@ static void getVector(const rec_record_t &record, const char* &field,
class recTask {
public:
static const char* recModel;
static const char* recName;
static const char* recFootprint;
static const char* recJobId;
......@@ -66,7 +84,8 @@ public:
static int outputCount;
static void recReaderInit() {
if(recName == NULL) {
if(recModel == NULL) {
recModel = rec_parse_field_name_str(C_TEXT("Model"));
recName = rec_parse_field_name_str(C_TEXT("Name"));
recFootprint = rec_parse_field_name_str(C_TEXT("Footprint"));
recJobId = rec_parse_field_name_str(C_TEXT("JobId"));
......@@ -84,7 +103,7 @@ public:
outputCount = 0;
}
string name;
string model;
string footprint;
string taskType;
string tag;
......@@ -122,13 +141,13 @@ public:
}
recTask(const rec_record_t record, int id) : internalId(id) {
name = recordValueOpt(record, recName);
model = recordValueOpt(record, recModel);
convertedDeps = false;
if(name == "") {
if(model == "") {
isReal = false; outputId = -1; footprint = ""; taskType = "";
} else {
footprint = recordValue(record, recFootprint);
taskType = name + ":" + footprint;
taskType = model + ":" + footprint;
isReal = true;
outputId = outputCount;
++outputCount;
......@@ -194,6 +213,7 @@ public:
}
};
const char* recTask::recModel = NULL;
const char* recTask::recName = NULL;
const char* recTask::recFootprint = NULL;
const char* recTask::recJobId = NULL;
......@@ -215,7 +235,7 @@ void RecFileInstance::readFromFile(const string inputFile, unordered_map<string,
this->inputFile = inputFile;
if(recTask::recName == NULL) recTask::recReaderInit();
if(recTask::recModel == NULL) recTask::recReaderInit();
char* inputFileC = new char[inputFile.length() + 1];
strcpy(inputFileC, inputFile.c_str());
......@@ -511,14 +531,15 @@ RecFileInstance::RecFileInstance(const string inputFile, const string platformFi
rec_mset_iterator_t timingIt = rec_mset_iterator(rec_rset_mset(timingSet));
rec_record_t recTime;
const char* Name = rec_parse_field_name_str("Name");
const char* Model = rec_parse_field_name_str("Model");
const char* Footprint = rec_parse_field_name_str("Footprint");
const char* Mean = rec_parse_field_name_str("Mean");
while(rec_mset_iterator_next(&timingIt, MSET_RECORD, (const void**) &recTime, NULL)) {
string architecture = recordValue(recTime, arch);
string name = recordValue(recTime, Name);
string model = recordValueAlternative(recTime, Model, Name);
string footprint = recordValue(recTime, Footprint);
double mean = stod(recordValue(recTime, Mean));
string type = name + ":" + footprint;
string type = model + ":" + footprint;
int archID;
for(archID = 0; archID < nbWorkerTypes; archID++)
......
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