Commit 1bf09bee authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

Read bandwidth and latency information from the platform file

  (requires recent StarPU to get them from platform_recdump)
parent 3056ba53
......@@ -94,17 +94,45 @@ to make them depend on any real task that this virtual task depends on.
### The platform file
To avoid specifying `EstimatedTime` for all tasks, it is possible to specify the platform file separately. In StarPU,
this file is provided by the `starpu_perfmodel_recdump` utility in the `tools/` directory. This file contains two parts:
first the number of resources of each type, then the timings of each type of task.
The first part starts with ```%rec: worker_count``` on a separate line (this is a special feature of the recfile format to separate a file
into different databases). It then contains one record per resource type, with two fields:
To avoid specifying `EstimatedTime` for all tasks, it is possible to
specify the platform file separately. In StarPU, this file is provided
by the `starpu_perfmodel_recdump` utility in the `tools/`
directory. This file contains four parts: the number of resources of
each type, the assignment of resources to memory nodes, the
communication performance between memory nodes, and the timings of
each type of task.
The first part starts with ```%rec: worker_count``` on a separate line
(this is a special feature of the recfile format to separate a file
into different databases). It then contains one record per resource
type, with two fields:
+ `Architecture` provides an identifier for this resource type
+ `NbWorkers` should contain an integer specifying the number of resources of this type
The second part starts with ```%rec: timing``` on a separate line, and contains one record for each task type/resource type combination.
The second part starts with ```%rec: memory_workers``` on a separate
line, and contains one record for each task memory node. Records
contain the following fields:
+ `MemoryNode` indicates the index of the memory node.
+ `Name` represents its name.
+ `Size` indicates the memory size in bytes, -1 for an unbounded memory.
+ `Workers` contain the list of workers that belong to that memory node.
The third part starts with `%rec: memory_performance` on a separate
line, and contains one record for each pair of different memory
nodes. Records contain the following fields:
+ `MemoryNodeSrc` and `MemoryNodeDst` indicate the source and
destination node respectively.
+ `Bandwidth` and `Latency` indicate the bandwidth and latency, in
units compatible with the duration of tasks in the `timing` section,
and with the size of handles in the `tasks.rec` file. In StarPU,
this is respectively microseconds and bytes, so the latency is given
in microseconds and the bandwidth in bytes per microseconds.
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.
......
......@@ -38,7 +38,6 @@ static const int opt_no_dependencies = 11;
static const int opt_no_header = 12;
static const int opt_rev_dep = 13;
static const int opt_best = 14;
static const int opt_bw = 15;
static const int opt_thread = 16;
static const int opt_tags = 17;
static const int opt_submit = 18;
......@@ -63,7 +62,6 @@ static struct option long_options[] = {
{"help", no_argument, 0, 'h'},
{"default", optional_argument, 0, 'd'},
{"best", optional_argument, 0, opt_best},
{"bw", required_argument, 0, opt_bw},
{"threads", optional_argument, 0, opt_thread},
{"use-tags", no_argument, 0, opt_tags},
{"submit-order", no_argument, 0, opt_submit},
......@@ -89,7 +87,6 @@ ProgramOptions::ProgramOptions() {
appendTags = false;
outputTypeInExport = false;
workerOrderInExport = false;
platform_bw = 1;
}
void ProgramOptions::parse(int argc, char** argv) {
......@@ -175,9 +172,6 @@ void ProgramOptions::parse(int argc, char** argv) {
if(optarg)
outputBestFile = s_optarg;
break ;
case opt_bw:
platform_bw = atof(optarg);
break;
case opt_thread:
if(optarg)
nbThreads = stoi(s_optarg);
......
......@@ -533,12 +533,6 @@ often:
the ordering of tasks on workers in addition to the allocation to workers. This is
not compatible with `--export-type`.
* `--bw <BW>`
Specify the bandwidth used for communications. Unit is not
specified, since it depends on the unit used to specify data sizes
(in the `Sizes` fields of the tasks) and on the unit used to specify
task execution times. Default value is 1.
* `-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
......
......@@ -5,7 +5,7 @@
using namespace std;
CommSequence::CommSequence(Instance &ins): bandwidth(ins.bandwidth), nbWT(ins.totalWorkers),
CommSequence::CommSequence(Instance &ins): ins(&ins), nbWT(ins.totalWorkers),
outgoing(nbWT), incoming(nbWT) {
}
......@@ -32,6 +32,6 @@ double CommSequence::newTransfer(double now, int source, int dest, int size, dou
vector<AvailSequence*> seqs;
seqs.push_back(&outgoing[source]);
seqs.push_back(&incoming[dest]);
double len = size / bandwidth;
double len = ins->memoryNodeLat[source][dest] + size / ins->memoryNodeBW[source][dest];
return (reserveALAP(seqs, now, len, goal));
}
......@@ -479,6 +479,30 @@ RecFileInstance::RecFileInstance(const string inputFile, const string platformFi
}
memoryNodeBW.resize(nbMemoryNodes);
memoryNodeLat.resize(nbMemoryNodes);
for(int i = 0; i < nbMemoryNodes; ++i) {
memoryNodeLat[i].resize(nbMemoryNodes, 0);
memoryNodeBW[i].resize(nbMemoryNodes, 1);
}
rec_rset_t memoryPerfSet = rec_db_get_rset_by_type(platform, "memory_performance");
if(memoryPerfSet) {
rec_mset_iterator_t memPerfIt = rec_mset_iterator(rec_rset_mset(memoryPerfSet));
rec_record_t recMemPerf;
const char* MemoryNodeSrc = rec_parse_field_name_str("MemoryNodeSrc");
const char* MemoryNodeDst = rec_parse_field_name_str("MemoryNodeDst");
const char* Bandwidth = rec_parse_field_name_str("Bandwidth");
const char* Latency = rec_parse_field_name_str("Latency");
while(rec_mset_iterator_next(&memPerfIt, MSET_RECORD, (const void**) &recMemPerf, NULL)) {
double bw = stod(recordValue(recMemPerf, Bandwidth));
double lat = stod(recordValue(recMemPerf, Latency));
int src = stoi(recordValue(recMemPerf, MemoryNodeSrc));
int dst = stoi(recordValue(recMemPerf, MemoryNodeDst));
memoryNodeBW[src][dst] = bw;
memoryNodeLat[src][dst] = lat;
}
}
rec_rset_t timingSet = rec_db_get_rset_by_type(platform, "timing");
if(!timingSet) {
cerr << "RecFileInstance: no 'timing' record set\n"<< endl;
......
......@@ -61,6 +61,13 @@ Instance::Instance(const string input_file, int convertIndices) {
execTimes.resize(nbWorkerTypes);
nbMemoryNodes = nbWorkerTypes;
memoryNodeBW.resize(nbMemoryNodes);
memoryNodeLat.resize(nbMemoryNodes);
for(int i = 0; i < nbMemoryNodes; ++i) {
memoryNodeLat[i].resize(nbMemoryNodes, 0);
memoryNodeBW[i].resize(nbMemoryNodes, 1);
}
for(i = 0; i < nbWorkerTypes; i++) {
readArray(input, execTimes[i]);
for(auto &t: execTimes[i])
......
......@@ -11,7 +11,7 @@
class CommSequence {
protected:
double bandwidth;
Instance* ins;
int nbWT;
// This handles contention.
......
......@@ -40,7 +40,6 @@ class ProgramOptions {
bool noHeader = false;
bool optRevDep = false;
bool outputBest;
double platform_bw = 1;
std::string outputBestFile;
int nbThreads;
bool appendTags;
......
......@@ -69,8 +69,9 @@ public:
int nbMemoryNodes = -1;
// This vector works like workerIDs: length is nbWorkerTypes, memoryNodes[t] specifies
// the memory nodes of all workers of type t
double bandwidth;
std::vector<std::vector<double>> memoryNodeBW;
std::vector<std::vector<double>> memoryNodeLat;
std::string inputFile;
std::string platformFile;
......
......@@ -262,8 +262,6 @@ int main(int argc, char** argv) {
else
instance = new Instance(input_file, progOpt.convertIndices);
instance->bandwidth = progOpt.platform_bw;
if(progOpt.noDependencies)
instance->removeDependencies();
if(progOpt.optRevDep)
......
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