Commit 3f2ad276 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

added warnings

parent 6593019e
Pipeline #162410 canceled with stages
in 11 minutes and 28 seconds
......@@ -19,7 +19,24 @@ protected:
aggregate(WelfordAggregate(GetParam(), true)) {
}
void TestSVarExample() {
void TestMeanExample1() {
pout << "Before update: " << DOUT(aggregate.mean.Q) << endl;
while (aggregate.ctr.dMcomm != 0) {
aggregate.Update(1.0, 0.0, PPM->Proc(0), 0.0);
}
pout << "After update: " << DOUT(aggregate.mean.Q) << endl;
aggregate.UpdateParallel();
pout << "After p-update: " << DOUT(aggregate.mean.Q) << endl;
double sumGauss = (pow((PPM->Size(0) - 1), 2) + (PPM->Size(0) - 1)) / 2.0;
double referenceMean = sumGauss / PPM->Size(0);
EXPECT_EQ(aggregate.mean.Q, referenceMean);
}
void TestSVarExample1() {
pout << "Before update: " << DOUT(aggregate.sVar.Q) << endl;
pout << "Before update: " << DOUT(aggregate.mean.Q) << endl;
......@@ -50,6 +67,32 @@ protected:
EXPECT_EQ(aggregate.mean.Q, referenceMean);
}
void TestSVarExample2() {
pout << "Before update: " << DOUT(aggregate.sVar.Q) << endl;
pout << "Before update: " << DOUT(aggregate.mean.Q) << endl;
while (aggregate.ctr.dMcomm != 0) {
aggregate.Update(1.0, 0.0, PPM->Proc(0), 0.0);
}
pout << "After update: " << DOUT(aggregate.sVar.Q) << endl;
pout << "After update: " << DOUT(aggregate.mean.Q) << endl;
aggregate.UpdateParallel();
pout << "After p-update: " << DOUT(aggregate.sVar.Q) << endl;
pout << "After p-update: " << DOUT(aggregate.mean.Q) << endl;
double sumGauss = (pow((PPM->Size(0) - 1), 2) + (PPM->Size(0) - 1)) / 2.0;
double referenceMean = sumGauss / PPM->Size(0);
double referenceSVar = 0.0;
for (int i = 0; i < numInitSamples; i++) {
referenceSVar += pow(PPM->Proc(0) - referenceMean, 2);
}
referenceSVar = referenceSVar / (numInitSamples - 1);
EXPECT_EQ(aggregate.sVar.Q, referenceSVar);
EXPECT_EQ(aggregate.mean.Q, referenceMean);
}
int ReferenceIndex(int start, int samples) {
if (samples >= PPM->Size(0))
return start + (aggregate.ctr.dMcomm) * PPM->Proc(0);
......@@ -229,14 +272,7 @@ TEST_P(TestWelfordAggregate, TestSampleCounter) {
}
TEST_P(TestWelfordAggregate, TestMean) {
pout << "Before update: " << aggregate.mean << endl;
while (aggregate.ctr.dMcomm != 0) aggregate.Update(1.0, 0.0, PPM->Proc(0), 0.0);
pout << "After update: " << aggregate.mean << endl;
aggregate.UpdateParallel();
pout << "After parallel update: " << aggregate.mean << endl;
double sumGauss = (pow((PPM->Size(0) - 1), 2) + (PPM->Size(0) - 1)) / 2.0;
double referenceMean = sumGauss / PPM->Size(0);
EXPECT_EQ(aggregate.mean.Q, referenceMean);
TestMeanExample1();
}
TEST_P(TestWelfordAggregate, TestSVar) {
......@@ -244,12 +280,16 @@ TEST_P(TestWelfordAggregate, TestSVar) {
case 4:
switch(PPM->Size(0)) {
case 8:
Warning("No test case for this amount of processes")
break;
case 4:
Warning("No test case for this amount of processes")
break;
case 2:
TestSVarExample();
TestSVarExample1();
break;
case 1:
TestSVarExample();
TestSVarExample1();
break;
default: Warning("No test case for this amount of processes")
}
......@@ -257,11 +297,13 @@ TEST_P(TestWelfordAggregate, TestSVar) {
case 8:
switch(PPM->Size(0)) {
case 8:
Warning("No test case for this amount of processes")
break;
case 4:
TestSVarExample();
TestSVarExample1();
break;
case 2:
TestSVarExample();
TestSVarExample1();
break;
case 1:
default: Warning("No test case for this amount of processes")
......@@ -270,12 +312,14 @@ TEST_P(TestWelfordAggregate, TestSVar) {
case 16:
switch(PPM->Size(0)) {
case 8:
TestSVarExample();
TestSVarExample1();
break;
case 4:
TestSVarExample();
TestSVarExample1();
break;
case 2:
Warning("No test case for this amount of processes")
break;
case 1:
default: Warning("No test case for this amount of processes")
}
......@@ -283,9 +327,17 @@ TEST_P(TestWelfordAggregate, TestSVar) {
case 1000:
switch(PPM->Size(0)) {
case 8:
Warning("No test case for this amount of processes")
break;
case 4:
Warning("No test case for this amount of processes")
break;
case 2:
Warning("No test case for this amount of processes")
break;
case 1:
Warning("No test case for this amount of processes")
break;
default: Warning("No test case for this amount of processes")
}
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment