diff --git a/src/lib/util.hpp b/src/lib/util.hpp index 56a6a2aa9..9d55ac15a 100644 --- a/src/lib/util.hpp +++ b/src/lib/util.hpp @@ -89,6 +89,14 @@ namespace util { , upperBound); } + template + inline bool constexpr + isLimited (NB lowerBound, NUM val, NB upperBound) + { + return lowerBound <= val + and val <= upperBound; + } + /** positive integral number from textual representation * @return always a number, 0 in case of unparseable text, * limited to 0 <= num <= LUMIERA_MAX_ORDINAL_NUMBER */ diff --git a/tests/vault/gear/scheduler-stress-test.cpp b/tests/vault/gear/scheduler-stress-test.cpp index d46eeecf1..40c8841df 100644 --- a/tests/vault/gear/scheduler-stress-test.cpp +++ b/tests/vault/gear/scheduler-stress-test.cpp @@ -189,6 +189,39 @@ SHOW_EXPR(micros); CHECK (schedule[26] == _uTicks(26ms)); CHECK (schedule[27] == _uTicks(27ms)); + double stressFac = 1.0; + testSetup.withAdaptedSchedule (stressFac, concurrency); + schedule = testSetup.getScheduleSeq().effuse(); + CHECK (schedule.size() == testLoad.topLevel() + 2); +SHOW_EXPR(schedule[0]) +SHOW_EXPR(schedule[1]) +SHOW_EXPR(schedule[2]) +SHOW_EXPR(schedule[3]) +SHOW_EXPR(schedule[4]) +SHOW_EXPR(schedule[5]) +SHOW_EXPR(schedule[6]) +SHOW_EXPR(schedule[7]) +SHOW_EXPR(schedule[8]) +SHOW_EXPR(schedule[9]) +SHOW_EXPR(schedule[10]) +SHOW_EXPR(schedule[11]) +SHOW_EXPR(schedule[12]) +SHOW_EXPR(schedule[13]) +SHOW_EXPR(schedule[14]) +SHOW_EXPR(schedule[15]) +SHOW_EXPR(schedule[16]) +SHOW_EXPR(schedule[17]) +SHOW_EXPR(schedule[18]) +SHOW_EXPR(schedule[19]) +SHOW_EXPR(schedule[20]) +SHOW_EXPR(schedule[21]) +SHOW_EXPR(schedule[22]) +SHOW_EXPR(schedule[23]) +SHOW_EXPR(schedule[24]) +SHOW_EXPR(schedule[25]) +SHOW_EXPR(schedule[26]) +SHOW_EXPR(schedule[27]) + micros = testSetup.launch_and_wait(); SHOW_EXPR(micros); } diff --git a/tests/vault/gear/test-chain-load.hpp b/tests/vault/gear/test-chain-load.hpp index bff6abe5f..fce2780d1 100644 --- a/tests/vault/gear/test-chain-load.hpp +++ b/tests/vault/gear/test-chain-load.hpp @@ -131,6 +131,7 @@ namespace test { using util::limited; using util::unConst; using util::toString; + using util::isLimited; using util::showHashLSB; using lib::time::Time; using lib::time::TimeValue; @@ -161,6 +162,7 @@ namespace test { 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 UPFRONT_PLANNING_BOOST = 2; ///< factor to increase the computed pre-roll to ensure up-front planning const size_t GRAPH_BENCHMARK_RUNS = 5; ///< repetition count for reference calculation of a complete node graph 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) @@ -168,6 +170,8 @@ namespace test { const size_t LOAD_DEFAULT_MEM_SIZE = 1000; ///< default allocation base size used if ComputationalLoad.useAllocation const Duration SCHEDULE_LEVEL_STEP{_uTicks(1ms)}; ///< time budget to plan for the calculation of each »time level« of jobs const Duration SCHEDULE_PLAN_STEP{_uTicks(100us)}; ///< time budget to reserve for each node to be planned and scheduled + + inline uint defaultConcurr() { return work::Config::getDefaultComputationCapacity(); } } struct LevelWeight @@ -1697,7 +1701,7 @@ namespace test { { auto finished = attachNewCompletionSignal(); size_t numNodes = chainLoad_.size(); - size_t firstChunkEndNode = calcNextChunkEnd(0)-1; + size_t firstChunkEndNode = calcNextChunkEnd(0); schedule_.allocate (numNodes); compuLoad_->maybeCalibrate(); calcFunctor_.reset (new RandomChainCalcFunctor{chainLoad_.nodes_[0], compuLoad_.get()}); @@ -1743,7 +1747,7 @@ namespace test { fillDefaultSchedule(); return lib::explore(startTimes_) - .transform([&](Time jobTime) -> Time + .transform([&](Time jobTime) -> TimeVar { return jobTime - startTimes_[0]; }); @@ -1790,14 +1794,21 @@ namespace test { } ScheduleCtx&& - withAdaptedSchedule(double stressFac =1.0) + withAdaptedSchedule (double stressFac =1.0, uint concurrency=0) { + if (not concurrency) // use hardware concurrency (#cores) by default + concurrency = defaultConcurr(); + ENSURE (isLimited (1u, concurrency, 3*defaultConcurr())); + withLevelDuration (compuLoad_->timeBase); + fillAdaptedSchedule (stressFac, concurrency); return move(*this); } ScheduleCtx&& withUpfrontPlanning() { + withChunkSize (chainLoad_.size()); + preRoll_ *= UPFRONT_PLANNING_BOOST; return move(*this); } @@ -1941,7 +1952,10 @@ namespace test { size_t numPoints = chainLoad_.topLevel()+2; startTimes_.clear(); startTimes_.reserve (numPoints); - chainLoad_.levelScheduleSequence(concurrency).effuse(); + startTimes_.push_back (Time::ZERO); + chainLoad_.levelScheduleSequence (concurrency) + .transform([&](double scheduleFact){ return (scheduleFact/stressFac) / levelSpeed_;}) + .effuse(startTimes_); } Time diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 50218cbb9..cf392495d 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -107403,7 +107403,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -107650,33 +107650,76 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + - + - - + + - - + + - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ und withAdaptedSchedule muß man explizit aufrufen (wegen Stress-Faktor) +

+ + +
+ +
+
+
@@ -107695,8 +107738,17 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + + + + + + + + + +