Skip to content

Commit

Permalink
Corrected test-benchmark code to run GPU check twice
Browse files Browse the repository at this point in the history
  • Loading branch information
buddhi1980 committed Apr 3, 2023
1 parent 50ace10 commit 83b7a76
Showing 1 changed file with 40 additions and 14 deletions.
54 changes: 40 additions & 14 deletions mandelbulber2/src/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ void Test::renderExamplesWrapper() const
{
if (IsBenchmarking())
{
QBENCHMARK_ONCE { renderExamples(); }
QBENCHMARK_ONCE
{
renderExamples();
}
}
else
{
Expand Down Expand Up @@ -163,7 +166,7 @@ void Test::renderExamples() const
#ifdef USE_OPENCL
if (gPar->Get<bool>("opencl_enabled"))
{
loopRepeats = 2;
loopRepeats = 3;
}
#endif

Expand All @@ -177,23 +180,34 @@ void Test::renderExamples() const

switch (repeat)
{
case 0: // CPU mode
{
#ifdef USE_OPENCL
testPar->Set("opencl_mode", 0);
#endif
cpuGpuString = "CPU";
case 0: // GPU mode
{
testPar->Set("opencl_mode", 3);
cpuGpuString = "GPU1";
break;
}
case 1: // GPU mode
{
#ifdef USE_OPENCL
testPar->Set("opencl_mode", 3);
#endif
cpuGpuString = "GPU";
cpuGpuString = "GPU2";
break;
}
case 2: // CPU mode
{
testPar->Set("opencl_mode", 0);
cpuGpuString = "CPU";
break;
}
default: break;
#else
case 0: // CPU mode
{
cpuGpuString = "CPU";
break;
}
default: break;
#endif
}

QElapsedTimer timer;
Expand Down Expand Up @@ -265,7 +279,10 @@ void Test::testFlightWrapper() const
{
if (IsBenchmarking())
{
QBENCHMARK_ONCE { testFlight(); }
QBENCHMARK_ONCE
{
testFlight();
}
}
else
{
Expand Down Expand Up @@ -324,7 +341,10 @@ void Test::testKeyframeWrapper() const
{
if (IsBenchmarking())
{
QBENCHMARK_ONCE { testKeyframe(); }
QBENCHMARK_ONCE
{
testKeyframe();
}
}
else
{
Expand Down Expand Up @@ -383,7 +403,10 @@ void Test::renderSimpleWrapper() const
{
if (IsBenchmarking())
{
QBENCHMARK_ONCE { renderSimple(); }
QBENCHMARK_ONCE
{
renderSimple();
}
}
else
{
Expand Down Expand Up @@ -443,7 +466,10 @@ void Test::testImageSaveWrapper() const
{
if (IsBenchmarking())
{
QBENCHMARK_ONCE { renderImageSave(); }
QBENCHMARK_ONCE
{
renderImageSave();
}
}
else
{
Expand Down

0 comments on commit 83b7a76

Please sign in to comment.