summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2024-02-12 13:09:10 -0500
committerDouglas Rumbaugh <dbr4@psu.edu>2024-02-12 13:09:53 -0500
commite4644fec1acc429a540f358b4e7e15af75aa71a9 (patch)
tree53385c5cc5213acb296394fc5dee76551e3c8376
parent6d7067b4cef51e92d8cb54bb502d6133269728a9 (diff)
downloaddynamic-extension-e4644fec1acc429a540f358b4e7e15af75aa71a9.tar.gz
ExtensionStructure: first basic test of lookahead task stealing
-rw-r--r--include/framework/structure/ExtensionStructure.h11
-rw-r--r--include/util/types.h4
2 files changed, 14 insertions, 1 deletions
diff --git a/include/framework/structure/ExtensionStructure.h b/include/framework/structure/ExtensionStructure.h
index 0e2118e..dbfb543 100644
--- a/include/framework/structure/ExtensionStructure.h
+++ b/include/framework/structure/ExtensionStructure.h
@@ -275,7 +275,7 @@ public:
*
*/
ReconstructionVector get_reconstruction_tasks(size_t buffer_reccnt,
- state_vector scratch_state={}) {
+ state_vector scratch_state={}) {
/*
* If no scratch state vector is provided, use a copy of the
* current one. The only time an empty vector could be used as
@@ -304,6 +304,14 @@ public:
*/
if (i == 0) {
reconstructions = local_recon;
+ /*
+ * Quick sanity test of idea: if the next reconstruction
+ * would be larger than this one, steal the largest
+ * task from it and run it now instead.
+ */
+ } else if (local_recon.get_total_reccnt() > reconstructions.get_total_reccnt()) {
+ auto t = local_recon.remove_reconstruction(0);
+ reconstructions.add_reconstruction(t);
}
}
@@ -312,6 +320,7 @@ public:
if (L == LayoutPolicy::TEIRING || scratch_state[0].shardcnt == 0) {
scratch_state[0].shardcnt += 1;
}
+
}
return std::move(reconstructions);
diff --git a/include/util/types.h b/include/util/types.h
index e22fd18..bac0246 100644
--- a/include/util/types.h
+++ b/include/util/types.h
@@ -95,6 +95,10 @@ public:
total_reccnt += reccnt;
}
+ void add_reconstruction(ReconstructionTask task) {
+ m_tasks.push_back(task);
+ }
+
ReconstructionTask remove_reconstruction(size_t idx) {
assert(idx < m_tasks.size());
auto task = m_tasks[idx];