From fcfdf97853f997ee649a44737a75644d41b645da Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 9 Dec 2023 03:13:48 +0100 Subject: [PATCH] Chain-Load: prepare infrastructure for computational load Within Chain-Load, the infrastructure to add this crucial feature is minimal: each node gets a `weight` parameter, which is assigned using another RandomDraw-Rule (by default `weight==0`). The actual computation load will be developed as a separate component and tied in from the node calculation job functor. --- tests/vault/gear/test-chain-load-test.cpp | 22 +++- tests/vault/gear/test-chain-load.hpp | 32 +++++- wiki/thinkPad.ichthyo.mm | 123 ++++++++++++++++++++-- 3 files changed, 166 insertions(+), 11 deletions(-) diff --git a/tests/vault/gear/test-chain-load-test.cpp b/tests/vault/gear/test-chain-load-test.cpp index 2f1b9374f..41a75bbbc 100644 --- a/tests/vault/gear/test-chain-load-test.cpp +++ b/tests/vault/gear/test-chain-load-test.cpp @@ -84,6 +84,7 @@ namespace test { showcase_SeedChains(); showcase_PruneChains(); showcase_StablePattern(); + verify_computation_load(); verify_reseed_recalculate(); verify_scheduling_setup(); } @@ -129,7 +130,7 @@ SHOW_EXPR(testLoad.getHash()) Node n0; // Default-created empty Node CHECK (n0.hash == 0); CHECK (n0.level == 0); - CHECK (n0.repeat == 0); + CHECK (n0.weight == 0); CHECK (n0.pred.size() == 0 ); CHECK (n0.succ.size() == 0 ); CHECK (n0.pred == Node::Tab{0}); @@ -860,6 +861,20 @@ SHOW_EXPR(testLoad.getHash()) + + + + /** @test WIP verify calibration of a configurable computational load. + * @todo WIP 12/23 🔁 define ⟶ 🔁 implement + */ + void + verify_computation_load() + { + ComputationalLoad cpuLoad; + } + + + /** @test set and propagate seed values and recalculate all node hashes. * @remark This test uses parameter rules with some expansion and a * pruning rule with 60% probability. This setup is known to @@ -878,6 +893,7 @@ SHOW_EXPR(testLoad.getHash()) ChainLoad16 graph{32}; graph.expansionRule(graph.rule().probability(0.8).maxVal(1)) .pruningRule(graph.rule().probability(0.6)) + .weightRule((graph.rule().probability(0.5))) .buildToplolgy(); CHECK (8 == graph.allNodes().filter(isStartNode).count()); @@ -907,12 +923,16 @@ SHOW_EXPR(testLoad.getHash()) auto& [a,b,c,d] = *group; CHECK (isStart(a)); CHECK (isInner(b)); + CHECK (not a->weight); + CHECK (not b->weight); if (b->succ.size() == 2) { CHECK (isExit(c)); CHECK (isExit(d)); CHECK (c->hash == 0xAEDC04CFA2E5B999); CHECK (d->hash == 0xAEDC04CFA2E5B999); + CHECK (c->weight == 4); + CHECK (d->weight == 4); } else { // the last chunk is wired differently diff --git a/tests/vault/gear/test-chain-load.hpp b/tests/vault/gear/test-chain-load.hpp index f34a9ba3a..7ab93d90f 100644 --- a/tests/vault/gear/test-chain-load.hpp +++ b/tests/vault/gear/test-chain-load.hpp @@ -213,7 +213,7 @@ namespace test { }; size_t hash; - size_t level{0}, repeat{0}; + size_t level{0}, weight{0}; Tab pred{0}, succ{0}; Node(size_t seed =0) @@ -224,7 +224,7 @@ namespace test { clear() { hash = 0; - level = repeat = 0; + level = weight = 0; pred.clear(); succ.clear(); } @@ -296,6 +296,7 @@ namespace test { Rule expansionRule_{}; Rule reductionRule_{}; Rule pruningRule_ {}; + Rule weightRule_ {}; Node* frontNode() { return &nodes_[0]; } Node* afterNode() { return &nodes_[numNodes_]; } @@ -387,6 +388,13 @@ namespace test { return move(*this); } + TestChainLoad&& + weightRule (Rule r) + { + weightRule_ = move(r); + return move(*this); + } + /** Abbreviation for starting rules */ static Rule rule() { return Rule(); } @@ -466,6 +474,7 @@ namespace test { Transiently originalReductionRule{reductionRule_}; Transiently originalseedingRule {seedingRule_}; Transiently originalPruningRule {pruningRule_}; + Transiently originalWeightRule {weightRule_}; // prepare building blocks for the topology generation... auto moreNext = [&]{ return next->size() < maxFan; }; @@ -495,6 +504,7 @@ namespace test { for (Node* o : *curr) { // follow-up on all Nodes in current level... o->calculate(); + o->weight = apply (weightRule_,o); if (apply (pruningRule_,o)) continue; // discontinue size_t toSeed = apply (seedingRule_, o); @@ -613,7 +623,9 @@ namespace test { for (Node& n : allNodes()) { size_t i = nodeID(n); - nodes += node(i).label(toString(i)+": "+showHashLSB(n.hash)) + string tag{toString(i)+": "+showHashLSB(n.hash)}; + if (n.weight) tag +="."+toString(n.weight); + nodes += node(i).label(tag) .style(i==0 ? BOTTOM :isnil(n.pred)? SEED :isnil(n.succ)? TOP @@ -1054,6 +1066,20 @@ namespace test { + /* ========= Configurable Computational Load ========= */ + + /** + * A calibratable CPU load to be invoked from a node job functor. + */ + class ComputationalLoad + { + public: + }; + + + + + /* ========= Render Job generation and Scheduling ========= */ /** diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 9391b7b81..016bbc128 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -96754,6 +96754,16 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + @@ -96773,6 +96783,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + @@ -99417,8 +99431,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -99433,15 +99447,18 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - + + + + + + @@ -99455,10 +99472,102 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + + + + + + + +

+ ....wir müssen hier niemandem etwas beweisen, über die Grenzen des Unit-Testing hinausgehend: +

+
    +
  • + der Node-Hash beweist, daß die Berechnung einer Node stattgefunden hat und die richtigen Ergebnisse der Vorläufer aufgegriffen hat +
  • +
  • + ansonsten können wir annehmen, daß eine aufgerufene Funktion auch tatsächlich läuft +
  • +
  • + und daß eine Exception aus dem Job heraus einen Worker herunterfährt und eine Scheduler-Emergency auslöst +
  • +
+ +
+
+ + + + +
    +
  • + da die Topologie vom Hash abhängen soll, bekommen wir es hier mit Eierlegenden und Hennen zu tun... +
  • +
  • + außerdem würde dadurch bereits auch die Topologie-Konstruktion aufwendig +
  • +
  • + und jede Änderung der Gewichte würde die Topologie komplett ändern +
  • +
+

+ ▶ das zuletzt genannte Argument hat den Ausschlag gegeben, auf Proof-of-Work zu verzichten, denn es ist ausgesprochen mühsam, eine bestimmte gewünschte Topologie zu „finden“ — jedwede Änderung wirkt chaotisch (genauso wie bereits die geringste Seed-Änderung eine komplett andere Form zufolge hat) +

+ +
+ + +
+
+ + + + + + +

+ wird dann von dem RandomChainCalcFunctor eingebunden — und nicht von der Node; es wird damit strikt ein Detail des tatsächlichen Scheduler-Laufs +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +