Scheduler-test: investigate volatile in computation-load

The `volatile` was used asymmetrically and there was concern that
this usage makes the `ComutationalLoad` dependent on concurrency.
However, an impact could not be confirmed empirically.

Moreover, to simplify this kind of tests, make the `schedDepends`
directly configurable in the Stress-Test-Rig.
This commit is contained in:
Fischlurch 2024-01-07 23:37:54 +01:00
parent f37b67f9bb
commit 0065dabed1
4 changed files with 75 additions and 32 deletions

View file

@ -296,6 +296,7 @@ SHOW_EXPR(micros);
{
usec LOAD_BASE = 500us;
uint CONCURRENCY = 4;
bool SCHED_DEPENDS = true;
bool showRuns = true;
auto testLoad() { return TestChainLoad<>{64}.configureShape_chain_loadBursts(); }
@ -306,7 +307,7 @@ SHOW_EXPR(micros);
SHOW_EXPR(stress)
SHOW_EXPR(delta)
SHOW_EXPR(time)
CHECK (delta > 4.0);
CHECK (delta > 2.0);
CHECK (0.55 > stress and stress > 0.4);
}

View file

@ -159,7 +159,9 @@ namespace test {
void
configureTest (TestSetup& testSetup, double stressFac)
{
testSetup.withLoadTimeBase (CONF::LOAD_BASE)
testSetup.withLoadTimeBase(CONF::LOAD_BASE)
.withBaseExpense (CONF::BASE_EXPENSE)
.withSchedDepends(CONF::SCHED_DEPENDS)
.withAdaptedSchedule(stressFac, CONF::CONCURRENCY);
}
@ -328,6 +330,8 @@ namespace test {
using usec = std::chrono::microseconds;
usec LOAD_BASE = 500us;
usec BASE_EXPENSE = 0us;
bool SCHED_DEPENDS = false;
uint CONCURRENCY = work::Config::getDefaultComputationCapacity();
double EPSILON = 0.01; ///< error bound to abort binary search
double UPPER_STRESS = 0.6; ///< starting point for the upper limit, likely to fail

View file

@ -193,8 +193,8 @@ namespace test {
const Duration SCHEDULE_LEVEL_STEP{_uTicks(1ms)}; ///< time budget to plan for the calculation of each »time level« of jobs
const Duration SCHEDULE_NODE_STEP{Duration::NIL}; ///< additional time step to include in the plan for each job (node).
const Duration SCHEDULE_PLAN_STEP{_uTicks(100us)}; ///< time budget to reserve for each node to be planned and scheduled
const bool SCHEDULE_DEPENDENCY = false; ///< explicitly schedule a dependent job (or rely on NOTIFY)
const bool SCHEDULE_NOTIFY = true; ///< explicitly set notify dispatch time to the dependencie's start time.
const bool SCHED_DEPENDS = false; ///< explicitly schedule a dependent job (or rely on NOTIFY)
const bool SCHED_NOTIFY = true; ///< explicitly set notify dispatch time to the dependency's start time.
inline uint
defaultConcurr()
@ -1358,7 +1358,7 @@ namespace test {
{
auto round = roundsNeeded (scaleStep);
Sink sink;
size_t scree{0x55DEAD55};
size_t scree{sink};
for ( ; 0 < round; --round)
boost::hash_combine (scree,scree);
sink = scree;
@ -1369,12 +1369,14 @@ namespace test {
causeMemProcessLoad (uint scaleStep)
{
auto [siz,round] = allocNeeded (scaleStep);
lib::UninitialisedDynBlock<Sink> memBlock{siz};
++*memBlock.front();
lib::UninitialisedDynBlock<size_t> memBlock{siz};
Sink sink;
*memBlock.front() = sink+1;
for ( ; 0 < round; --round)
for (size_t i=0; i<memBlock.size()-1; ++i)
memBlock[i+1] += memBlock[i];
++*memBlock.back();
sink = *memBlock.back();
sink++;
}
double
@ -1671,8 +1673,8 @@ namespace test {
FrameRate levelSpeed_{1, SCHEDULE_LEVEL_STEP};
FrameRate planSpeed_{1, SCHEDULE_PLAN_STEP};
TimeVar nodeExpense_{SCHEDULE_NODE_STEP};
double schedNotify_{SCHEDULE_NOTIFY? 1.0:0.0};
bool schedDepends_{SCHEDULE_DEPENDENCY};
double schedNotify_{SCHED_NOTIFY? 1.0:0.0};
bool schedDepends_{SCHED_DEPENDS};
uint blockLoadFactor_{2};
size_t chunkSize_{DEFAULT_CHUNKSIZE};
TimeVar startTime_{Time::ANYTIME};
@ -1850,14 +1852,14 @@ namespace test {
}
ScheduleCtx&&
withScheduleDependency (bool explicitly)
withSchedDepends (bool explicitly)
{
schedDepends_ = explicitly;
return move(*this);
}
ScheduleCtx&&
withScheduleNotify (double degree)
withSchedNotify (double degree)
{
schedNotify_ = degree;
return move(*this);

View file

@ -107996,16 +107996,13 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<node CREATED="1704508460471" ID="ID_1158750541" MODIFIED="1704508465339" TEXT="das ist wirklich verbl&#xfc;ffend"/>
<node CREATED="1704508466387" ID="ID_1330141096" MODIFIED="1704508564637" TEXT="liegt wohl an der fokussierten Kapazit&#xe4;tssteuerung">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<p>
anders kann ich mir das nicht erkl&#228;ren, denn es ist ja nun immer nur eine kleine Zahl an Eintr&#228;gen in der Queue, d.h. es besteht durchaus die Gefahr, da&#223; sich Worker schlafen legen, weil die Queue scheinbar leer ist. Tats&#228;chlich passiert das aber nur in den Abschnitten mit geringer Parallelit&#228;t (ja der Doppel-Strang wird nun nur von einem Worker bearbeitet)
</p>
</body>
</html>
</richcontent>
</html></richcontent>
</node>
</node>
</node>
@ -108026,16 +108023,13 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<icon BUILTIN="flag-yellow"/>
<node CREATED="1704506817515" ID="ID_170171194" MODIFIED="1704506848881" TEXT="geht das sinnvollerweise?">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<p>
mu&#223; dann die Info &#252;ber zwei Ebenen durchreichen...?
</p>
</body>
</html>
</richcontent>
</html></richcontent>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1704497136967" ID="ID_273051296" MODIFIED="1704497151404" TEXT="Zeitlimit im NOTIFY auf korrekte Handhabung pr&#xfc;fen">
@ -110653,22 +110647,17 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
</node>
<node CREATED="1704503038702" ID="ID_1005585769" MODIFIED="1704503122646">
<richcontent TYPE="NODE"><html>
<head>
</head>
<head/>
<body>
<p>
die typische Test-Load ~ 500&#181;s braucht im Scheduler-Kontext oft doppelt so lange als kalibriert
</p>
</body>
</html>
</richcontent>
</html></richcontent>
<icon BUILTIN="messagebox_warning"/>
<node CREATED="1704508579832" ID="ID_940093755" MODIFIED="1704508637214">
<richcontent TYPE="NODE"><html>
<head>
</head>
<head/>
<body>
<p>
nachdem ich aber nur noch per NOTIFY triggere,
@ -110680,11 +110669,58 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
Nur an einer Stelle mit vielen aktiven Workern, treten mal wieder 2ms auf
</p>
</body>
</html>
</richcontent>
</html></richcontent>
<icon BUILTIN="messagebox_warning"/>
<node CREATED="1704677773725" HGAP="37" ID="ID_1327394317" MODIFIED="1704677791533" TEXT="die stress-test-Messung scheint dem aber zu widersprechen" VSHIFT="29"/>
<node CREATED="1704677792419" ID="ID_1310162809" MODIFIED="1704677884361" TEXT="in beiden F&#xe4;llen bekommen wir &lt;0.5, aber ohne schedule-depends sogar ehr weniger">
<richcontent TYPE="NOTE"><html>
<head/>
<body>
<p>
0.42 statt 0.56
</p>
</body>
</html></richcontent>
<arrowlink COLOR="#a65a70" DESTINATION="ID_276645813" ENDARROW="Default" ENDINCLINATION="27;-139;" ID="Arrow_ID_316226697" STARTARROW="None" STARTINCLINATION="-474;15;"/>
</node>
</node>
<node CREATED="1704675385917" ID="ID_1698920120" MODIFIED="1704675407523" TEXT="stellt sich die Frage: warum spricht die Test-Load so stark auf concurrency an?"/>
<node COLOR="#5b280f" CREATED="1704675447594" ID="ID_1820148966" MODIFIED="1704678619828" TEXT="Verdacht: sie arbeiten auf volatile data...">
<icon BUILTIN="idea"/>
<icon BUILTIN="button_cancel"/>
<node CREATED="1704675485440" ID="ID_1790139504" MODIFIED="1704675510440" TEXT="eigentlich w&#xfc;rde ein einziger volatile als &#xbb;Sink&#xab; am Ende gen&#xfc;gen"/>
<node CREATED="1704675515508" ID="ID_366712394" MODIFIED="1704675555243" TEXT="da wir aber auf Volatiles arbeiten, k&#xf6;nnte das zu geh&#xe4;uften Cache-flushes f&#xfc;hren"/>
<node CREATED="1704675929596" ID="ID_140425262" MODIFIED="1704675935783" TEXT="Untersuchung...">
<node CREATED="1704675936723" ID="ID_1880610455" MODIFIED="1704675940590" TEXT="Zustand vorher">
<node CREATED="1704677929504" ID="ID_1565180226" MODIFIED="1704677937299" TEXT="kalibriert auf 100&#xb5;s: cpu=41.5947 mem=55.316"/>
<node CREATED="1704677938619" ID="ID_601391343" MODIFIED="1704677951777" TEXT="kalibriert auf 1ms: cpu=42.3137 mem=60.5797"/>
</node>
<node CREATED="1704675941122" ID="ID_161446280" MODIFIED="1704675954731" TEXT="Volatiles aus der Berechnung selber entfernen"/>
<node CREATED="1704675955736" ID="ID_416913619" MODIFIED="1704675958336" TEXT="Zustand nachher">
<node CREATED="1704678313156" ID="ID_1131252174" MODIFIED="1704678325038" TEXT="Kein Einflu&#xdf; auf die Kalbrierung feststellbar"/>
<node CREATED="1704678604021" ID="ID_1814241983" MODIFIED="1704678617576" TEXT="kein Einflu&#xdf; auf das Verhalten im Stre&#xdf;-Test feststellbar"/>
</node>
</node>
<node CREATED="1704678622568" ID="ID_1060142265" MODIFIED="1704678646340" TEXT="These widerlegt">
<icon BUILTIN="button_cancel"/>
</node>
</node>
</node>
<node CREATED="1704677622809" ID="ID_276645813" MODIFIED="1704680965552">
<richcontent TYPE="NODE"><html>
<head/>
<body>
<p>
<i>ohne </i>schedule-dependency ist die Performance aber<i>&#160;minimal schlechter</i>
</p>
</body>
</html></richcontent>
<linktarget COLOR="#a65a70" DESTINATION="ID_276645813" ENDARROW="Default" ENDINCLINATION="27;-139;" ID="Arrow_ID_316226697" SOURCE="ID_1310162809" STARTARROW="None" STARTINCLINATION="-474;15;"/>
<icon BUILTIN="messagebox_warning"/>
<node CREATED="1704677674802" ID="ID_1422232610" MODIFIED="1704677710441" TEXT="obwohl man dann in Einzelbeobachtung einen glatteren Ablauf mit weniger Contention sieht"/>
<node CREATED="1704677712357" ID="ID_730665682" MODIFIED="1704677732239" TEXT="und wir die h&#xe4;lfte der gescheduleten Jobs einsparen"/>
<node CREATED="1704677733514" ID="ID_568047047" MODIFIED="1704677752491" TEXT="k&#xf6;nnte vielleicht daran liegen, da&#xdf; wir dadurch auch Kapazit&#xe4;t in den Schlaf schicken"/>
</node>
</node>
</node>
</node>