From df4ee5e9c136249edceea791a537f3ad60f16457 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 10 Dec 2023 22:09:46 +0100 Subject: [PATCH] Scheduler-test: implement pure computation load MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ..initial gauging is a tricky subject, since existing computer's performance spans a wide scale Allowing - pre calibration -98% .. +190% - single run ±20% - benchmark ±5% --- src/lib/test/microbenchmark.hpp | 4 +- tests/vault/gear/test-chain-load-test.cpp | 12 ++-- tests/vault/gear/test-chain-load.hpp | 87 ++++++++++++++++++++--- wiki/thinkPad.ichthyo.mm | 60 +++++++++++++++- 4 files changed, 142 insertions(+), 21 deletions(-) diff --git a/src/lib/test/microbenchmark.hpp b/src/lib/test/microbenchmark.hpp index 3c4a54510..9bcc7d1c3 100644 --- a/src/lib/test/microbenchmark.hpp +++ b/src/lib/test/microbenchmark.hpp @@ -126,10 +126,10 @@ namespace test{ inline auto microBenchmark (FUN const& testSubject, const size_t repeatCnt = DEFAULT_RUNS) { - size_t checksum{0}; + volatile size_t checksum{0}; auto invokeTestLoop = [&]{ checksum = benchmarkLoop (testSubject, repeatCnt); }; double micros = benchmarkTime (invokeTestLoop, repeatCnt); - return std::make_tuple (micros, checksum); + return std::make_pair (micros, checksum); } diff --git a/tests/vault/gear/test-chain-load-test.cpp b/tests/vault/gear/test-chain-load-test.cpp index 3e3a74c51..a54fc5835 100644 --- a/tests/vault/gear/test-chain-load-test.cpp +++ b/tests/vault/gear/test-chain-load-test.cpp @@ -875,18 +875,20 @@ SHOW_EXPR(testLoad.getHash()) double micros = cpuLoad.invoke(); SHOW_EXPR(micros) - CHECK (micros <= 5000); - CHECK (micros > 20); + CHECK (micros < 2000); + CHECK (micros > 2); - ComputationalLoad::calibrate(); + cpuLoad.calibrate(); micros = cpuLoad.invoke(); SHOW_EXPR(micros) - CHECK (micros < 111); - CHECK (micros > 90); + CHECK (micros < 123); + CHECK (micros > 80); micros = cpuLoad.benchmark(); SHOW_EXPR(micros) + CHECK (micros < 105); + CHECK (micros > 95); } diff --git a/tests/vault/gear/test-chain-load.hpp b/tests/vault/gear/test-chain-load.hpp index 80216ec37..ae7675b15 100644 --- a/tests/vault/gear/test-chain-load.hpp +++ b/tests/vault/gear/test-chain-load.hpp @@ -149,14 +149,17 @@ namespace test { namespace err = lumiera::error; namespace dot = lib::dot_gen; - namespace { // Default definitions for topology generation - const size_t DEFAULT_FAN = 16; - const size_t DEFAULT_SIZ = 256; + namespace { // Default definitions for structured load testing - const auto SAFETY_TIMEOUT = 5s; - const auto STANDARD_DEADLINE = 10ms; - const size_t DEFAULT_CHUNKSIZE = 64; - const microseconds PLANNING_TIME_PER_NODE = 80us; + const size_t DEFAULT_FAN = 16; ///< default maximum connectivity per Node + const size_t DEFAULT_SIZ = 256; ///< default node count for the complete load graph + + const auto SAFETY_TIMEOUT = 5s; ///< maximum time limit for test run, abort if exceeded + const auto STANDARD_DEADLINE = 10ms; ///< deadline to use for each individual computation job + const size_t DEFAULT_CHUNKSIZE = 64; ///< number of computation jobs to prepare in each planning round + const size_t LOAD_BENCHMARK_RUNS = 500; ///< repetition count for calibration benchmark for ComputationalLoad + const double LOAD_SPEED_BASELINE = 100; ///< initial assumption for calculation speed (without calibration) + const microseconds PLANNING_TIME_PER_NODE = 80us; ///< time budget to reserve for each node to be planned and scheduled } struct Statistic; @@ -1076,25 +1079,87 @@ namespace test { */ class ComputationalLoad { + lib::UninitialisedDynBlock memBlock_{}; + + static double& + computationSpeed() ///< in iterations/µs + { + static double speed{LOAD_SPEED_BASELINE}; + return speed; + } + public: microseconds timeBase = 100us; + bool useAllocation = false; double invoke (uint scaleStep =1) { - UNIMPLEMENTED ("impose the CPU load"); + return benchmarkTime ([this,scaleStep]{ causeComputationLoad(scaleStep); }); } double benchmark (uint scaleStep =1) { - UNIMPLEMENTED ("determine current actual load through a microbenchmark"); + return microBenchmark ([&]{ invoke(scaleStep);} + ,LOAD_BENCHMARK_RUNS) + .first; + } + + void + calibrate() + { +cout<<">CAL: speed="<

- + + + + + + + + + + + + + + + + + + + + + + + +

+ also: beides +

+ + +
+ +
+
@@ -99576,9 +99607,32 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + + + + + + + +

+ schwierig... +

+

+ Einerseits möchte ich schon eine gewisse Genauigkeit sicherstellen, andererseits soll der Test natürlich keine Probleme machen. Grade bei den initialen Werten kann man GEWALTIG danebenliegen. Da muß ich also zumindest schon mal eine plausible Basis-Geschwindigkeit hartcodieren, und zwar in Tendenz schnellere Rechner. Und ich kann wohl kaum was anderes als -90% und +1000% annehmen. Dagegen für die anderen Grenzen muß man sehen.... +

+

+ +

+

+ Stelle schon mal fest: der Einzel-Lauf streut ganz deutlich. Und Cache-Effekte könnten auch noch ein gewisses Problem darstellen (wenngleich auch der vorangegangene Test grundsätzlich den Code schon vorgewärmt  hat. Also setze mal  ±20% für den Einzeltest an, aber nur ±5% für den Benchmark +

+ + +
+ +